avijayanhwx commented on a change in pull request #1430:
URL: https://github.com/apache/hadoop-ozone/pull/1430#discussion_r492877283
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -994,6 +1005,45 @@ public static boolean omInit(OzoneConfiguration conf)
throws IOException,
}
}
+ public boolean applyAllPendingTransactions()
+ throws InterruptedException, IOException {
+
+ if (!isRatisEnabled) {
+ LOG.info("Ratis not enabled. Nothing to do.");
+ return true;
+ }
+
+ String purgeConfig = omRatisServer.getServer()
+ .getProperties().get(PURGE_UPTO_SNAPSHOT_INDEX_KEY);
+ if (!Boolean.parseBoolean(purgeConfig)) {
+ throw new IllegalStateException("Cannot prepare OM for Upgrade since " +
+ "raft.server.log.purge.upto.snapshot.index is not true");
+ }
+
+ waitForAllTxnsApplied(omRatisServer.getOmStateMachine(),
+ omRatisServer.getRaftGroup(),
+ (RaftServerProxy) omRatisServer.getServer(),
+ TimeUnit.MINUTES.toSeconds(5));
Review comment:
Thanks, will change it to a variable.
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManagerStarter.java
##########
@@ -98,6 +98,28 @@ public void initOm()
}
}
+
+ /**
+ * This function implements a sub-command to allow the OM to be
+ * "prepared for upgrade".
+ */
+ @CommandLine.Command(name = "--prepareForUpgrade",
+ aliases = {"--prepareForDowngrade", "--flushTransactions"},
Review comment:
+1 to @fapifta's reply.
##########
File path:
hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/OzoneManager.java
##########
@@ -994,6 +1005,45 @@ public static boolean omInit(OzoneConfiguration conf)
throws IOException,
}
}
+ public boolean applyAllPendingTransactions()
+ throws InterruptedException, IOException {
+
+ if (!isRatisEnabled) {
+ LOG.info("Ratis not enabled. Nothing to do.");
+ return true;
+ }
+
+ String purgeConfig = omRatisServer.getServer()
+ .getProperties().get(PURGE_UPTO_SNAPSHOT_INDEX_KEY);
+ if (!Boolean.parseBoolean(purgeConfig)) {
+ throw new IllegalStateException("Cannot prepare OM for Upgrade since " +
+ "raft.server.log.purge.upto.snapshot.index is not true");
+ }
Review comment:
Maybe not. In the Ratis StateMachineUpdater, the takeSnapshot() method
uses this config to purge logs immediately after taking a state machine
snapshot. Hence, I thought that it was good to have a check in place to make
sure no one changes the config from within. I am ok with removing it for now,
and handling snapshot + log purge in HDDS-4268 as a follow up patch.
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]