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



##########
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:
       This method is called from GCMergedRegionsProcedure and 
GCMulitpleMergedRegionsProcedure. I was wondering if we took a lock on the 
Region being Merged would it stop two overlapping GCs happening?
   
   The locking mechanism I'm talking of is in Procedure. There is a method 
called holdLock. Procedures operating on Regions will take out a lock while 
they are running to prevent other procedures operating at same time. If the 
Procedure implementation wants to hold the lock even when it is not executing 
to prevent other Procedures tampering, it will set this holdLock to true.
   
   A few Procedures do it: TruncateTableProcedure, DeleteTableProcedure, 
MergeTableRegionsProcedure. GC'ing  a Procedure seems like a candidate for one 
Procedure only being allowed to run the Delete. Changing the GC procedure to 
hold lock, does it help in your test?




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