You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2021/12/01 09:46:27 UTC

[GitHub] [kafka] vpapavas commented on a change in pull request #11541: chore: keeping track of latest seen position in different state stores

vpapavas commented on a change in pull request #11541:
URL: https://github.com/apache/kafka/pull/11541#discussion_r760015271



##########
File path: streams/src/test/java/org/apache/kafka/streams/state/internals/InMemorySessionStoreTest.java
##########
@@ -83,4 +88,31 @@ public void shouldNotExpireFromOpenIterator() {
         assertFalse(sessionStore.findSessions("a", "b", 0L, 20L).hasNext());
     }
 
+    @Test
+    public void shouldMatchPositionAfterPut() {
+
+        final List<KeyValue<Windowed<String>, Long>> entries = new ArrayList<>();
+        entries.add(new KeyValue<>(new Windowed<String>("a", new SessionWindow(0, 0)), 1L));
+        entries.add(new KeyValue<>(new Windowed<String>("aa", new SessionWindow(0, 10)), 2L));
+        entries.add(new KeyValue<>(new Windowed<String>("a", new SessionWindow(10, 20)), 3L));
+
+        final MonotonicProcessorRecordContext recordContext = new MonotonicProcessorRecordContext("input", 0);
+        context.setRecordContext(recordContext);
+
+        final Position expected = Position.emptyPosition();
+        long offset = 0;
+        for (final KeyValue<Windowed<String>, Long> k : entries) {
+            sessionStore.put(k.key, k.value);
+            expected.update("input", 0, offset);
+            offset++;
+        }
+
+        final MeteredSessionStore<String, Long> meteredSessionStore = (MeteredSessionStore<String, Long>) sessionStore;

Review comment:
       I agree,  I don't think it is bad in the context of a unit test




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