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

Disallow IgniteCache#iterator inside transaction

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Open
    • Major
    • Resolution: Unresolved
    • None
    • 2.17
    • None
    • Docs Required, Release Notes Required

    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

          Activity

            People

              Unassigned Unassigned
              nizhikov Nikolay Izhikov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: