smengcl commented on code in PR #5014:
URL: https://github.com/apache/ozone/pull/5014#discussion_r1258998118
##########
hadoop-hdds/framework/src/main/java/org/apache/hadoop/hdds/utils/RDBSnapshotProvider.java:
##########
@@ -110,21 +111,25 @@ public DBCheckpoint downloadDBSnapshotFromLeader(String
leaderNodeID)
"reloading state from the snapshot.", leaderNodeID);
checkLeaderConsistency(leaderNodeID);
- String snapshotFileName = getSnapshotFileName(leaderNodeID);
- File targetFile = new File(snapshotDir, snapshotFileName);
- downloadSnapshot(leaderNodeID, targetFile);
- LOG.info("Successfully download the latest snapshot {} from leader OM: {}",
- targetFile, leaderNodeID);
-
- numDownloaded.incrementAndGet();
- injectPause();
-
- RocksDBCheckpoint checkpoint = getCheckpointFromSnapshotFile(targetFile,
- candidateDir, true);
- LOG.info("Successfully untar the downloaded snapshot {} at {}.",
targetFile,
- checkpoint.getCheckpointLocation());
-
- return checkpoint;
+ while (true) {
+ String snapshotFileName = getSnapshotFileName(leaderNodeID);
+ File targetFile = new File(snapshotDir, snapshotFileName);
+ downloadSnapshot(leaderNodeID, targetFile);
+ LOG.info(
+ "Successfully download the latest snapshot {} from leader OM: {}",
+ targetFile, leaderNodeID);
+
+ numDownloaded.incrementAndGet();
+ injectPause();
+
+ RocksDBCheckpoint checkpoint = getCheckpointFromSnapshotFile(targetFile,
+ candidateDir, true);
+ if (ratisSnapshotComplete(checkpoint.getCheckpointLocation())) {
+ LOG.info("Successfully untar the downloaded snapshot {} at {}.",
+ targetFile, checkpoint.getCheckpointLocation());
+ return checkpoint;
Review Comment:
Best if we could keep a counter for the loop, in order to log the tarball
sequence number for debugging?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]