huaxiangsun commented on a change in pull request #1584:
URL: https://github.com/apache/hbase/pull/1584#discussion_r418788221



##########
File path: 
hbase-client/src/main/java/org/apache/hadoop/hbase/MetaTableAccessor.java
##########
@@ -1846,6 +1846,16 @@ public static void deleteMergeQualifiers(Connection 
connection, final RegionInfo
       qualifiers.add(qualifier);
       delete.addColumns(getCatalogFamily(), qualifier, 
HConstants.LATEST_TIMESTAMP);
     }
+
+    // There will be race condition that a GCMultipleMergedRegionsProcedure is 
scheduled while
+    // the previous GCMultipleMergedRegionsProcedure is still going on, in 
this case, the second
+    // GCMultipleMergedRegionsProcedure could delete the merged region by 
accident!
+    if (qualifiers.isEmpty()) {

Review comment:
       @saintstack I checked the code and went through what you said above. My 
understanding is that the lock prevents two procedures working on the same 
region at the same time. In this specific case, it is multiple 
MergeTableRegionsProcedures are submitted to clean up the merge states, so 
there are already locks in place. These multiple MergeTableRegionsProcedures 
are executed sequentially, because it does not check if there are mergeXXX 
qualifiers to delete, the second one could delete the child region.  To make 
MergeTableRegionsProcedures idempotent, we need this fix here. What do you 
think? There is another jira HBASE-24250 created by Andrey, where multiple 
MergeTableRegionsProcedures are observed in running clusters. 




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to