You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "mjsax (via GitHub)" <gi...@apache.org> on 2026/04/01 00:07:00 UTC

Re: [PR] KAFKA-20194: Ensure backward compatibility [kafka]

mjsax commented on code in PR #21904:
URL: https://github.com/apache/kafka/pull/21904#discussion_r3019062976


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/KeyValueStoreWrapper.java:
##########
@@ -57,6 +57,15 @@ public class KeyValueStoreWrapper<K, V> implements StateStore {
     private StateStore store;
 
     public KeyValueStoreWrapper(final ProcessorContext<?, ?> context, final String storeName) {
+        // Try timestamped store
+        try {
+            headersStore = new KeyValueTimestampedHeaderStoreToKeyValueTimestampStoreAdapter<>(context.getStateStore(storeName));
+            store = headersStore;
+            return;
+        } catch (final ClassCastException e) {
+            // not headers store, try versioned

Review Comment:
   I don't think so. In the end, it's "expected" that we might get a `ClassCastException`.
   
   If we don't like the code this way, we could rewrite it using `instanceof` instead. Let me know.



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