jt2594838 commented on code in PR #19042:
URL: https://github.com/apache/iotdb/pull/19042#discussion_r4419768777


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/broker/consensus/ConsensusPrefetchingQueue.java:
##########
@@ -4791,14 +4791,9 @@ private boolean refreshCommittedWalRetentionBound() {
         commitManager.getCommittedRegionProgress(consumerGroupId, topicName, 
consensusGroupId);
 
     synchronized (committedRetentionLock) {
-      if (Objects.equals(lastCommittedProgressForRetention, 
committedRegionProgress)
-          && Objects.nonNull(lastRetainedWalFileForRetention)
-          && lastRetainedWalFileForRetention.exists()) {
-        return false;
-      }
-
       // The previous boundary still applies while its sealed requirement is 
uncovered, or while
-      // it is the current live WAL file. Both cases require monotonically 
advancing progress.
+      // it is the current live WAL file. Recheck even unchanged progress: a 
roll may have sealed
+      // the formerly live file after its last ACK, making that file 
reclaimable without new writes.

Review Comment:
   Is it possible to check only if it is the live WAL file?



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/broker/consensus/ProgressWALIterator.java:
##########
@@ -351,10 +354,11 @@ private void refreshForNewerLiveWalFile() {
   }
 
   private int locateTargetFile(final long targetSearchIndex) {
-    if (walFiles.length == 0
-        || (liveWalNode != null && targetSearchIndex > 
liveWalNode.getCurrentSearchIndex())) {
+    if (walFiles.length == 0) {
       return -1;
     }
+    // Pending delivery may have advanced one past the live tail. Still 
realign to its file after
+    // verifying coverage of the sealed prefix, before committed history can 
be reclaimed.
     return WALFileUtils.binarySearchFileBySearchIndex(walFiles, 
targetSearchIndex);
   }

Review Comment:
   Is it possible to locate the last file directly in this case?



-- 
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]

Reply via email to