cxzl25 opened a new pull request, #9015:
URL: https://github.com/apache/hadoop/pull/9015

   ### Description of PR
   
   `TestDecommission#testDeleteCorruptReplicaForUnderReplicatedBlock` (also run 
by `TestDecommissionWithBackoffMonitor`) fails intermittently with `Node ... 
failed to complete decommissioning`.
   
   **Root cause:** while waiting for decommissioning, the test calls 
`BlockManager#clearQueues()` on every check. Besides `pendingReconstruction`, 
that call also clears `invalidateBlocks` and the per-datanode command queues. 
When the Namenode processes a restarted datanode's block report, it queues a 
DNA_INVALIDATE for the stale replica and removes that replica from the 
blocksMap immediately. If `clearQueues()` runs before the invalidation is sent, 
the invalidation is lost and the Namenode never sends it again (until the next 
full block report, 6h). The datanode keeps the old-GS replica and rejects every 
DNA_TRANSFER with `ReplicaAlreadyExistsException`, so the decommissioning node 
never gets its second live replica.
   
   Changes (test only):
   1. Remove the `clearQueues()` call. Set 
`dfs.namenode.reconstruction.pending.timeout-sec=3` instead, so that a transfer 
that fails because the target has not deleted its corrupt replica yet is 
rescheduled soon. This was the original purpose of `clearQueues()`.
   2. Wait for the expected replication with `DFSTestUtil#waitReplication` 
after create and append. `close()` returns once the minimum number of replicas 
(1) is reported, so the IBR from the second pipeline datanode can arrive after 
the test reads the block locations (`Expecting 2 replicas in block pipeline, 
unexpectedly found 1 replicas`).
   3. Remove `TestDecommission` and `TestDecommissionWithBackoffMonitor` from 
`.github/gha-tests/exclude-tests.txt`, so that they run in the GHA "hdfs - 
slow" job again.
   
   ### How was this patch tested?
   - Locally (macOS, JDK 17), repeated runs in parallel JVMs:
     - before: 3/90 failed, all with `failed to complete decommissioning`. 
Logging `getPendingDeletionBlocksCount()` before each `clearQueues()` showed a 
pending invalidation in every failing run and in none of the passing runs.
     - after: 120 runs × (`TestDecommission` + 
`TestDecommissionWithBackoffMonitor`) = 240/240 passed.
     - with the race forced (waiting for `pendingDeletionBlocks > 0` before the 
loop): 6/6 failed before, 6/6 passed after.
   - GitHub Actions (ubuntu-24.04, JDK 17), 5 jobs × 10 iterations × both 
classes:
     - before: 31/100 failed
     - after: 0/100 failed
   - The whole `TestDecommission` and `TestDecommissionWithBackoffMonitor` 
classes with this patch: 5/5 runs green on GitHub Actions, with no flaky reruns.
   - The real GHA Build workflow's "hdfs - slow" job with both classes removed 
from `exclude-tests.txt`, 5 copies of the job in parallel in one workflow run 
on my fork: all 5 green. Each ran all 65 slow test classes; `TestDecommission` 
and `TestDecommissionWithBackoffMonitor` passed 29/29 (1 skipped) every time, 
with no reruns. 
   
   ### For code changes:
   
   - [ ] Does the title of this PR start with the corresponding JIRA issue id 
(e.g. 'HADOOP-17799. Your PR title ...')?
   - [ ] Object storage: Have the integration tests been executed and the 
endpoint
         declared according to the connector-specific documentation? *Note: 
Automated CI
         testing doesn't cover all cases so manual testing with cloud storage 
is still
         required.*
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] If applicable, have you updated the `LICENSE`, `LICENSE-binary`, 
`NOTICE-binary` files?
   
   ### AI Tooling
   
   If an AI tool was used:
   
   - [ ] The PR includes the phrase "Contains content generated by <tool>"
         where <tool> is the name of the AI tool used.
   - [ ] My use of AI contributions follows the ASF legal policy
         https://www.apache.org/legal/generative-tooling.html
   


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