Yakov.

I think exception equals `true` is intended behavior.

Filter evaluation implementation from master - [1]
Test from master to check filter exception(without explicit asserts checking listeners call) - [2]

Here is my quick test with asserts on listener call after filter exception:

```
package org.apache.ignite.internal.processors.cache.query.continuous;

//... imports

public class GridCacheContinuousQueryFilterExceptionTest extends GridCacheContinuousQueryAbstractSelfTest implements Serializable {
    /**
     * @throws Exception If failed.
     */
    public void testListenerAfterFilterException() throws Exception {
IgniteCache<Integer, Integer> cache = grid(0).cache(DEFAULT_CACHE_NAME);

        ContinuousQuery<Integer, Integer> qry = new ContinuousQuery<>();

        final CountDownLatch latch = new CountDownLatch(100);

qry.setLocalListener(new CacheEntryUpdatedListener<Integer, Integer>() { @Override public void onUpdated(Iterable<CacheEntryEvent<? extends Integer, ? extends Integer>> evts) { for (CacheEntryEvent<? extends Integer, ? extends Integer> evt : evts)
                    latch.countDown();
            }
        });

qry.setRemoteFilter(new CacheEntryEventSerializableFilter<Integer, Integer>() { @Override public boolean evaluate(CacheEntryEvent<? extends Integer, ? extends Integer> evt) {
                throw new RuntimeException("Test error.");
            }
        });

try (QueryCursor<Cache.Entry<Integer, Integer>> ignored = cache.query(qry)) {
            for (int i = 0; i < 100; i++)
                cache.put(i, i);

            assertTrue(latch.await(10, SECONDS));
        }
    }

    @Override protected CacheMode cacheMode() {
        return CacheMode.REPLICATED;
    }

    @Override protected int gridCount() {
        return 1;
    }
}
```

[1] https://github.com/apache/ignite/blob/master/modules/core/src/main/java/org/apache/ignite/internal/processors/cache/query/continuous/CacheContinuousQueryHandler.java#L791

[2] https://github.com/apache/ignite/blob/master/modules/core/src/test/java/org/apache/ignite/internal/processors/cache/query/continuous/GridCacheContinuousQueryAbstractSelfTest.java#L359


29.08.2017 14:46, Yakov Zhdanov пишет:
If filter throws exception entry would be passed to listener.

this is strange. Imagine a filter that very rarely throws some runtime
exception due to external or environmental reasons, but in case of normal
execution filter evaluates to false. In case of error entry is passed to a
local listener which can lead to some serious consequences and
inconsistencies in business logic. We probably need to send entry with a
notion that there was an error on server.

--Yakov

Reply via email to