[ 
https://issues.apache.org/jira/browse/IGNITE-23121?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Nikolay Izhikov reassigned IGNITE-23121:
----------------------------------------

    Assignee:     (was: Julia Bakulina)

> CLONE - Disallow IgniteCache#iterator inside transaction
> --------------------------------------------------------
>
>                 Key: IGNITE-23121
>                 URL: https://issues.apache.org/jira/browse/IGNITE-23121
>             Project: Ignite
>          Issue Type: Improvement
>            Reporter: Nikolay Izhikov
>            Priority: Major
>              Labels: ise
>             Fix For: 2.17
>
>
> `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.
> {code:java}
> @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());
>     }
> }
> {code}



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

Reply via email to