You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Ziyun Fu (Jira)" <ji...@apache.org> on 2026/09/02 20:12:00 UTC

[jira] [Created] (KAFKA-21024) WindowToTimestampedWindowByteStoreAdapter.query() does not convert results to timestamped format

Ziyun Fu created KAFKA-21024:
--------------------------------

             Summary: WindowToTimestampedWindowByteStoreAdapter.query() does not convert results to timestamped format            
                 Key: KAFKA-21024
                 URL: https://issues.apache.org/jira/browse/KAFKA-21024
             Project: Kafka
          Issue Type: Improvement
            Reporter: Ziyun Fu


{panel}
h3. Context & Problem Statement
*KAFKA-16158* updated {{KeyValueToTimestampedKeyValueByteStoreAdapter}} to implement {{{}TimestampedBytesStore{}}}, ensuring all read paths ({{{}get{}}}, {{{}range{}}}, {{{}all{}}}, {{{}query{}}}) convert the wrapped store's bytes via {{{}TimestampedBytesStore#convertToTimestampedFormat{}}}.

{{WindowToTimestampedWindowByteStoreAdapter}} serves a similar wrapper role but handles its two read paths inconsistently:
 * 
*{{fetch()}} (and iterator overloads):* Properly converts the wrapped plain store's bytes to timestamped format (via {{WindowToTimestampedWindowByteStoreAdapter#fetch(Bytes, long)}} and {{{}WindowToTimestampedWindowIteratorAdapter{}}}).
 * 
*{{query()}} (IQv2 path):* Delegates directly to the wrapped store without conversion, returning raw/plain-format bytes for {{WindowKeyQuery}} and {{{}WindowRangeQuery{}}}.

Due to this inconsistency, {{WindowToTimestampedWindowByteStoreAdapter}} was intentionally *not* marked as {{{}TimestampedBytesStore{}}}. Doing so would cause marker-based callers (e.g., {{{}StateManagerUtil#converterForStore{}}}, {{{}WrappedStateStore#isTimestamped{}}}) to wrongly assume {{query()}} returned timestamped bytes, breaking IQ read paths for window stores.

h3. Implementation Tasks
 # 
*Update {{WindowToTimestampedWindowByteStoreAdapter#query()}}*

 ** 
Convert query results to timestamped format for {{{}WindowKeyQuery{}}}, {{{}WindowRangeQuery{}}}, and any other applicable IQv2 query types.
 ** 
Align behavior with {{KeyValueToTimestampedKeyValueByteStoreAdapter#query()}} (which handles {{{}KeyQuery{}}}, {{{}TimestampedKeyQuery{}}}, and {{{}RangeQuery{}}}).
 # 
*Implement {{TimestampedBytesStore}}*

 ** 
Once {{query()}} matches {{fetch()}} in returning timestamped bytes, update {{WindowToTimestampedWindowByteStoreAdapter}} to implement {{{}TimestampedBytesStore{}}}.
 # 
*Clean up {{StateManagerUtil#converterForStore}}*

 ** 
Update or remove the stale comment explaining why the window adapter was excluded from the marker interface.
 ** 
Revisit whether {{WindowToTimestampedWindowByteStoreAdapter}} needs explicit listing in the adapter-enumeration branch.
 ** 
_Note:_ {{KeyValueToTimestampedKeyValueByteStoreAdapter}} must remain explicitly enumerated for restore operations because restore bypasses the adapter and requires matching the inner store's raw byte format.{panel}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)