Jess668 opened a new pull request, #22770:
URL: https://github.com/apache/kafka/pull/22770

   Implements **`TimestampedRangeWithHeadersQuery`**, the second IQv2 query 
type of KIP-1356, whose result is an iterator of records that each carry key, 
value, timestamp, **and headers**. The result type is the new 
**`ReadOnlyRecordIterator<K, V>`** — a `Closeable` iterator that yields 
`ReadOnlyRecord<K, V>` elements directly.
   
   ## Dependencies
   
   This work is stacked on, and should be reviewed/merged after:
   1. `ReadOnlyRecord` — already in `trunk`.
   2. `ReadOnlyRecordIterator` 
[PR#22729](https://github.com/apache/kafka/pull/22729).
   3. `TimestampedKeyWithHeadersQuery` 
[PR#22666](https://github.com/apache/kafka/pull/22666).
   
   Once those land, this branch will be rebased onto `trunk` so it contains 
only the range commits.
   
   ## Summary
   
   1. **`TimestampedRangeWithHeadersQuery<K, V> implements 
Query<ReadOnlyRecordIterator<K, V>>`**
     (`@Evolving`). Mirrors `TimestampedRangeQuery`: static factories 
`withRange`, `withUpperBound`,
     `withLowerBound`, `withNoBounds`; order builders `withDescendingKeys` / 
`withAscendingKeys`;
     accessors `lowerBound()`, `upperBound()`, `resultOrder()`. Same 
bound/order semantics as
     `TimestampedRangeQuery`.
   2. `MeteredTimestampedKeyValueStoreWithHeaders` registers a 
`TimestampedRangeWithHeadersQuery`
     handler and returns a `ReadOnlyRecordIterator` whose elements are built as 
immutable
     `ReadOnlyRecord`s (headers frozen via `setReadOnly()`). The bounds+order → 
raw `RangeQuery`
     construction shared by the three range handlers is factored into a 
`rawRangeQuery(...)` helper.
   3. **Native store enablement**: `RocksDBTimestampedStoreWithHeaders` drops 
its
     scope-to-`KeyQuery`-only `query()` override, falling back to the inherited 
`RocksDBStore` handling,
     which serves `RangeQuery`. Previously the native header store returned 
`UNKNOWN_QUERY_TYPE` for
     range queries.
   
   ## Testing
   - **Unit** — `MeteredTimestampedKeyValueStoreWithHeadersTest`: bounds and 
descending order are
     propagated to the underlying raw `RangeQuery`.
   - **Builder / end-to-end** — 
`TimestampedKeyValueStoreBuilderWithHeadersTest`: `RangeQuery` on the
     native store; `TimestampedRangeWithHeadersQuery` returns exact headers on 
a header-persisting
     store, empty headers on the adapter store, throws on a plain/legacy store, 
throws on a negative
     stored timestamp; execution-info collect/no-collect; identical range 
results across native- and
     adapter-built stores.
   - **Native store** — `RocksDBTimestampedStoreWithHeadersTest`: `RangeQuery` 
is now handled (was
     `UNKNOWN_QUERY_TYPE`).
   - **Integration** — `IQv2HeadersStoreIntegrationTest`: 
`TimestampedRangeWithHeadersQuery` over a
     running topology returns each record's correct key/value/timestamp/headers 
across order and bound
     variants; `UNKNOWN_QUERY_TYPE` against a non-headers store; failure 
against a plain supplier.
   
   Reviewers: Alieh Saeedi <[email protected]>
   


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