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

IgniteCache.remove() returns false for LOCAL OFFHEAP_TIERED cache inside OPTIMISTIC REPEATABLE_READ transaction.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 1.5.0.final
    • 1.6
    • None
    • None

    Description

      IgniteCache.remove() returns false for LOCAL OFFHEAP_TIERED cache inside OPTIMISTIC REPEATABLE_READ transaction. But cache.get() before and after remove retuns right values.

          public static void main(String[] args) {
              try(Ignite ignite = Ignition.start(new IgniteConfiguration())) {
                  CacheConfiguration cfg = new CacheConfiguration()
                      .setName("myCache")
                      .setCacheMode(LOCAL)
                      .setAtomicityMode(TRANSACTIONAL)
                      .setMemoryMode(OFFHEAP_TIERED)
                      ;
      
                  IgniteCache cache = ignite.getOrCreateCache(cfg);
      
                  final String key = "key1";
      
                  TransactionConcurrency concurrency = OPTIMISTIC;
                  TransactionIsolation isolation = REPEATABLE_READ;
      
                  try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
                      cache.put(key, 1); 
      
                      tx.commit();
                  }
      
                  try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
                      Object val = cache.get(key); // Returns 1.
      
                      System.out.println("Value: " + val);
      
                      tx.commit();
                  }
      
                  try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
      
                      boolean remove = cache.remove(key);
      
                      System.out.println("Removed: " + remove);
      
                      tx.commit();
                  }
      
                  try (Transaction tx = ignite.transactions().txStart(concurrency, isolation)) {
                      Object val = cache.get(key); // Returns null.
      
                      System.out.println("Value: " + val);
      
                      tx.commit();
                  }
              }
          }
      

      It's corner case. For any other MEMORY_MODE it works.
      For any other concurrency or isolation levels it works.
      It also works if execute cache.get() before remove inside transaction.
      Test failss for both dynamic and static caches.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ashutak Artem Shutak
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: