You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "SzyWilliam (via GitHub)" <gi...@apache.org> on 2023/03/28 15:32:57 UTC
[GitHub] [iotdb] SzyWilliam opened a new pull request, #9475: [To rel/1.1][IOTDB-5738] Retain 2 copies of snapshot
SzyWilliam opened a new pull request, #9475:
URL: https://github.com/apache/iotdb/pull/9475
cherry pick of https://github.com/apache/iotdb/pull/9474
--
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
[GitHub] [iotdb] OneSizeFitsQuorum merged pull request #9475: [To rel/1.1][IOTDB-5738] Retain 2 copies of snapshot
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum merged PR #9475:
URL: https://github.com/apache/iotdb/pull/9475
--
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
[GitHub] [iotdb] SzyWilliam commented on a diff in pull request #9475: [To rel/1.1][IOTDB-5738] Retain 2 copies of snapshot
Posted by "SzyWilliam (via GitHub)" <gi...@apache.org>.
SzyWilliam commented on code in PR #9475:
URL: https://github.com/apache/iotdb/pull/9475#discussion_r1151477195
##########
consensus/src/main/java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java:
##########
@@ -166,11 +167,14 @@ public void format() throws IOException {}
@Override
public void cleanupOldSnapshots(SnapshotRetentionPolicy snapshotRetentionPolicy)
throws IOException {
- Path[] sortedSnapshotDirs = getSortedSnapshotDirPaths();
- if (sortedSnapshotDirs == null || sortedSnapshotDirs.length == 0) {
+ final Path[] sortedSnapshotDirs = getSortedSnapshotDirPaths();
+ if (ArrayUtils.isEmpty(sortedSnapshotDirs)) {
return;
}
- for (int i = 0; i < sortedSnapshotDirs.length - 1; i++) {
+
+ final int retainIndex =
+ snapshotRetentionPolicy.getNumSnapshotsRetained() - 1; // snapshot rank starts from 0
+ for (int i = retainIndex; i < sortedSnapshotDirs.length - 1; i++) {
Review Comment:
Fixed. Now they are the same. Thanks!
--
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
[GitHub] [iotdb] wangchao316 commented on a diff in pull request #9475: [To rel/1.1][IOTDB-5738] Retain 2 copies of snapshot
Posted by "wangchao316 (via GitHub)" <gi...@apache.org>.
wangchao316 commented on code in PR #9475:
URL: https://github.com/apache/iotdb/pull/9475#discussion_r1151455311
##########
consensus/src/main/java/org/apache/iotdb/consensus/ratis/SnapshotStorage.java:
##########
@@ -166,11 +167,14 @@ public void format() throws IOException {}
@Override
public void cleanupOldSnapshots(SnapshotRetentionPolicy snapshotRetentionPolicy)
throws IOException {
- Path[] sortedSnapshotDirs = getSortedSnapshotDirPaths();
- if (sortedSnapshotDirs == null || sortedSnapshotDirs.length == 0) {
+ final Path[] sortedSnapshotDirs = getSortedSnapshotDirPaths();
+ if (ArrayUtils.isEmpty(sortedSnapshotDirs)) {
return;
}
- for (int i = 0; i < sortedSnapshotDirs.length - 1; i++) {
+
+ final int retainIndex =
+ snapshotRetentionPolicy.getNumSnapshotsRetained() - 1; // snapshot rank starts from 0
+ for (int i = retainIndex; i < sortedSnapshotDirs.length - 1; i++) {
Review Comment:
The modification code and master branch are different. why?
--
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