smengcl commented on code in PR #5014:
URL: https://github.com/apache/ozone/pull/5014#discussion_r1258987574
##########
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:
The log message here IMO is not correct. The LOG inside the condition should
be moved out. And add extra logging if uncessary:
```suggestion
RocksDBCheckpoint checkpoint =
getCheckpointFromSnapshotFile(targetFile,
candidateDir, true);
LOG.info("Successfully untar the downloaded snapshot {} at {}.",
targetFile, checkpoint.getCheckpointLocation());
if (ratisSnapshotComplete(checkpoint.getCheckpointLocation())) {
LOG.info("Ratis snapshot transfer is complete.");
return checkpoint;
```
--
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]