Caideyipi commented on code in PR #18769:
URL: https://github.com/apache/iotdb/pull/18769#discussion_r4131838034
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/subscription/broker/consensus/ConsensusPrefetchingQueue.java:
##########
@@ -3369,11 +3369,39 @@ private boolean
commitWithoutOutstandingAndRefreshWalRetention(
return committed;
}
+ private long getRequiredRetainedMinVersionId() {
+ // Committed progress can advance on another consumer or replica while
this queue is still
+ // replaying an older local search index. Keep both boundaries so WAL
deletion can never pass
+ // the earliest entry this queue has not inspected yet.
+ return Math.min(getCommittedRetainedMinVersionId(),
getReplayRetainedMinVersionId());
+ }
+
private long getCommittedRetainedMinVersionId() {
refreshCommittedWalRetentionBound();
return committedRetainedMinVersionId;
}
+ private long getReplayRetainedMinVersionId() {
+ if (!(consensusReqReader instanceof WALNode)) {
+ return 0L;
+ }
+ final WALNode walNode = (WALNode) consensusReqReader;
+ return findReplayRetainedMinVersionId(
+ WALFileUtils.listAllWALFiles(walNode.getLogDirectory()),
nextExpectedSearchIndex.get());
Review Comment:
Applied in d90697ffe5a6. ConsensusPrefetchingQueue now reads a defensive
snapshot from the sorted WAL file cache maintained by WALNode, avoiding a
directory scan for replay retention. The targeted regression test and Spotless
both pass. 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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]