Caideyipi commented on code in PR #19042:
URL: https://github.com/apache/iotdb/pull/19042#discussion_r4420065885
##########
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:
Applied in `135535a5f6`. The unchanged-progress shortcut now explicitly
requires the retained boundary to still be the current live WAL file. After a
roll, the version no longer matches, so the sealed boundary is rechecked even
without another ACK. The existing cached requirement check still keeps an
uncovered sealed file retained.
##########
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:
Applied in `135535a5f6`. When the target is beyond the live search-index
tail, `locateTargetFile()` now returns `walFiles.length - 1` directly.
`advanceTo()` still checks buffered requests and writer-progress coverage of
the skipped prefix before repositioning, including follower entries without a
local search index.
--
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]