aliehsaeedii commented on code in PR #24253:
URL: https://github.com/apache/kafka/pull/24253#discussion_r4600361195
##########
streams/src/test/java/org/apache/kafka/streams/state/internals/TimestampedKeyValueStoreBuilderTest.java:
##########
@@ -185,4 +193,29 @@ public void shouldThrowNullPointerIfMetricsScopeIsNull() {
assertEquals("storeSupplier's metricsScope can't be null",
e.getMessage());
}
-}
\ No newline at end of file
+ @Test
+ public void inMemoryMarkerShouldPropagateReadOnlyToWrappedStore() {
+ setUpWithoutInner();
+ when(supplier.get()).thenReturn(new InMemoryKeyValueStore("name"));
+ final TimestampedKeyValueStore<String, String> store =
+ builder.withLoggingDisabled().withCachingDisabled().build();
+ final InternalMockProcessorContext<String, String> context = new
InternalMockProcessorContext<>(
+ TestUtils.tempDirectory(), Serdes.String(), Serdes.String(),
+ new StreamsConfig(StreamsTestUtils.getStreamsConfig()));
+ store.init(context, store);
+ try {
+ store.put("k", ValueAndTimestamp.make("v", 10L));
+
+ final ReadOnlyKeyValueStore<String, ValueAndTimestamp<String>>
committedView =
+ store.readOnly(IsolationLevel.READ_COMMITTED);
+ final ReadOnlyKeyValueStore<String, ValueAndTimestamp<String>>
uncommittedView =
+ store.readOnly(IsolationLevel.READ_UNCOMMITTED);
+
+ assertNotSame(store, committedView);
Review Comment:
Thanks for the update, the marker fix looks right. This test still passes
with the marker override removed, though (I tried it locally): `assertNotSame`
always holds because `MeteredKeyValueStore` returns a new view either way, and
with a non-transactional store READ_UNCOMMITTED sees the value with or without
the fix. Can you set EOS and `enable.transactional.statestores=true` like the
window tests do, and assert READ_COMMITTED returns `null` before `commit`? It'd
also be good to cover at least one window or session marker, since this only
tests 1 of the 5.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]