ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Artem Shutak (JIRA)" <j...@apache.org>
Subject [jira] [Created] (IGNITE-2590) IgniteCache.remove() returns false for LOCAL OFFHEAP_TIERED cache inside OPTIMISTIC REPEATABLE_READ transaction.
Date Mon, 08 Feb 2016 18:23:39 GMT
Artem Shutak created IGNITE-2590:
------------------------------------

             Summary: IgniteCache.remove() returns false for LOCAL OFFHEAP_TIERED cache inside
OPTIMISTIC REPEATABLE_READ transaction.
                 Key: IGNITE-2590
                 URL: https://issues.apache.org/jira/browse/IGNITE-2590
             Project: Ignite
          Issue Type: Bug
    Affects Versions: 1.5.0.final
            Reporter: Artem Shutak


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

{code}
    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();
            }
        }
    }
{code}

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.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message