apurtell commented on a change in pull request #330: HBASE-22617 Recovered WAL 
directories not getting cleaned up
URL: https://github.com/apache/hbase/pull/330#discussion_r296837262
 
 

 ##########
 File path: 
hbase-server/src/main/java/org/apache/hadoop/hbase/master/assignment/GCRegionProcedure.java
 ##########
 @@ -64,46 +68,57 @@ public TableOperationType getTableOperationType() {
 
   @Override
   protected Flow executeFromState(MasterProcedureEnv env, GCRegionState state)
-  throws ProcedureSuspendedException, ProcedureYieldException, 
InterruptedException {
+      throws ProcedureSuspendedException, ProcedureYieldException, 
InterruptedException {
     if (LOG.isTraceEnabled()) {
       LOG.trace(this + " execute state=" + state);
     }
     MasterServices masterServices = env.getMasterServices();
     try {
       switch (state) {
-      case GC_REGION_PREPARE:
-        // Nothing to do to prepare.
-        setNextState(GCRegionState.GC_REGION_ARCHIVE);
-        break;
-      case GC_REGION_ARCHIVE:
-        FileSystem fs = masterServices.getMasterFileSystem().getFileSystem();
-        if (HFileArchiver.exists(masterServices.getConfiguration(), fs, 
getRegion())) {
-          if (LOG.isDebugEnabled()) LOG.debug("Archiving region=" + 
getRegion().getShortNameToLog());
-          HFileArchiver.archiveRegion(masterServices.getConfiguration(), fs, 
getRegion());
-        }
-        setNextState(GCRegionState.GC_REGION_PURGE_METADATA);
-        break;
-      case GC_REGION_PURGE_METADATA:
-        // TODO: Purge metadata before removing from HDFS? This ordering is 
copied
-        // from CatalogJanitor.
-        AssignmentManager am = masterServices.getAssignmentManager();
-        if (am != null) {
-          if (am.getRegionStates() != null) {
-            am.getRegionStates().deleteRegion(getRegion());
+        case GC_REGION_PREPARE:
+          // Nothing to do to prepare.
+          setNextState(GCRegionState.GC_REGION_ARCHIVE);
+          break;
+        case GC_REGION_ARCHIVE:
+          MasterFileSystem mfs = masterServices.getMasterFileSystem();
+          FileSystem fs = mfs.getFileSystem();
+          if (HFileArchiver.exists(masterServices.getConfiguration(), fs, 
getRegion())) {
+            if (LOG.isDebugEnabled()) {
+              LOG.debug("Archiving region=" + getRegion().getShortNameToLog());
+            }
+            HFileArchiver.archiveRegion(masterServices.getConfiguration(), fs, 
getRegion());
+          }
+          FileSystem walFs = mfs.getWALFileSystem();
+          // Cleanup the directories on WAL filesystem also
+          Path regionWALDir = 
FSUtils.getWALRegionDir(env.getMasterConfiguration(),
+            getRegion().getTable(), getRegion().getEncodedName());
+          walFs.delete(regionWALDir, true);
 
 Review comment:
   +1 check exists first

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


With regards,
Apache Git Services

Reply via email to