KAFKA-7652: Part II; Add single-point query for SessionStore and use for flushing / getter (#6161)
#2972 tried to fix a bug about flushing operation, but it was not complete, since findSessions(key, earliestEnd, latestStart) does not guarantee to only return a single entry since its semantics are to return any sessions whose end > earliestEnd and whose start < latestStart.
I've tried various ways to fix it completely and I ended up having to add a single-point query to the public ReadOnlySessionStore API for the exact needed semantics. It is used for flushing to read the old values (otherwise the wrong old values will be sent downstreams, hence it is a correctness issue) and also for getting the value for value-getters (it is for perf only).
@ -386,6 +386,11 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@@ -386,6 +386,11 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@ -564,6 +569,11 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@@ -564,6 +569,11 @@ public class ProcessorContextImpl extends AbstractProcessorContext implements Re
@ -78,12 +75,9 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@@ -78,12 +75,9 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@ -138,7 +132,7 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@@ -138,7 +132,7 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@ -151,6 +145,24 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@@ -151,6 +145,24 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@ -173,7 +185,9 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@@ -173,7 +185,9 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@ -188,15 +202,6 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@@ -188,15 +202,6 @@ class CachingSessionStore<K, AGG> extends WrappedStateStore.AbstractStateStore i
@ -42,7 +42,6 @@ public class CompositeReadOnlySessionStore<K, V> implements ReadOnlySessionStore
@@ -42,7 +42,6 @@ public class CompositeReadOnlySessionStore<K, V> implements ReadOnlySessionStore
@ -58,7 +57,8 @@ public class CompositeReadOnlySessionStore<K, V> implements ReadOnlySessionStore
@@ -58,7 +57,8 @@ public class CompositeReadOnlySessionStore<K, V> implements ReadOnlySessionStore
}catch(finalInvalidStateStoreExceptionise){
thrownewInvalidStateStoreException("State store ["+storeName+"] is not available anymore"+
" and may have been migrated to another instance; "+
"please re-discover its location from the state metadata.");
"please re-discover its location from the state metadata. "+
"Original error message: "+ise.toString());
}
}
returnKeyValueIterators.emptyIterator();
@ -68,12 +68,7 @@ public class CompositeReadOnlySessionStore<K, V> implements ReadOnlySessionStore
@@ -68,12 +68,7 @@ public class CompositeReadOnlySessionStore<K, V> implements ReadOnlySessionStore
@ -178,6 +178,21 @@ public class MeteredSessionStore<K, V> extends WrappedStateStore.AbstractStateSt
@@ -178,6 +178,21 @@ public class MeteredSessionStore<K, V> extends WrappedStateStore.AbstractStateSt
@ -80,6 +80,11 @@ public class RocksDBSessionStore<K, AGG> extends WrappedStateStore.AbstractState
@@ -80,6 +80,11 @@ public class RocksDBSessionStore<K, AGG> extends WrappedStateStore.AbstractState
@ -36,13 +36,13 @@ public class SessionKeySchema implements SegmentedBytesStore.KeySchema {
@@ -36,13 +36,13 @@ public class SessionKeySchema implements SegmentedBytesStore.KeySchema {
@ -136,19 +136,21 @@ public class SessionKeySchema implements SegmentedBytesStore.KeySchema {
@@ -136,19 +136,21 @@ public class SessionKeySchema implements SegmentedBytesStore.KeySchema {
@ -49,9 +49,7 @@ public class MergedSortedCacheWrappedSessionStoreIteratorTest {
@@ -49,9 +49,7 @@ public class MergedSortedCacheWrappedSessionStoreIteratorTest {
@ -37,7 +37,7 @@ public class ReadOnlySessionStoreStub<K, V> implements ReadOnlySessionStore<K, V
@@ -37,7 +37,7 @@ public class ReadOnlySessionStoreStub<K, V> implements ReadOnlySessionStore<K, V