Caideyipi opened a new pull request, #18392: URL: https://github.com/apache/iotdb/pull/18392
## Description ### Reuse the WAL iterator during historical catch-up A bounded consensus-subscription prefetch round recreated `ProgressWALIterator` at `nextExpectedSearchIndex` before reading each batch. The iterator still opens retained WAL files from the beginning and applies `startSearchIndex` only after request deserialization, so every batch repeatedly scanned all earlier WAL entries. The resulting read amplification grew with catch-up progress and made consumption progressively slower. This change keeps the existing iterator, including its WAL reader cursor and buffered look-ahead request, across normal bounded prefetch rounds. Explicit resets remain in place for seek, WAL-gap recovery, exhausted live WAL refresh, and memory rollback. ### Regression coverage A real sealed-WAL test limits each batch to one entry and verifies that three consecutive catch-up rounds: - reuse the same `ProgressWALIterator`; - advance the read search index contiguously; - deliver writer local sequences 1, 2, and 3 exactly once. ### Verification ```text mvn -o test -pl iotdb-core/datanode -am -Dtest=ProgressWALIteratorTest,ConsensusPrefetchingQueueTest,ConsensusPrefetchingQueueWalBackpressureTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false ``` Tests run: 29, Failures: 0, Errors: 0, Skipped: 0. This PR has: - [x] been self-reviewed. - [x] added comments explaining the why and intent of the code. - [x] added unit tests covering the regression. ##### Key changed/added classes - `ConsensusPrefetchingQueue` - `ConsensusPrefetchingQueueWalBackpressureTest` -- 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]
