[
https://issues.apache.org/jira/browse/IGNITE-23681?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Julia Bakulina updated IGNITE-23681:
------------------------------------
Description:
`IgniteCache#removeAll` invocation are not transactional.
But, currently, Ignite allow to invoke `removeAll` inside transaction.
This lead to unexpected behavior and hides business logic errors.
We must disallow IgniteCache#removeAll call inside transaction.
{code:java}
/** */
@Test
public void testClearInTransction() {
IgniteCache<Object, Object> cache = client.createCache(new
CacheConfiguration<>("my-cache").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
cache.put(1, 1);
try (Transaction tx =
client.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.READ_COMMITTED)) {
cache.put(2, 2);
cache.removeAll();
tx.commit();
}
assertFalse(cache.containsKey(1));
assertTrue(cache.containsKey(2));
}
{code}
was:
`IgniteCache#clear` invocation are not transactional.
But, currently, Ignite allow to invoke `clear` inside transaction.
This lead to unexpected behavior and hides business logic errors.
We must disallow IgniteCache#clear call inside transaction.
{code:java}
/** */
@Test
public void testClearInTransction() {
IgniteCache<Object, Object> cache = client.createCache(new
CacheConfiguration<>("my-cache").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
cache.put(1, 1);
try (Transaction tx =
client.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
TransactionIsolation.READ_COMMITTED)) {
cache.put(2, 2);
cache.clear();
tx.commit();
}
assertFalse(cache.containsKey(1));
assertTrue(cache.containsKey(2));
}
{code}
> Disallow IgniteCache#removeAll inside transaction
> -------------------------------------------------
>
> Key: IGNITE-23681
> URL: https://issues.apache.org/jira/browse/IGNITE-23681
> Project: Ignite
> Issue Type: Improvement
> Reporter: Julia Bakulina
> Assignee: Julia Bakulina
> Priority: Major
> Labels: ise
> Fix For: 2.17
>
>
> `IgniteCache#removeAll` invocation are not transactional.
> But, currently, Ignite allow to invoke `removeAll` inside transaction.
> This lead to unexpected behavior and hides business logic errors.
> We must disallow IgniteCache#removeAll call inside transaction.
> {code:java}
> /** */
> @Test
> public void testClearInTransction() {
> IgniteCache<Object, Object> cache = client.createCache(new
> CacheConfiguration<>("my-cache").setAtomicityMode(CacheAtomicityMode.TRANSACTIONAL));
> cache.put(1, 1);
> try (Transaction tx =
> client.transactions().txStart(TransactionConcurrency.PESSIMISTIC,
> TransactionIsolation.READ_COMMITTED)) {
> cache.put(2, 2);
> cache.removeAll();
> tx.commit();
> }
> assertFalse(cache.containsKey(1));
> assertTrue(cache.containsKey(2));
> }
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)