You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have a scenario where we are deleting entries from a "transactional" cache in one thread in a transaction and in parallel another thread is trying to query on the same cache. We observe changing/random numbers in second call when queried on the cache. Is this not a correct expectation that until the first transaction complete(delete), second query should return either count before delete transaction or count after delete transaction?
Example -
1: Cache has 1000 entries
2: A new thread tries to delete all entries using removeAll(keys) method.
3: Another thread in parallel when they to do cache.size() it gets range of numbers between 1000-0. Should it not be always 1000 or 0 considering point 2 is happening in a transaction?
Is this not a correct expectation that until the first transaction complete(delete), second query should return either count before delete transaction or count after delete transaction?
Well, your expectation is "incorrect". The IgniteCache.size() does not participate in any transactions, in other words, this method is not transactional. Moreover, it is implemented using an internal compute task, where each job calculates the cache size on a node independently.
/**
* Gets the number of all entries cached across all nodes.
...
* NOTE: this operation is distributed and will query all participating nodes for their cache sizes.
...
*/
public int size(CachePeekMode... peekModes) throws CacheException;
Hello,
We have a scenario where we are deleting entries from a "transactional" cache in one thread in a transaction and in parallel another thread is trying to query on the same cache. We observe changing/random numbers in second call when queried on the cache. Is this not a correct expectation that until the first transaction complete(delete), second query should return either count before delete transaction or count after delete transaction?
Example -
1: Cache has 1000 entries
2: A new thread tries to delete all entries using removeAll(keys) method.
3: Another thread in parallel when they to do cache.size() it gets range of numbers between 1000-0. Should it not be always 1000 or 0 considering point 2 is happening in a transaction?
Please refer attached sample project.
transactions-test.zip
Please suggest.
Thank you,
The text was updated successfully, but these errors were encountered: