jojochuang commented on code in PR #6534:
URL: https://github.com/apache/hbase/pull/6534#discussion_r1905891909
##########
hbase-server/src/main/java/org/apache/hadoop/hbase/master/SplitWALManager.java:
##########
@@ -184,4 +184,30 @@ public void releaseSplitWALWorker(ServerName worker,
MasterProcedureScheduler sc
public void addUsedSplitWALWorker(ServerName worker) {
splitWorkerAssigner.addUsedWorker(worker);
}
+
+ /**
+ * Rename the WAL file at the specified walPath to retry with another
worker. Returns true if the
+ * file is successfully renamed, or if it has already been renamed in
previous try. Returns false
+ * if neither of the files exists. It throws an IOException if got any error
while renaming. This
+ * method is only called in case of failure on one worker so in case of no
failure flow is same as
+ * old one.
+ */
+ public boolean ifExistRenameWALForRetry(String walPath, String
postRenameWalPath)
+ throws IOException {
+ if (fs.exists(new Path(rootDir, walPath))) {
+ if (!fs.rename(new Path(rootDir, walPath), new Path(rootDir,
postRenameWalPath))) {
Review Comment:
Thanks guys.
I think what's more relevant for HBase is that it used to cause race
conditions if the WAL files are kept open while being renamed. HBASE-27732
fixed one such bug -- because HDFS allows renaming open files, it doesn't fail
immediately but it causes NPE later. Ozone fails right away with that bug. Took
us a few days to find out.
(I need to check but I think directory rename is fine for Ozone in this case)
--
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]