Uploaded image for project: 'Ignite'
  1. Ignite
  2. IGNITE-23110

Disallow IgniteCache#clear inside transaction

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Patch Available
    • Major
    • Resolution: Unresolved
    • None
    • 2.17
    • None

    Description

      `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.

      /** */
      @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));
      }
      

      Attachments

        Issue Links

          Activity

            People

              julia_bakulina Julia Bakulina
              nizhikov Nikolay Izhikov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated: