Apache9 commented on code in PR #6991:
URL: https://github.com/apache/hbase/pull/6991#discussion_r2095897676


##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/MergeTableRegionsProcedure.java:
##########
@@ -450,6 +451,20 @@ private boolean prepareMergeRegion(final 
MasterProcedureEnv env) throws IOExcept
         "Skip merging regions " + regionNamesToLog + ", because we are 
snapshotting " + tn);
     }
 
+    /*
+     * Sometimes a ModifyTableProcedure has edited a table descriptor to 
change the number of region
+     * replicas for a table, but it has not yet opened/closed the new 
replicas. The
+     * ModifyTableProcedure assumes that nobody else will do the 
opening/closing of the new
+     * replicas, but a concurrent MergeTableRegionProcedure would violate that 
assumption. So, we
+     * need to wait for the ModifyTableProcedure to finish.
+     */
+    if (TableModificationProcedureUtils.isTableModificationInProgress(env, 
getTableName())) {
+      setFailure(getClass().getSimpleName(),
+        new IOException("Skip merging regions " + regionNamesToLog

Review Comment:
   > So then, should this merge request enter a retry loop/queue instead of 
simply failing? I think that the system overall will be more reliable if gets 
around to executing the requested procedure eventually.
   
   In the current code base it is not easy to do so. We set holdLock = true for 
split/merge procedure to avoid races, so we will hold the region exclusive lock 
all the time even if the procedure is waiting, this will hurt availability 
since TRSP can not get the region lock to assign it... Think of a region crash 
happens...
   
   And this may even introduce dead lock, for example, ModifyTableProcedure 
needs to reopen all the regions, which replies on schedule TRSPs for all the 
regions for a table, if split/merge procedure hold the region lock all the 
time, at least one TRSP can not be executed and cause the ModifyTableProcedure 
never end, but here the split/merge procedure needs to wait until the 
ModifyTableProcedure finishes...



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