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: [email protected]

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


Reply via email to