You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by GitBox <gi...@apache.org> on 2021/10/11 15:48:40 UTC

[GitHub] [hbase] Apache9 commented on a change in pull request #3679: HBASE-26267 Don't try to recover WALs from a WAL dir which doesn't exist

Apache9 commented on a change in pull request #3679:
URL: https://github.com/apache/hbase/pull/3679#discussion_r726241962



##########
File path: hbase-server/src/main/java/org/apache/hadoop/hbase/master/region/MasterRegion.java
##########
@@ -227,7 +227,31 @@ private static HRegion open(Configuration conf, TableDescriptor td, FileSystem f
     if (!walFs.exists(replayEditsDir) && !walFs.mkdirs(replayEditsDir)) {
       throw new IOException("Failed to create replay directory: " + replayEditsDir);
     }
+
+    // Replay any WALs for the Master Region before opening it.
     Path walsDir = new Path(walRootDir, HREGION_LOGDIR_NAME);
+    // In open(...), we expect that the WAL directory for the MasterRegion to already exist.
+    // This is in contrast to bootstrap() where we create the MasterRegion data and WAL dir.
+    // However, it's possible that users directly remove the WAL directory. We expect walsDir
+    // to always exist in normal situations, but we should guard against users changing the
+    // filesystem outside of HBase's line of sight.
+    if (walFs.exists(walsDir)) {
+      replayWALs(conf, walFs, walRootDir, walsDir, regionInfo, serverName, replayEditsDir);
+    } else {
+      LOG.warn("UNEXPECTED: WAL directory for MasterRegion is missing."

Review comment:
       Better use LOG.error here and say it may cause data loss? In general, removing directories directly outside the HBase control is a dangerous operation...




-- 
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: issues-unsubscribe@hbase.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org