You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2023/01/10 09:46:03 UTC
[GitHub] [iotdb] BUAAserein commented on a diff in pull request #8807: [IOTDB-5345] Use the logical clock to identify the snapshot version of IoTConsensus
BUAAserein commented on code in PR #8807:
URL: https://github.com/apache/iotdb/pull/8807#discussion_r1065554295
##########
consensus/src/main/java/org/apache/iotdb/consensus/iot/IoTConsensusServerImpl.java:
##########
@@ -379,12 +389,13 @@ private void clearOldSnapshot() {
thisNode.getGroupId());
return;
}
- Arrays.sort(versionFiles, Comparator.comparing(File::getName));
- for (int i = 0; i < versionFiles.length - 1; i++) {
- try {
- FileUtils.deleteDirectory(versionFiles[i]);
- } catch (IOException e) {
- logger.error("Delete old snapshot dir {} failed", versionFiles[i].getAbsolutePath(), e);
+ for (File file : versionFiles) {
+ if (!file.getName().equals(latestSnapshotId)) {
Review Comment:
This method deletes the old files whose names are not the same as the latestSnapshotId. The old method uses string sort which could be wrong such as 2 with 11.
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org