You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "alanlau28 (via GitHub)" <gi...@apache.org> on 2026/08/02 19:41:34 UTC
[PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
alanlau28 opened a new pull request, #23037:
URL: https://github.com/apache/kafka/pull/23037
`PlainToHeadersWindowStoreAdapter` and `TimestampedToHeadersWindowStoreAdapter` hold the
store they wrap in a field rather than participating in the `WrappedStateStore` chain, so
`ProcessorStateManager.StateStoreMetadata.extractRetentionPeriod` — which finds a store's
retention by unwrapping to the innermost layer — terminates on the adapter and resolves -1.
A -1 fails the windowed restore gate `retentionPeriod > 0 && retentionPeriod != Long.MAX_VALUE`,
so the restore seeks the beginning of the changelog rather than skipping data the store would
discard anyway. On a changelog with delete retention that means starting at the offset
retention is deleting from, with no margin against being lapped.
Each adapter now implements `WithRetentionPeriod` and unwraps its own delegate.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "bbejeck (via GitHub)" <gi...@apache.org>.
bbejeck commented on code in PR #23037:
URL: https://github.com/apache/kafka/pull/23037#discussion_r3753549982
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/PlainToHeadersWindowStoreAdapter.java:
##########
@@ -68,6 +68,23 @@ public PlainToHeadersWindowStoreAdapter(final WindowStore<Bytes, byte[]> store)
this.store = store;
}
+ /**
+ * Report the retention of the store being adapted. This adapter holds its delegate in a private
+ * field rather than as a {@link WrappedStateStore}, so {@code extractRetentionPeriod}'s unwrap
+ * walk terminates here; without this it resolves -1 and the KAFKA-13499 windowed-restore
+ * optimisation is silently skipped for every store behind the adapter.
+ */
+ @Override
+ public long retentionPeriod() {
+ StateStore current = store;
Review Comment:
We repeat this code in 5 locations. All 4 new adapters, plus `ProcessorStateManager` line 147 - I'm wondering if we should add a static method on the `WithRetentionPeriod` interface that accepts a `StateStore` parameter and executes the unwrapping and returns the retention in one spot.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "bbejeck (via GitHub)" <gi...@apache.org>.
bbejeck commented on PR #23037:
URL: https://github.com/apache/kafka/pull/23037#issuecomment-5256451982
cherry-picked to 4.4
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "alanlau28 (via GitHub)" <gi...@apache.org>.
alanlau28 commented on PR #23037:
URL: https://github.com/apache/kafka/pull/23037#issuecomment-5241505454
Thanks for the review @bbejeck! Changes addressed in https://github.com/apache/kafka/pull/23037/commits/b1104f347ebef6d990e62288db127b19937c2f83.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "bbejeck (via GitHub)" <gi...@apache.org>.
bbejeck commented on PR #23037:
URL: https://github.com/apache/kafka/pull/23037#issuecomment-5246309408
\cc @aliehsaeedii
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "alanlau28 (via GitHub)" <gi...@apache.org>.
alanlau28 commented on code in PR #23037:
URL: https://github.com/apache/kafka/pull/23037#discussion_r3758298165
##########
streams/src/main/java/org/apache/kafka/streams/state/internals/PlainToHeadersWindowStoreAdapter.java:
##########
@@ -68,6 +68,23 @@ public PlainToHeadersWindowStoreAdapter(final WindowStore<Bytes, byte[]> store)
this.store = store;
}
+ /**
+ * Report the retention of the store being adapted. This adapter holds its delegate in a private
+ * field rather than as a {@link WrappedStateStore}, so {@code extractRetentionPeriod}'s unwrap
+ * walk terminates here; without this it resolves -1 and the KAFKA-13499 windowed-restore
+ * optimisation is silently skipped for every store behind the adapter.
+ */
+ @Override
+ public long retentionPeriod() {
+ StateStore current = store;
Review Comment:
Thanks @bbejeck, this makes sense. I created a static method for the interface.
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "bbejeck (via GitHub)" <gi...@apache.org>.
bbejeck commented on PR #23037:
URL: https://github.com/apache/kafka/pull/23037#issuecomment-5256333473
Merged #23037 into trunk
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] KAFKA-20875: Headers window store adapters must expose the retention they wrap [kafka]
Posted by "bbejeck (via GitHub)" <gi...@apache.org>.
bbejeck merged PR #23037:
URL: https://github.com/apache/kafka/pull/23037
--
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: jira-unsubscribe@kafka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org