merlimat opened a new pull request, #25768:
URL: https://github.com/apache/pulsar/pull/25768

   ## Summary
   
   P3 of the metadata-driven transactions stack 
([PIP-473](https://github.com/apache/pulsar/issues/...)), building on the data 
layer landed in #25754. Adds a `TransactionBuffer` implementation for 
`segment://` topics that reads truth from the metadata-store layout rather than 
from a per-topic snapshot log.
   
   - `MetadataTransactionBuffer` — header-cache + per-segment first-position 
tracking for `maxReadPosition`. `appendBufferToTxn` does a cache-first header 
authorization, then ML append, then a `/txn-op` write; all three must succeed 
before the producer is ack'd. State transitions are driven by 
`/txn-segment-events` notifications — on each event we re-read headers for 
every currently-open txn (K is small, so this is cheap and inherently tolerates 
`subscribeSequence`'s collapse semantics).
   - Recovery rebuilds state from `listWritesBySegment` + per-txn header reads 
("Option C" from the impl plan): no persisted event offset, no per-event 
replay. Cost bounded by active load on the segment, not by history.
   - `MetadataTransactionBufferProvider` constructs the buffer from the 
broker's local `MetadataStore`.
   - `DispatchingTransactionBufferProvider` routes `segment://` topics to the 
metadata buffer and falls through to `TopicTransactionBuffer` for the legacy 
`persistent://` path. This is now the configured default so segment topics pick 
up the new buffer out of the box.
   - Helpers shared with P4 / P5: `TxnIds` (`<most>-<least>` round-trip for 
`TxnID`), `TxnPaths.txnIdFromOpPath`, 
`TxnMetadataStore.deleteWriteOpsForSegmentAndTxn`.
   
   ## Test plan
   
   - [x] `:pulsar-broker:test --tests MetadataTransactionBufferTest` — 7 
scenarios on the in-memory `MetadataStore`: open/commit/abort, concurrent open 
txns, TxnConflict on terminal header, recovery from pre-populated metadata, 
`isTxnAborted` on unknown txn
   - [x] `:pulsar-broker:test --tests DispatchingTransactionBufferProviderTest` 
— 2 routing tests covering `segment://` ↔ `persistent://`
   - [x] `:pulsar-broker:checkstyleMain` + `:pulsar-broker:checkstyleTest` clean


-- 
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]

Reply via email to