Jess668 opened a new pull request, #22666:
URL: https://github.com/apache/kafka/pull/22666
This PR is the **first increment of KIP-1356** — the key/value point query —
for
`TimestampedKeyValueStoreWithHeaders`. The range/window/session header query
types described in the
KIP will follow in subsequent PRs.
## Summary
1. **`ReadOnlyRecord<K, V>`** (new,
`org.apache.kafka.streams.processor.api`) — a read-only view
exposing `key()` / `value()` / `timestamp()` / `headers()`. `Record` now
`implements ReadOnlyRecord`.
2. **`TimestampedKeyWithHeadersQuery<K, V>`** (new, `@Evolving`,
`org.apache.kafka.streams.query`) —
the headers-aware parallel of `TimestampedKeyQuery`, returning a
`ReadOnlyRecord` that carries the
key, value, timestamp, and headers.
3. **Native header store serves basic IQv2 queries.**
`RocksDBTimestampedStoreWithHeaders` no longer
overrides `query(...)` to return `UNKNOWN_QUERY_TYPE`; it inherits
`RocksDBStore.query()`, so the
existing query types (`KeyQuery`, `RangeQuery`, …) behave identically on
both build paths.
4. **Header store caching participates in IQv2 point queries.**
`CachingKeyValueStoreWithHeaders` no
longer overrides `query(...)` to bypass the cache; it inherits
`CachingKeyValueStore.query()`, so
point queries consult the record cache (read-your-writes) and honor
`skipCache`.
5. **`skipCache` is propagated.** The metered stores (`MeteredKeyValueStore`,
`MeteredTimestampedKeyValueStore`,
`MeteredTimestampedKeyValueStoreWithHeaders`) now forward
`isSkipCache()` onto the raw `KeyQuery` they build, so the flag actually
reaches the caching layer
(it was previously dropped).
The metered header store services `TimestampedKeyWithHeadersQuery` by
forwarding a raw byte-level
`KeyQuery` to the wrapped store and deserializing the stored
`ValueTimestampHeaders` into a `Record`
(a `ReadOnlyRecord`); an absent or tombstoned key yields a `null` result.
## Testing
- `ReadOnlyRecordTest` — `Record` is assignable to `ReadOnlyRecord` and
exposes the same
key/value/timestamp/headers; headers are non-null/empty by default; null
key/value tolerated.
- `MeteredKeyValueStoreTest` / `MeteredTimestampedKeyValueStoreTest` /
`MeteredTimestampedKeyValueStoreWithHeadersTest` — `skipCache` is
propagated to the forwarded
`KeyQuery` for `KeyQuery` / `TimestampedKeyQuery` /
`TimestampedKeyWithHeadersQuery`.
- `RocksDBTimestampedStoreWithHeadersTest` — the native store serves
`KeyQuery` and `RangeQuery`
(previously `UNKNOWN_QUERY_TYPE`); a genuinely unsupported query still
returns `UNKNOWN_QUERY_TYPE`.
- `TimestampedKeyValueStoreBuilderWithHeadersTest` — IQv2 query handling
parameterized over build path
(native / adapter / in-memory) × caching on/off, plus a native-vs-adapter
result-parity test.
- `TimestampedKeyWithHeadersQueryIntegrationTest` — end-to-end
value/timestamp/headers round-trip,
empty-headers, tombstone/absent, `UNKNOWN_QUERY_TYPE` against a
non-headers store, and a
caching-enabled cache-hit (read-your-writes) case.
--
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]