You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by zh...@apache.org on 2020/10/15 02:22:40 UTC

[hbase] branch master updated: HBASE-25186 TestMasterRegionOnTwoFileSystems is failing after HBASE-25065 (#2544)

This is an automated email from the ASF dual-hosted git repository.

zhangduo pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase.git


The following commit(s) were added to refs/heads/master by this push:
     new 38ac7e2  HBASE-25186 TestMasterRegionOnTwoFileSystems is failing after HBASE-25065 (#2544)
38ac7e2 is described below

commit 38ac7e26ae0e3dacdeba23e1e9d2215ee2649849
Author: Duo Zhang <zh...@apache.org>
AuthorDate: Thu Oct 15 10:22:14 2020 +0800

    HBASE-25186 TestMasterRegionOnTwoFileSystems is failing after HBASE-25065 (#2544)
    
    Signed-off-by: Ramkrishna <ra...@apache.org>
---
 .../hadoop/hbase/master/region/MasterRegionWALRoller.java    |  6 ++++--
 .../java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java  | 12 +++++++-----
 2 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegionWALRoller.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegionWALRoller.java
index ef3dd12..bba6611 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegionWALRoller.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegionWALRoller.java
@@ -29,7 +29,6 @@ import org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL;
 import org.apache.hadoop.hbase.regionserver.wal.WALUtil;
 import org.apache.hadoop.hbase.wal.AbstractFSWALProvider;
 import org.apache.hadoop.hbase.wal.AbstractWALRoller;
-import org.apache.hadoop.hbase.wal.WAL;
 import org.apache.hadoop.hbase.wal.WALFactory;
 import org.apache.yetus.audience.InterfaceAudience;
 import org.slf4j.Logger;
@@ -68,8 +67,11 @@ public final class MasterRegionWALRoller extends AbstractWALRoller<Abortable> {
   }
 
   @Override
-  protected void afterRoll(WAL wal) {
+  protected void afterWALArchive(Path oldPath, Path newPath) {
     // move the archived WAL files to the global archive path
+    // here we do not use the newPath directly, so that even if we fail to move some of the
+    // newPaths, we are still safe because every time we will get all the files under the archive
+    // directory.
     try {
       MasterRegionUtils.moveFilesUnderDir(fs, walArchiveDir, globalWALArchiveDir,
         archivedWALSuffix);
diff --git a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
index a5a0ee3..4d89c47 100644
--- a/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
+++ b/hbase-server/src/main/java/org/apache/hadoop/hbase/wal/AbstractWALRoller.java
@@ -28,6 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.atomic.AtomicBoolean;
 import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.fs.Path;
 import org.apache.hadoop.hbase.Abortable;
 import org.apache.hadoop.hbase.HConstants;
 import org.apache.hadoop.hbase.regionserver.wal.AbstractFSWAL;
@@ -86,6 +87,11 @@ public abstract class AbstractWALRoller<T extends Abortable> extends Thread
               AbstractWALRoller.this.notifyAll();
             }
           }
+
+          @Override
+          public void postLogArchive(Path oldPath, Path newPath) throws IOException {
+            afterWALArchive(oldPath, newPath);
+          }
         });
       }
     }
@@ -190,7 +196,6 @@ public abstract class AbstractWALRoller<T extends Abortable> extends Thread
             LOG.warn("WAL has been closed. Skipping rolling of writer and just remove it", e);
             iter.remove();
           }
-          afterRoll(wal);
         }
       } catch (FailedLogCloseException | ConnectException e) {
         abort("Failed log close in log roller", e);
@@ -206,10 +211,7 @@ public abstract class AbstractWALRoller<T extends Abortable> extends Thread
     LOG.info("LogRoller exiting.");
   }
 
-  /**
-   * Called after we finish rolling the give {@code wal}.
-   */
-  protected void afterRoll(WAL wal) {
+  protected void afterWALArchive(Path oldPath, Path newPath) {
   }
 
   /**