[ 
https://issues.apache.org/jira/browse/KAFKA-4863?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xavier Léauté updated KAFKA-4863:
---------------------------------
    Description: 
Using variable length keys in a window store may cause unwanted results to be 
returned when querying certain ranges.

Below is a test case for {{RocksDBWindowStoreTest}} that shows the problem. It 
fails, returning {{\[0001, 0003, 0002, 0004, 0005\]}} instead of {{\[0001, 
0003, 0005\]}}.

{code:java}
@Test
public void testPutAndFetchSanity() throws IOException {
    final RocksDBWindowStoreSupplier<String, String> supplier =
            new RocksDBWindowStoreSupplier<>(
                    "window", 60 * 1000L * 2, 3,
                    true, Serdes.String(), Serdes.String(),
                    windowSize, true, Collections.<String, String>emptyMap(), 
false
            );
    final WindowStore<String, String> store = supplier.get();
    store.init(context, store);

    try {
        store.put("a", "0001", 0);
        store.put("aa", "0002", 0);
        store.put("a", "0003", 1);
        store.put("aa", "0004", 1);
        store.put("a", "0005", 60000);

        assertEquals(Utils.mkList("0001", "0003", "0005"), 
toList(store.fetch("a", 0, Long.MAX_VALUE)));
    } finally {
        store.close();
    }
}
{code}

  was:
Using variable length keys in a window store may cause unwanted results to be 
returned when querying certain ranges.

Below is a test case for {{RocksDBWindowStoreTest}} that shows the problem. It 
fails, returning {{\["0001", "0003", "0002"\]}} instead of {{\["0001", 
"0003"\]}}.

{code:java}
    @Test
    public void testPutAndFetchSanity() throws IOException {
        final RocksDBWindowStoreSupplier<String, String> supplier =
                new RocksDBWindowStoreSupplier<>(
                        "window", 60 * 1000L * 2, 3,
                        true, Serdes.String(), Serdes.String(),
                        windowSize, true, Collections.<String, 
String>emptyMap(), false
                );
        final WindowStore<String, String> store = supplier.get();
        store.init(context, store);

        try {
            store.put("a", "0001", 0);
            store.put("aa", "0002", 0);
            store.put("a", "0003", 1);

            assertEquals(Utils.mkList("0001", "0003"), toList(store.fetch("a", 
0, Long.MAX_VALUE)));
        } finally {
            store.close();
        }
    }
{code}


> Querying window store may return unwanted keys
> ----------------------------------------------
>
>                 Key: KAFKA-4863
>                 URL: https://issues.apache.org/jira/browse/KAFKA-4863
>             Project: Kafka
>          Issue Type: Bug
>          Components: streams
>            Reporter: Xavier Léauté
>            Priority: Critical
>
> Using variable length keys in a window store may cause unwanted results to be 
> returned when querying certain ranges.
> Below is a test case for {{RocksDBWindowStoreTest}} that shows the problem. 
> It fails, returning {{\[0001, 0003, 0002, 0004, 0005\]}} instead of {{\[0001, 
> 0003, 0005\]}}.
> {code:java}
> @Test
> public void testPutAndFetchSanity() throws IOException {
>     final RocksDBWindowStoreSupplier<String, String> supplier =
>             new RocksDBWindowStoreSupplier<>(
>                     "window", 60 * 1000L * 2, 3,
>                     true, Serdes.String(), Serdes.String(),
>                     windowSize, true, Collections.<String, String>emptyMap(), 
> false
>             );
>     final WindowStore<String, String> store = supplier.get();
>     store.init(context, store);
>     try {
>         store.put("a", "0001", 0);
>         store.put("aa", "0002", 0);
>         store.put("a", "0003", 1);
>         store.put("aa", "0004", 1);
>         store.put("a", "0005", 60000);
>         assertEquals(Utils.mkList("0001", "0003", "0005"), 
> toList(store.fetch("a", 0, Long.MAX_VALUE)));
>     } finally {
>         store.close();
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)

Reply via email to