Details
Description
`IgniteCache#iterator` invocation are not transactional.
But, currently, Ignite allow to invoke `iterator` inside transaction.
This lead to unexpected behavior and hides business logic errors.
We must disallow IgniteCache#iterator call inside transaction.
@Test public void testTx() { IgniteCache<Integer, Integer> c = client.createCache(new CacheConfiguration<Integer, Integer>().setName("xxx").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL)); c.put(1, 1); c.put(2, 1); c.put(3, 1); Set<Integer> keys = new HashSet<>(); for (Cache.Entry<Integer, Integer> e : c) assertTrue(keys.add(e.getKey())); assertEquals(3, keys.size()); try (Transaction tx = client.transactions().txStart(TransactionConcurrency.PESSIMISTIC, TransactionIsolation.READ_COMMITTED)) { c.remove(2); keys.clear(); for (Cache.Entry<Integer, Integer> e : c) assertTrue(keys.add(e.getKey())); assertFalse(keys.contains(2)); assertEquals(2, keys.size()); } }
Attachments
Issue Links
- is a clone of
-
IGNITE-23110 Disallow IgniteCache#clear inside transaction
- Patch Available