HeimingZ commented on code in PR #11682:
URL: https://github.com/apache/iotdb/pull/11682#discussion_r1423590781
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java:
##########
@@ -252,20 +254,24 @@ public DeleteOutdatedFileTask() {
}
private void init() {
- this.firstValidVersionId = initFirstValidWALVersionId();
Review Comment:
We don‘t need firstValidWALVersionId any more, but I think we should keep
initFirstValidWALVersionId method because the delete procedure will try to
delete current file in this method.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java:
##########
@@ -252,20 +254,24 @@ public DeleteOutdatedFileTask() {
}
private void init() {
- this.firstValidVersionId = initFirstValidWALVersionId();
- this.filesShouldDelete =
logDirectory.listFiles(this::filterFilesToDelete);
- if (filesShouldDelete == null) {
- filesShouldDelete = new File[0];
+ File[] allWalFilesOfOneNode = WALFileUtils.listAllWALFiles(logDirectory);
+ if (allWalFilesOfOneNode == null) {
+ allWalFilesOfOneNode = new File[0];
}
+ WALFileUtils.ascSortByVersionId(allWalFilesOfOneNode);
+ this.sortedWalFilesExcludingLast =
+ Arrays.copyOfRange(allWalFilesOfOneNode, 0,
allWalFilesOfOneNode.length - 1);
Review Comment:
Exception occurs when allWalFilesOfOneNode.length==0
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/wal/node/WALNode.java:
##########
@@ -252,20 +254,24 @@ public DeleteOutdatedFileTask() {
}
private void init() {
- this.firstValidVersionId = initFirstValidWALVersionId();
Review Comment:
We don‘t need firstValidWALVersionId any more, but I think we should keep
initFirstValidWALVersionId method because the delete procedure will try to
delete current file in this method.
--
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]