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

   Generated-by: Claude Code (Opus 5.5)
   
   ## What changes were proposed in this pull request?
   
   
`TestPerVolumePushReplication#testHealthyVolumeReplicationAfterVolumeFailure` 
intermittently times out waiting for the pushed container to appear on the 
target datanode.
   
   The source datanode drops the injected push command:
   
   ```
   StateContext.getNextCommand - Detect and drop a SCMCommand 
replicateContainerCommand: ... term: 0, ... containerId=1000003 ... from stale 
leader SCM, stale term 0, latest term 2.
   ```
   
   `testPushAndScmReplicationWithPerVolumeEnabled` restarts a datanode at the 
end, and the next test can pick that same datanode as the push source. 
`queueReplicationCommand` stamped the command with the datanode's own term 
(`context.getTermOfLeaderSCM().ifPresent(cmd::setTerm)`), which is not yet 
initialized on a just restarted datanode, so the command kept term 0. Once 
`StateContext` initialized the term from real SCM commands (term 2), it dropped 
the push as coming from a stale leader SCM.
   
   The fix stamps the command with the SCM leader term 
(`getScmContext().getTermOfLeader()`), as `TestCloseContainerByPipeline` and 
`TestDeleteContainerHandler` already do, so the command no longer depends on 
whether the datanode has learned the term.
   
   ## What is the link to the Apache JIRA
   
   https://issues.apache.org/jira/browse/HDDS-16801
   
   ## How was this patch tested?
   
   - `mvn -pl :ozone-integration-test -am test 
-Dtest=TestPerVolumePushReplication`: 3/3 passed locally.
   - The fix is deterministic by construction: the command always carries the 
current SCM leader term, which is the term the datanode converges to, so it 
cannot be classified as stale. One green run alone cannot prove the absence of 
the race.
   - 10x10 
[flaky-test-check](https://github.com/smengcl/hadoop-ozone/actions/runs/37865932420)
 on this branch (whole class, since the race needs the datanode restart from 
the preceding test): in progress
   
   🤖 Generated with [Claude Code](https://claude.com/claude-code)
   


-- 
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