Skip to content

let metered store's readonly override with header aware store#22806

Draft
lucliu1108 wants to merge 2 commits into
apache:trunkfrom
lucliu1108:restore-header-deserialization-guard
Draft

let metered store's readonly override with header aware store#22806
lucliu1108 wants to merge 2 commits into
apache:trunkfrom
lucliu1108:restore-header-deserialization-guard

Conversation

@lucliu1108

Copy link
Copy Markdown
Contributor

Summary

MeteredTimestampedWindowStoreWithHeaders and MeteredSessionStoreWithHeaders never override readOnly(IsolationLevel). Since Kafka Streams' Interactive Query (IQ) path always calls .readOnly(level) on a store before querying it (CompositeReadOnlyWindowStore.readOnlyStores()), both classes silently fell back to their superclass's generic, headers-ignorant ReadOnlyView/ReadOnlyView implementation — which deserializes the key before the value, instead of value-first-then-key (the order this feature actually requires, since the key's schema-ID header is only recoverable from the value's embedded headers). This threw "SerializationException: Error deserializing schema ID / IllegalArgumentException: Unknown magic byte!" whenever a headers-aware windowed/session store was queried via IQ after a restart+restore.

Files changed

  1. MeteredTimestampedWindowStoreWithHeaders.java
  • Added readOnly(IsolationLevel) override + new HeadersReadOnlyView inner class — the actual fix.
  1. MeteredSessionStoreWithHeaders.java
  • Same fix: readOnly(IsolationLevel) override + HeadersReadOnlyView inner class.
  1. MeteredTimestampedWindowStoreWithHeadersTest.java
  • Added shouldUseHeadersFromValueToDeserializeKeyInReadOnlyFetchAll
  1. MeteredSessionStoreWithHeadersTest.java
  • AddedshouldUseHeadersFromValueToDeserializeKeyInReadOnlyFindSessions test

@github-actions github-actions Bot added triage PRs from the community streams labels Jul 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

streams triage PRs from the community

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant