CRZbulabula opened a new pull request, #18699:
URL: https://github.com/apache/iotdb/pull/18699

   ## Description
   
   After a ConfigNode leader switch, a region migration procedure can resume 
before the Region leader cache is rebuilt. Both replica selection and leader 
transfer currently unbox a missing cache entry, causing a 
`NullPointerException` that terminates `RemoveRegionPeerProcedure` before 
removal completes.
   
   Treat a missing entry as the existing unknown-leader value (`-1`) in both 
lookups. This lets replica selection choose an eligible peer and lets Ratis 
leader transfer proceed when the current leader is unknown. Cached leaders 
retain their existing preference and transfer behavior.
   
   Add regression tests for DataRegions and SchemaRegions covering missing and 
explicitly unknown leaders, known-leader preference, excluded and unrelated 
nodes, successful leader transfer and cache updates, and a cache entry 
disappearing between the two lookups.
   
   ## Validation
   
   - Before the fix, the new regression suite reproduced eight 
`NullPointerException`s across both Region types, including failures at each of 
the two leader lookups.
   - After the fix, all 14 new cases and 12 existing related cases pass. The 
full reactor build succeeds with:
   
     ```sh
     mvn -B test \
       
-Dtest=RegionMaintainHandlerTest,RegionMaintainHandlerConsensusPipeTest,RemoveRegionPeerProcedureTest,RegionMigrateProcedureTest
 \
       -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false
     ```
   
   - `mvn -B spotless:apply -pl iotdb-core/confignode` passes.
   - `mvn -B test-compile -DskipTests -P with-zh-locale` passes for the full 
reactor.
   
   Cluster failover integration testing was not run.
   
   This PR has:
   
   - [x] been self-reviewed.
   - [x] added unit tests to cover the affected code paths.
   
   ## Key changed/added classes
   
   - `RegionMaintainHandler`
   - `RegionMaintainHandlerTest`
   


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

Reply via email to