Repository navigation
[Subscription] Release uncommitted tablet payloads with WAL replay - #18866
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #18866 +/- ##
============================================
- Coverage 45.94% 45.93% -0.01%
Complexity 712 712
============================================
Files 5502 5502
Lines 399066 399420 +354
Branches 52019 52101 +82
============================================
+ Hits 183346 183479 +133
- Misses 215720 215941 +221 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
| private void reclaimDeliveredPayload( | ||
| final SubscriptionEvent event, final DeliveryBatchRecord record) { | ||
| if (event.isPayloadDetached() || !record.delivered) { | ||
| return; | ||
| } | ||
| // Pending entries can precede durable WAL visibility. Verify every member and fragment before | ||
| // releasing the only payload copy. This read does not change replay or committed progress. | ||
| if (!record.replayable && Objects.isNull(readDeliveryBatch(event, record, false))) { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Will readDeliveryBatch(event, record, false) be too costly here?
There was a problem hiding this comment.
Yes—the previous path repeated a WAL scan/deserialization in the poll delivery callback. Changed it to reuse the initial complete WAL read (including all fragments and the seal, with no incomplete scan), propagated across every batch member; WAL-backed delivery now opens no extra iterator.
Pending/partial batches keep their payload and are validated by the prefetch worker after delivery. Successful validation remains cached across redeliveries. This preserves the WAL-readability guard while moving pending validation off the RPC path.
Added three regressions for reader reuse, deferred validation, and mixed-batch safety. Focused subscription/WAL validation: 151 tests, 0 failures/errors, 1 existing skip.
jt2594838
left a comment
There was a problem hiding this comment.
Most of the entries should be pending ones, and checking them is still too costly in most scenarios.
…scription-wal-backed-inflight
Description
Delayed manual ACKs currently keep every delivered consensus tablet batch materialized, so a consumer can exhaust the broker's tablet budget before it finishes a transaction, batch, or checkpoint. This change releases a delivered batch's tablets and response cache after serialization, while retaining its commit context and a compact delivery record. Releasing the payload does not advance committed progress.
Delivery and replay
Resource tradeoffs
Payload reclamation adds no WAL reads. Redelivery adds disk reads and materialization work. Delivery metadata remains proportional to the number of outstanding batches; member coordinates are compressed and records retain neither tablets nor serialized payloads. The existing single-entry size limit still applies.
Validation
PipeMemoryManagerResizeTestcompilation issue; no build-file change is included in this PR.git diff --checkpass.This PR has:
Key changed classes
ConsensusPrefetchingQueue,ConsensusLogToTabletConverter,SubscriptionEvent,SubscriptionEventSingleResponse,CachedSubscriptionPollResponse, andSubscriptionReceiverV1.