ArafatKhan2198 opened a new pull request, #12207:
URL: https://github.com/apache/ozone/pull/12207

   ## What changes were proposed in this pull request?
   
   **What was going wrong**
   
   1. An admin puts a datanode in maintenance with `ozone admin datanode 
maintenance`, waits until SCM shows IN_MAINTENANCE, then stops the node.
   2. Recon learns the operational state of a live datanode only from that 
datanode's heartbeats. Those arrive every `hdds.heartbeat.recon.interval`, 60s 
by default, so Recon can lag SCM by up to about 90s.
   3. The node is stopped before Recon hears the new state, so Recon still has 
ENTERING_MAINTENANCE or IN_SERVICE for it.
   4. The node goes DEAD in Recon. `ReconDeadNodeHandler.onMessage` calls 
`DeadNodeHandler.onMessage` first.
   5. `DeadNodeHandler` keeps the replicas of a dead node only when it is 
IN_MAINTENANCE, and it reads that state from Recon's own node manager. Recon's 
state is not IN_MAINTENANCE, so the replicas are removed.
   6. Only afterwards does the handler fetch the node list from SCM and copy 
the operational state. The replica decision has already been made.
   7. For the whole maintenance Recon reports the node's containers 
UNDER_REPLICATED while SCM, which keeps the replicas of an IN_MAINTENANCE node, 
reports them healthy. The replicas come back only when the node returns and 
reports.
   
   **The fix**
   
   - `ReconDeadNodeHandler.onMessage` now fetches the operational state from 
SCM first, then calls `DeadNodeHandler.onMessage`, then runs the container 
health and pipeline sync tasks.
   - Recon then keeps the replicas of a node that SCM has IN_MAINTENANCE, as 
SCM does.
   
   **Why it is safe**
   
   - No new SCM call is added. `scmClient.getNodes()` was already called in 
this handler on every dead node event; only the order changed.
   - If the SCM call fails, the error is logged as before, Recon decides with 
its own state, which is today's behaviour, and the two tasks are skipped as 
before.
   - Only Recon's monitoring view changes. SCM and the data are untouched.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-17066
   
   ## How was this patch tested?
   
   - New parameterized 
`TestReconNodeManager#testDeadNodeHandlerUsesOperationalStateFromScm`: SCM 
IN_MAINTENANCE keeps the replica, SCM IN_SERVICE and a failing SCM call remove 
it, and the pipeline sync is skipped when the SCM call fails. The first case 
fails without the change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to