[ 
https://issues.apache.org/jira/browse/IGNITE-21313?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17813511#comment-17813511
 ] 

Mirza Aliev commented on IGNITE-21313:
--------------------------------------

LGTM

> Incorrect behaviour when invalid zone filter is applied to zone 
> ----------------------------------------------------------------
>
>                 Key: IGNITE-21313
>                 URL: https://issues.apache.org/jira/browse/IGNITE-21313
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Mirza Aliev
>            Assignee: Sergey Uttsel
>            Priority: Major
>              Labels: ignite-3
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> Let's consider this code to be run in a test:
>  
> {code:java}
> sql("CREATE ZONE ZONE1 WITH DATA_NODES_FILTER = 'INCORRECT_FILTER'");
> sql("CREATE TABLE TEST(ID INT PRIMARY KEY, VAL0 INT) WITH 
> PRIMARY_ZONE='ZONE1'"); {code}
>  Current behaviour is that test hangs with spamming 
>  
> {noformat}
> [2024-01-19T12:56:25,163][ERROR][%ictdt_n_0%metastorage-watch-executor-2][WatchProcessor]
>  Error occurred when notifying safe time advanced callback
>  java.util.concurrent.CompletionException: 
> com.jayway.jsonpath.PathNotFoundException: No results for path: 
> $['INCORRECT_FILTER']
>     at 
> java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:331)
>  ~[?:?]
>     at 
> java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:346)
>  ~[?:?]
>     at 
> java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:870)
>  ~[?:?]
>     at 
> java.util.concurrent.CompletableFuture.uniWhenCompleteStage(CompletableFuture.java:883)
>  [?:?]
>     at 
> java.util.concurrent.CompletableFuture.whenComplete(CompletableFuture.java:2257)
>  [?:?]
>     at 
> org.apache.ignite.internal.metastorage.server.WatchProcessor.notifyWatches(WatchProcessor.java:213)
>  ~[main/:?]
>     at 
> org.apache.ignite.internal.metastorage.server.WatchProcessor.lambda$notifyWatches$3(WatchProcessor.java:169)
>  ~[main/:?]
>     at 
> java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1072)
>  [?:?]
>     at 
> java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:478)
>  [?:?]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
>  [?:?]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
>  [?:?]
>     at java.lang.Thread.run(Thread.java:829) [?:?]
> Caused by: com.jayway.jsonpath.PathNotFoundException: No results for path: 
> $['INCORRECT_FILTER']{noformat}
>  
> We need to fix that and formulate a reaction to an incorrect filter
>  
> *Implementation notes:*
> To fix it we need to change implementation of DistributionZonesUtil#filter.
> Instead of 
> {code:java}
> List<Map<String, Object>> res = JsonPath.read(convertedAttributes, 
> filter);{code}
> need to use
> {code:java}
> Configuration configuration = new Configuration.ConfigurationBuilder()
>         .options(Option.SUPPRESS_EXCEPTIONS, Option.ALWAYS_RETURN_LIST)
>         .build();
> List<Map<String, Object>> res = 
> JsonPath.using(configuration).parse(convertedAttributes).read(filter);{code}
> In this case incorrect filter will not throw PathNotFoundException and 
> returns empty 'res'.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to