Skip to content

[Subscription] Preserve WAL replay progress across pending gaps - #18831

Open
Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-pending-wal-gap-replay
Open

Caideyipi wants to merge 1 commit into
apache:masterfrom
Caideyipi:fix/subscription-pending-wal-gap-replay

Conversation

@Caideyipi

Copy link
Copy Markdown
Collaborator

Description

When realtime admission leaves a WAL gap before newer pending requests, fillGapFromWAL recreates the iterator on every round. The replacement starts scanning retained files again, including entry bodies below the local replay cursor. This can make repeated reads and decompression dominate replay during ongoing writes, and discards requests cached after Tablet memory backpressure. The catch-up iterator preservation in #18808 does not cover this pending-gap path.

Advance the existing iterator using the established writer-progress coverage checks. Bounded gap replay and memory retries retain their reader position and buffered request. If materialization throws after consuming a request, schedule an explicit reset at the replay cursor so that the failed request is recovered on the next round.

Validation

Three regression scenarios use real V3 WAL and check ordered delivery, ACK memory release, replay progress, and actual entry-body reads:

  • Repeated gaps across bounded rounds: six delivered requests read 7 bodies instead of 15.
  • Repeated gaps with memory backpressure: six delivered requests read 8 bodies instead of 33.
  • A one-time conversion failure: the failed request is retried and delivered in order.

The first two regressions fail against master before this change. This addresses a reproducible replay defect matching the observed gap-recovery path; the original 27698 workload has not been rerun, so it does not establish the complete incident root cause.

The four related test classes pass: 78 tests succeeded and one opt-in performance benchmark was skipped.

Validation commands:

  • mvn spotless:apply -pl iotdb-core/datanode
  • mvn test -pl iotdb-core/datanode -am -Dtest=ConsensusPrefetchingQueueTest,ProgressWALIteratorTest,ConsensusPrefetchingQueueWalBackpressureTest,ConsensusPrefetchingQueueDataNodeMemoryTest -Dsurefire.failIfNoSpecifiedTests=false -DfailIfNoTests=false
  • mvn test-compile -DskipTests
  • mvn test-compile -P with-zh-locale -DskipTests

This PR has:

  • been self-reviewed for concurrent prefetch, ACK, seek, and close behavior.
  • added comments explaining reader preservation and exceptional retry.
  • added unit tests covering the changed replay path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant