ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Yakov Zhdanov (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (IGNITE-76) CME in tx map with optimistic txs
Date Thu, 25 Dec 2014 10:12:13 GMT

     [ https://issues.apache.org/jira/browse/IGNITE-76?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Yakov Zhdanov updated IGNITE-76:
--------------------------------
    Description: 
{code}
public class GridGainBulkUpdateBenchmark extends GridGainCacheAbstractBenchmark<String,
BigDecimal> {
    /** */
    public static final int SHIFT = 1_000_000;

    /** {@inheritDoc} */
    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
        super.setUp(cfg);

        println(cfg, "Populating data...");

        long start = System.nanoTime();

        try (GridDataLoader<String, BigDecimal> dataLdr = grid().dataLoader(cache.name()))
{
            for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted();
i++) {
                dataLdr.addData(String.valueOf(SHIFT + i), BigDecimal.valueOf(i));

                if (i % 100000 == 0)
                    println(cfg, "Populated cache: " + i);
            }
        }

        println(cfg, "Finished populating data in " + ((System.nanoTime() - start) / 1_000_000)
+ " ms.");
    }

    /** {@inheritDoc} */
    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
        Map<String, BigDecimal> changesMap = generateBatch();

        try (GridCacheTx tx = cache().txStart()) {
            final Map<String, BigDecimal> oldVals = cache().getAll(changesMap.keySet());

            final Map<String, BigDecimal> newVals = new HashMap<>(oldVals.size());

            for (Map.Entry<String, BigDecimal> ent : oldVals.entrySet())
                newVals.put(ent.getKey(), ent.getValue().add(changesMap.get(ent.getKey())));

            cache().putAll(newVals);

            tx.commit();
        }

        return true;
    }

    /**
     * @return Batch.
     */
    private Map<String, BigDecimal> generateBatch() {
        SortedMap<String, BigDecimal> batch = new TreeMap<>();

        while (batch.size() < args.batchSize()) {
            String key = String.valueOf(nextRandom(SHIFT, SHIFT + args.range()));

            batch.put(key, BigDecimal.valueOf(nextRandom(1000)));
        }

        return batch;
    }

    /** {@inheritDoc} */
    @Override protected GridCache<String, BigDecimal> cache() {
        return grid().cache("tx");
    }
}
{code}

{noformat}
Dec 25, 2014 1:40:35 PM org.gridgain.grid.logger.java.GridJavaLogger error
SEVERE: <tx> Failed processing message [senderId=432325aa-0f4c-4dad-bfeb-077c2fe0ab7e]
java.util.ConcurrentModificationException
	at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)
	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:744)
	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:742)
	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.advance(GridCacheTxMap.java:133)
	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.next(GridCacheTxMap.java:120)
	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.next(GridCacheTxMap.java:100)
	at java.util.AbstractMap$2$1.next(AbstractMap.java:396)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.checkLocks(GridDhtTxPrepareFuture.java:224)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.mapIfLocked(GridDhtTxPrepareFuture.java:369)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.prepare(GridDhtTxPrepareFuture.java:569)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxLocal.prepareAsync(GridDhtTxLocal.java:425)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.prepareTx(GridDhtTransactionalCacheAdapter.java:244)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.processNearTxPrepareRequest(GridDhtTransactionalCacheAdapter.java:991)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.access$100(GridDhtTransactionalCacheAdapter.java:53)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4.apply(GridDhtTransactionalCacheAdapter.java:109)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4.apply(GridDhtTransactionalCacheAdapter.java:107)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:304)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:230)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.access$200(GridCacheIoManager.java:49)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:142)
	at org.gridgain.grid.kernal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:662)
	at org.gridgain.grid.kernal.managers.communication.GridIoManager.access$1900(GridIoManager.java:62)
	at org.gridgain.grid.kernal.managers.communication.GridIoManager$6.body(GridIoManager.java:623)
	at org.gridgain.grid.util.worker.GridWorker.run(GridWorker.java:151)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:744)
{noformat}

  was:
{code}
public class GridGainBulkUpdateBenchmark extends GridGainCacheAbstractBenchmark<String,
BigDecimal> {
    /** */
    public static final int SHIFT = 1_000_000;

    /** {@inheritDoc} */
    @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
        super.setUp(cfg);

        println(cfg, "Populating data...");

        long start = System.nanoTime();

        try (GridDataLoader<String, BigDecimal> dataLdr = grid().dataLoader(cache.name()))
{
            for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted();
i++) {
                dataLdr.addData(String.valueOf(SHIFT + i), BigDecimal.valueOf(i));

                if (i % 100000 == 0)
                    println(cfg, "Populated cache: " + i);
            }
        }

        println(cfg, "Finished populating data in " + ((System.nanoTime() - start) / 1_000_000)
+ " ms.");
    }

    /** {@inheritDoc} */
    @Override public boolean test(Map<Object, Object> ctx) throws Exception {
        Map<String, BigDecimal> changesMap = generateBatch();

        try (GridCacheTx tx = cache().txStart(PESSIMISTIC, REPEATABLE_READ)) {
            final Map<String, BigDecimal> oldVals = cache().getAll(changesMap.keySet());

            final Map<String, BigDecimal> newVals = new HashMap<>(oldVals.size());

            for (Map.Entry<String, BigDecimal> ent : oldVals.entrySet())
                newVals.put(ent.getKey(), ent.getValue().add(changesMap.get(ent.getKey())));

            cache().putAll(newVals);

            tx.commit();
        }

        return true;
    }

    /**
     * @return Batch.
     */
    private Map<String, BigDecimal> generateBatch() {
        SortedMap<String, BigDecimal> batch = new TreeMap<>();

        while (batch.size() < args.batchSize()) {
            String key = String.valueOf(nextRandom(SHIFT, SHIFT + args.range()));

            batch.put(key, BigDecimal.valueOf(nextRandom(1000)));
        }

        return batch;
    }

    /** {@inheritDoc} */
    @Override protected GridCache<String, BigDecimal> cache() {
        return grid().cache("tx");
    }
}
{code}

{noformat}
Dec 25, 2014 1:40:35 PM org.gridgain.grid.logger.java.GridJavaLogger error
SEVERE: <tx> Failed processing message [senderId=432325aa-0f4c-4dad-bfeb-077c2fe0ab7e]
java.util.ConcurrentModificationException
	at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)
	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:744)
	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:742)
	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.advance(GridCacheTxMap.java:133)
	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.next(GridCacheTxMap.java:120)
	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.next(GridCacheTxMap.java:100)
	at java.util.AbstractMap$2$1.next(AbstractMap.java:396)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.checkLocks(GridDhtTxPrepareFuture.java:224)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.mapIfLocked(GridDhtTxPrepareFuture.java:369)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.prepare(GridDhtTxPrepareFuture.java:569)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxLocal.prepareAsync(GridDhtTxLocal.java:425)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.prepareTx(GridDhtTransactionalCacheAdapter.java:244)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.processNearTxPrepareRequest(GridDhtTransactionalCacheAdapter.java:991)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.access$100(GridDhtTransactionalCacheAdapter.java:53)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4.apply(GridDhtTransactionalCacheAdapter.java:109)
	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4.apply(GridDhtTransactionalCacheAdapter.java:107)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:304)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:230)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.access$200(GridCacheIoManager.java:49)
	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:142)
	at org.gridgain.grid.kernal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:662)
	at org.gridgain.grid.kernal.managers.communication.GridIoManager.access$1900(GridIoManager.java:62)
	at org.gridgain.grid.kernal.managers.communication.GridIoManager$6.body(GridIoManager.java:623)
	at org.gridgain.grid.util.worker.GridWorker.run(GridWorker.java:151)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:744)
{noformat}


> CME in tx map with optimistic txs
> ---------------------------------
>
>                 Key: IGNITE-76
>                 URL: https://issues.apache.org/jira/browse/IGNITE-76
>             Project: Ignite
>          Issue Type: Bug
>            Reporter: Yakov Zhdanov
>            Priority: Blocker
>
> {code}
> public class GridGainBulkUpdateBenchmark extends GridGainCacheAbstractBenchmark<String,
BigDecimal> {
>     /** */
>     public static final int SHIFT = 1_000_000;
>     /** {@inheritDoc} */
>     @Override public void setUp(BenchmarkConfiguration cfg) throws Exception {
>         super.setUp(cfg);
>         println(cfg, "Populating data...");
>         long start = System.nanoTime();
>         try (GridDataLoader<String, BigDecimal> dataLdr = grid().dataLoader(cache.name()))
{
>             for (int i = 0; i < args.range() && !Thread.currentThread().isInterrupted();
i++) {
>                 dataLdr.addData(String.valueOf(SHIFT + i), BigDecimal.valueOf(i));
>                 if (i % 100000 == 0)
>                     println(cfg, "Populated cache: " + i);
>             }
>         }
>         println(cfg, "Finished populating data in " + ((System.nanoTime() - start) /
1_000_000) + " ms.");
>     }
>     /** {@inheritDoc} */
>     @Override public boolean test(Map<Object, Object> ctx) throws Exception {
>         Map<String, BigDecimal> changesMap = generateBatch();
>         try (GridCacheTx tx = cache().txStart()) {
>             final Map<String, BigDecimal> oldVals = cache().getAll(changesMap.keySet());
>             final Map<String, BigDecimal> newVals = new HashMap<>(oldVals.size());
>             for (Map.Entry<String, BigDecimal> ent : oldVals.entrySet())
>                 newVals.put(ent.getKey(), ent.getValue().add(changesMap.get(ent.getKey())));
>             cache().putAll(newVals);
>             tx.commit();
>         }
>         return true;
>     }
>     /**
>      * @return Batch.
>      */
>     private Map<String, BigDecimal> generateBatch() {
>         SortedMap<String, BigDecimal> batch = new TreeMap<>();
>         while (batch.size() < args.batchSize()) {
>             String key = String.valueOf(nextRandom(SHIFT, SHIFT + args.range()));
>             batch.put(key, BigDecimal.valueOf(nextRandom(1000)));
>         }
>         return batch;
>     }
>     /** {@inheritDoc} */
>     @Override protected GridCache<String, BigDecimal> cache() {
>         return grid().cache("tx");
>     }
> }
> {code}
> {noformat}
> Dec 25, 2014 1:40:35 PM org.gridgain.grid.logger.java.GridJavaLogger error
> SEVERE: <tx> Failed processing message [senderId=432325aa-0f4c-4dad-bfeb-077c2fe0ab7e]
> java.util.ConcurrentModificationException
> 	at java.util.LinkedHashMap$LinkedHashIterator.nextNode(LinkedHashMap.java:711)
> 	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:744)
> 	at java.util.LinkedHashMap$LinkedEntryIterator.next(LinkedHashMap.java:742)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.advance(GridCacheTxMap.java:133)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.next(GridCacheTxMap.java:120)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheTxMap$1$1.next(GridCacheTxMap.java:100)
> 	at java.util.AbstractMap$2$1.next(AbstractMap.java:396)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.checkLocks(GridDhtTxPrepareFuture.java:224)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.mapIfLocked(GridDhtTxPrepareFuture.java:369)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.prepare(GridDhtTxPrepareFuture.java:569)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTxLocal.prepareAsync(GridDhtTxLocal.java:425)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.prepareTx(GridDhtTransactionalCacheAdapter.java:244)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.processNearTxPrepareRequest(GridDhtTransactionalCacheAdapter.java:991)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter.access$100(GridDhtTransactionalCacheAdapter.java:53)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4.apply(GridDhtTransactionalCacheAdapter.java:109)
> 	at org.gridgain.grid.kernal.processors.cache.distributed.dht.GridDhtTransactionalCacheAdapter$4.apply(GridDhtTransactionalCacheAdapter.java:107)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:304)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:230)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager.access$200(GridCacheIoManager.java:49)
> 	at org.gridgain.grid.kernal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:142)
> 	at org.gridgain.grid.kernal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:662)
> 	at org.gridgain.grid.kernal.managers.communication.GridIoManager.access$1900(GridIoManager.java:62)
> 	at org.gridgain.grid.kernal.managers.communication.GridIoManager$6.body(GridIoManager.java:623)
> 	at org.gridgain.grid.util.worker.GridWorker.run(GridWorker.java:151)
> 	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
> 	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
> 	at java.lang.Thread.run(Thread.java:744)
> {noformat}



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

Mime
View raw message