teamconfx opened a new pull request, #7667:
URL: https://github.com/apache/hbase/pull/7667

   
   A fix for [HBASE-29806](https://issues.apache.org/jira/browse/HBASE-29806): 
RegionRemoteProcedureBase.afterReplay() causes NPE when parent procedure has 
already completed.
   
   ### Root Cause
   
     When the master restarts after a crash:
     1. Parent TransitRegionStateProcedure may have completed and is placed in 
the completed map
     2. Child RegionRemoteProcedureBase may still be pending and is placed in 
the procedures map
     3. afterReplay() is called on the child, which calls 
getParent(env).attachRemoteProc(this)
     4. getParent() uses getProcedure(procId) which only checks the procedures 
map, not the completed map
     5. This returns null, causing NPE when calling attachRemoteProc() on it
   
   ### Changes Made
   
     File: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionRemoteProcedureBase.java
   
     1. Fixed afterReplay() method (lines 434-451):
       - Added null check for parent procedure
       - If parent is null, logs a warning and returns gracefully
       - The orphaned child procedure will be cleaned up by the procedure 
executor
     2. Fixed unattach() method (lines 289-296):
       - Added null check for parent procedure
       - If parent is null, silently skips unattach since parent has already 
completed
   
    ### Test Added
   
     File: 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionRemoteProcedureBaseOrphanAfterReplay.java
   
     A unit test that:
     - Mocks the MasterProcedureEnv to return null when getProcedure() is called
     - Simulates the orphaned child scenario
     - Verifies that afterReplay() doesn't throw NPE
   
   ### Files Changed
   
     - 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/RegionRemoteProcedureBase.java
 (modified)
     - 
hbase-server/src/test/java/org/apache/hadoop/hbase/master/assignment/TestRegionRemoteProcedureBaseOrphanAfterReplay.java
 (new)
   
   
   


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