Maksim Timonin created IGNITE-16158:
---------------------------------------
Summary: Cancel of local CacheQuery doesn't stop query
Key: IGNITE-16158
URL: https://issues.apache.org/jira/browse/IGNITE-16158
Project: Ignite
Issue Type: New Feature
Reporter: Maksim Timonin
```
IgniteCache<Long, Person> cache = crd.createCache("CACHE");
try (IgniteDataStreamer<Long, Person> streamer =
ignite.dataStreamer(cache.getName())) {
for (int i = 0; i < CNT; i++)
streamer.addData((long)i, new Person(i));
}
IndexQuery<Long, Person> qry = new IndexQuery<Long, Person>(Person.class, IDX)
.setCriteria(lt("id", CNT / 2));
QueryCursor cursor = cache.query(qry.setLocal(true));
cursor.close();
}
```
QueryCursor holds a future that is completed with iterator over result data.
Starting a query spawns a new thread that query cache in background, prepares
data, and it completes the future with iterator.
But cancelling of query with `QueryCursor.close` doesn't stops the background
thread, and it will prepare data that will never request. Also cancelling of
query doesn't clean up iterator.
This issue doesn't lead to any memory leaks, and the future and the iterator
will be cleaned up by GC later. But actually we can help to GC by avoiding
preparing the data and by explicit cleaning of those structures.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)