ignite-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Andrey Gura <ag...@gridgain.com>
Subject Re: EntryProcessor invoked twice
Date Thu, 03 Dec 2015 18:04:34 GMT
Hi,

Recently Alexey Goncharuk wrote in thread "EntryProcessor execution
semantics":

For example, in a case of explicit optimistic
> READ_COMMITTED transaction it may be called more than once because Ignite
> needs to calculate a return value for the first invoke() and then it should
> be called second time during commit when transactional locks are held.


Current requirement is that an EntryProcessor should be a stateless
> function, and it may be called more than once (but of course it will
> receive the same cache value every time).
>



On Thu, Dec 3, 2015 at 8:46 PM, Valentin Kulichenko <
valentin.kulichenko@gmail.com> wrote:

> Dmitry,
>
> Counter will not be incremented twice, because the entry is locked and EP
> is guaranteed to be called both times for the same old value. So there is
> no critical bug here in my view, but I just don't see the reason why we
> call it two times instead of one for one operation.
>
> -Val
>
> On Thu, Dec 3, 2015 at 1:22 AM, Dmitriy Setrakyan <dsetrakyan@apache.org>
> wrote:
>
> > I think this is definitely a bug. Imagine that EP is used to maintain a
> > counter, and the counter is incremented with every update. In this case
> the
> > counter will be updated 2 times instead of 1.
> >
> > Alexey G., would be nice to hear your thoughts here.
> >
> > D.
> >
> > On Wed, Dec 2, 2015 at 9:08 PM, Valentin Kulichenko <
> > valentin.kulichenko@gmail.com> wrote:
> >
> > > Igniters,
> > >
> > > I noticed that when I execute cache.invoke() in transactional cache,
> it's
> > > invoked twice for the same old value on the primary node. First
> > invocation
> > > is done on prepare step [1], the second one happens on commit [2]. Is
> > this
> > > expected behavior? Why can't we reuse already calculated new value
> during
> > > commit?
> > >
> > > [1]
> > > java.lang.RuntimeException: XXX
> > >         at
> > >
> > >
> >
> com.workday.fabric.ScratchClient$ScratchEntryProcessor.process(ScratchClient.java:106)
> > >         at
> > >
> > >
> >
> com.workday.fabric.ScratchClient$ScratchEntryProcessor.process(ScratchClient.java:96)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.onEntriesLocked(GridDhtTxPrepareFuture.java:381)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.prepare0(GridDhtTxPrepareFuture.java:909)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.mapIfLocked(GridDhtTxPrepareFuture.java:527)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.prepare(GridDhtTxPrepareFuture.java:822)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal.prepareAsync(GridDhtTxLocal.java:462)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler.prepareNearTx(IgniteTxHandler.java:406)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler.prepareTx(IgniteTxHandler.java:200)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler.processNearTxPrepareRequest(IgniteTxHandler.java:101)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$1.apply(IgniteTxHandler.java:114)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$1.apply(IgniteTxHandler.java:112)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:580)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:280)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:198)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$000(GridCacheIoManager.java:77)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:160)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:811)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.managers.communication.GridIoManager.access$1500(GridIoManager.java:106)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:774)
> > >         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:745)
> > >
> > > [2]
> > > java.lang.RuntimeException: XXX
> > >         at
> > >
> > >
> >
> com.workday.fabric.ScratchClient$ScratchEntryProcessor.process(ScratchClient.java:106)
> > >         at
> > >
> > >
> >
> com.workday.fabric.ScratchClient$ScratchEntryProcessor.process(ScratchClient.java:96)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxAdapter.applyTransformClosures(IgniteTxAdapter.java:1314)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxLocalAdapter.userCommit(IgniteTxLocalAdapter.java:826)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocalAdapter.finish(GridDhtTxLocalAdapter.java:836)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal.finish(GridDhtTxLocal.java:657)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxLocal.commitAsync(GridDhtTxLocal.java:557)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.onDone(GridDhtTxPrepareFuture.java:574)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.onDone(GridDhtTxPrepareFuture.java:95)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridCompoundFuture.checkComplete(GridCompoundFuture.java:260)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridCompoundFuture.access$700(GridCompoundFuture.java:43)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridCompoundFuture$Listener.apply(GridCompoundFuture.java:358)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridCompoundFuture$Listener.apply(GridCompoundFuture.java:302)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridFutureAdapter.notifyListener(GridFutureAdapter.java:262)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridFutureAdapter.notifyListeners(GridFutureAdapter.java:250)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:380)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:346)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.util.future.GridFutureAdapter.onDone(GridFutureAdapter.java:323)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture$MiniFuture.onResult(GridDhtTxPrepareFuture.java:1477)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.distributed.dht.GridDhtTxPrepareFuture.onResult(GridDhtTxPrepareFuture.java:454)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler.processDhtTxPrepareResponse(IgniteTxHandler.java:524)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler.access$200(IgniteTxHandler.java:87)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$6.apply(IgniteTxHandler.java:144)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.transactions.IgniteTxHandler$6.apply(IgniteTxHandler.java:142)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.processMessage(GridCacheIoManager.java:580)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.onMessage0(GridCacheIoManager.java:280)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.handleMessage(GridCacheIoManager.java:198)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager.access$000(GridCacheIoManager.java:77)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.processors.cache.GridCacheIoManager$1.onMessage(GridCacheIoManager.java:160)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.managers.communication.GridIoManager.processRegularMessage0(GridIoManager.java:811)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.managers.communication.GridIoManager.access$1500(GridIoManager.java:106)
> > >         at
> > >
> > >
> >
> org.apache.ignite.internal.managers.communication.GridIoManager$5.run(GridIoManager.java:774)
> > >         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:745)
> > >
> > > -Val
> > >
> >
>



-- 
Andrey Gura
GridGain Systems, Inc.
www.gridgain.com

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message