eatmoreduck opened a new pull request, #24253: URL: https://github.com/apache/kafka/pull/24253
## Description Fixes KAFKA-21505. The five headers-aware adapters and the two older timestamped adapters did not override `readOnly(IsolationLevel)` and inherited the interface default that returns `this`. With `enable.transactional.statestores=true`, outer layers pass `readOnly(level)` down to their inner store, and the RocksDB stores override it so that `READ_COMMITTED` skips the transaction buffer — but the chain stopped at these adapters: they returned themselves, so reads kept going through the inner store's transaction buffer and a `READ_COMMITTED` read could see writes that were not committed yet. Each adapter now overrides `readOnly(IsolationLevel)` to delegate to the inner store's read-only view and apply the adapter's format conversion on top, following the existing `MeteredKeyValueStore.ReadOnlyView` pattern: - `PlainToHeadersStoreAdapter` / `TimestampedToHeadersStoreAdapter` → `ReadOnlyKeyValueStore` views converting via `convertFromPlainToHeaderFormat` / `convertToHeaderFormat` and `MappingKeyValueIteratorAdapter` - `PlainToHeadersWindowStoreAdapter` / `TimestampedToHeadersWindowStoreAdapter` → `ReadOnlyWindowStore` views with the same conversion pair - `SessionToHeadersStoreAdapter` → `ReadOnlySessionStore` view via `timestampedToHeaders` / `convertToHeaderFormat` - The two older adapters named under "Related" in the ticket (`KeyValueToTimestampedKeyValueByteStoreAdapter`, `WindowToTimestampedWindowByteStoreAdapter`) had the same gap and are fixed the same way via `convertToTimestampedFormat` and the `KeyValueToTimestampedKeyValueIteratorAdapter` / `WindowToTimestampedWindowIteratorAdapter` wrappers. The `readOnly` removals from the `SPECIAL` sets in `TimestampedToHeadersWindowStoreAdapterCompletenessTest` and `SessionToHeadersStoreAdapterCompletenessTest` suggested in the ticket are not included because those tests come from KAFKA-20328 (PR #22992), which is not merged into trunk yet. ## Test coverage Each adapter test suite gains a case asserting that `readOnly(READ_COMMITTED)` no longer returns the adapter itself, that reads go through the inner store's read-only view (a staged write through the adapter's own read path is not what the view returns), and that values are converted to the adapter's format. The two window adapter tests exercise this against a real `RocksDBWindowStore`/`RocksDBTimestampedWindowStore` stack; the others are Mockito-driven like their existing suites. The two older timestamped adapters had no dedicated test classes and get minimal ones. -- 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]
