prepare phase messages handlers question

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

prepare phase messages handlers question

voipp
Hi all!
What is the point of sending GridDhtTxPrepareRequest and
GridDhtTxPrepareResponse messages?
What is the logic behind processDhtTxFinishRequest and
processDhtTxPrepareResponse ?
--

*Best Regards,*

*Kuznetsov Aleksey*
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

afedotov
Hi,

These messages are part of 2-phase commit protocol.
They are sent from a primary node to backup nodes.


On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <[hidden email]
> wrote:

> Hi all!
> What is the point of sending GridDhtTxPrepareRequest and
> GridDhtTxPrepareResponse messages?
> What is the logic behind processDhtTxFinishRequest and
> processDhtTxPrepareResponse ?
> --
>
> *Best Regards,*
>
> *Kuznetsov Aleksey*
>



--
Kind regards,
Alex.
Kind regards,
Alexander
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

voipp
When optimistic transaction occures, there is a lock on entities -
org.apache.ignite.internal.processors.cache.transactions.IgniteTxManager#lockMultiple
Don't you know, why there is a strange string inside this method :

assert !entry1.detached() : "Expected non-detached entry for near
transaction " +
    "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';

As far as I know, detached entry is one, created by non-local node.

ср, 22 мар. 2017 г. в 18:08, Alexander Fedotov <[hidden email]
>:

> Hi,
>
> These messages are part of 2-phase commit protocol.
> They are sent from a primary node to backup nodes.
>
>
> On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <
> [hidden email]
> > wrote:
>
> > Hi all!
> > What is the point of sending GridDhtTxPrepareRequest and
> > GridDhtTxPrepareResponse messages?
> > What is the logic behind processDhtTxFinishRequest and
> > processDhtTxPrepareResponse ?
> > --
> >
> > *Best Regards,*
> >
> > *Kuznetsov Aleksey*
> >
>
>
>
> --
> Kind regards,
> Alex.
>
--

*Best Regards,*

*Kuznetsov Aleksey*
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

Alexey Goncharuk
This assertion ensures that an entry locked by an optimistic transaction is
locked on a primary or backup node. Like you said, if an entry is detached,
it means that it is created by a node to which this entry does not belong,
and thus must not be locked.

--AG

2017-03-22 18:37 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:

> When optimistic transaction occures, there is a lock on entities -
> org.apache.ignite.internal.processors.cache.transactions.
> IgniteTxManager#lockMultiple
> Don't you know, why there is a strange string inside this method :
>
> assert !entry1.detached() : "Expected non-detached entry for near
> transaction " +
>     "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';
>
> As far as I know, detached entry is one, created by non-local node.
>
> ср, 22 мар. 2017 г. в 18:08, Alexander Fedotov <
> [hidden email]
> >:
>
> > Hi,
> >
> > These messages are part of 2-phase commit protocol.
> > They are sent from a primary node to backup nodes.
> >
> >
> > On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <
> > [hidden email]
> > > wrote:
> >
> > > Hi all!
> > > What is the point of sending GridDhtTxPrepareRequest and
> > > GridDhtTxPrepareResponse messages?
> > > What is the logic behind processDhtTxFinishRequest and
> > > processDhtTxPrepareResponse ?
> > > --
> > >
> > > *Best Regards,*
> > >
> > > *Kuznetsov Aleksey*
> > >
> >
> >
> >
> > --
> > Kind regards,
> > Alex.
> >
> --
>
> *Best Regards,*
>
> *Kuznetsov Aleksey*
>
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

voipp
correct me if im wrong. Consider node1 called cache.put(key1, val1);
So node1 creates cacheEntry1. If Affinity function decides node2 holds key1
then cacheEntry1 will be detached, otherwise cacheEntry isnt detached.

ср, 22 Мар 2017 г., 18:43 Alexey Goncharuk <[hidden email]>:

> This assertion ensures that an entry locked by an optimistic transaction is
> locked on a primary or backup node. Like you said, if an entry is detached,
> it means that it is created by a node to which this entry does not belong,
> and thus must not be locked.
>
> --AG
>
> 2017-03-22 18:37 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:
>
> > When optimistic transaction occures, there is a lock on entities -
> > org.apache.ignite.internal.processors.cache.transactions.
> > IgniteTxManager#lockMultiple
> > Don't you know, why there is a strange string inside this method :
> >
> > assert !entry1.detached() : "Expected non-detached entry for near
> > transaction " +
> >     "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';
> >
> > As far as I know, detached entry is one, created by non-local node.
> >
> > ср, 22 мар. 2017 г. в 18:08, Alexander Fedotov <
> > [hidden email]
> > >:
> >
> > > Hi,
> > >
> > > These messages are part of 2-phase commit protocol.
> > > They are sent from a primary node to backup nodes.
> > >
> > >
> > > On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <
> > > [hidden email]
> > > > wrote:
> > >
> > > > Hi all!
> > > > What is the point of sending GridDhtTxPrepareRequest and
> > > > GridDhtTxPrepareResponse messages?
> > > > What is the logic behind processDhtTxFinishRequest and
> > > > processDhtTxPrepareResponse ?
> > > > --
> > > >
> > > > *Best Regards,*
> > > >
> > > > *Kuznetsov Aleksey*
> > > >
> > >
> > >
> > >
> > > --
> > > Kind regards,
> > > Alex.
> > >
> > --
> >
> > *Best Regards,*
> >
> > *Kuznetsov Aleksey*
> >
>
--

*Best Regards,*

*Kuznetsov Aleksey*
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

Alexey Goncharuk
Yes, that is correct. Note, however, that in this case, node1 will send a
NearTxPrepareRequest to node2 and lockMultiple() will be called on node2,
not on node1.

2017-03-22 20:26 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:

> correct me if im wrong. Consider node1 called cache.put(key1, val1);
> So node1 creates cacheEntry1. If Affinity function decides node2 holds key1
> then cacheEntry1 will be detached, otherwise cacheEntry isnt detached.
>
> ср, 22 Мар 2017 г., 18:43 Alexey Goncharuk <[hidden email]>:
>
> > This assertion ensures that an entry locked by an optimistic transaction
> is
> > locked on a primary or backup node. Like you said, if an entry is
> detached,
> > it means that it is created by a node to which this entry does not
> belong,
> > and thus must not be locked.
> >
> > --AG
> >
> > 2017-03-22 18:37 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:
> >
> > > When optimistic transaction occures, there is a lock on entities -
> > > org.apache.ignite.internal.processors.cache.transactions.
> > > IgniteTxManager#lockMultiple
> > > Don't you know, why there is a strange string inside this method :
> > >
> > > assert !entry1.detached() : "Expected non-detached entry for near
> > > transaction " +
> > >     "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';
> > >
> > > As far as I know, detached entry is one, created by non-local node.
> > >
> > > ср, 22 мар. 2017 г. в 18:08, Alexander Fedotov <
> > > [hidden email]
> > > >:
> > >
> > > > Hi,
> > > >
> > > > These messages are part of 2-phase commit protocol.
> > > > They are sent from a primary node to backup nodes.
> > > >
> > > >
> > > > On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <
> > > > [hidden email]
> > > > > wrote:
> > > >
> > > > > Hi all!
> > > > > What is the point of sending GridDhtTxPrepareRequest and
> > > > > GridDhtTxPrepareResponse messages?
> > > > > What is the logic behind processDhtTxFinishRequest and
> > > > > processDhtTxPrepareResponse ?
> > > > > --
> > > > >
> > > > > *Best Regards,*
> > > > >
> > > > > *Kuznetsov Aleksey*
> > > > >
> > > >
> > > >
> > > >
> > > > --
> > > > Kind regards,
> > > > Alex.
> > > >
> > > --
> > >
> > > *Best Regards,*
> > >
> > > *Kuznetsov Aleksey*
> > >
> >
> --
>
> *Best Regards,*
>
> *Kuznetsov Aleksey*
>
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

voipp
in this case assert !entry1.detached() will throw exception

ср, 22 мар. 2017 г. в 23:17, Alexey Goncharuk <[hidden email]>:

> Yes, that is correct. Note, however, that in this case, node1 will send a
> NearTxPrepareRequest to node2 and lockMultiple() will be called on node2,
> not on node1.
>
> 2017-03-22 20:26 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:
>
> > correct me if im wrong. Consider node1 called cache.put(key1, val1);
> > So node1 creates cacheEntry1. If Affinity function decides node2 holds
> key1
> > then cacheEntry1 will be detached, otherwise cacheEntry isnt detached.
> >
> > ср, 22 Мар 2017 г., 18:43 Alexey Goncharuk <[hidden email]>:
> >
> > > This assertion ensures that an entry locked by an optimistic
> transaction
> > is
> > > locked on a primary or backup node. Like you said, if an entry is
> > detached,
> > > it means that it is created by a node to which this entry does not
> > belong,
> > > and thus must not be locked.
> > >
> > > --AG
> > >
> > > 2017-03-22 18:37 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]
> >:
> > >
> > > > When optimistic transaction occures, there is a lock on entities -
> > > > org.apache.ignite.internal.processors.cache.transactions.
> > > > IgniteTxManager#lockMultiple
> > > > Don't you know, why there is a strange string inside this method :
> > > >
> > > > assert !entry1.detached() : "Expected non-detached entry for near
> > > > transaction " +
> > > >     "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';
> > > >
> > > > As far as I know, detached entry is one, created by non-local node.
> > > >
> > > > ср, 22 мар. 2017 г. в 18:08, Alexander Fedotov <
> > > > [hidden email]
> > > > >:
> > > >
> > > > > Hi,
> > > > >
> > > > > These messages are part of 2-phase commit protocol.
> > > > > They are sent from a primary node to backup nodes.
> > > > >
> > > > >
> > > > > On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <
> > > > > [hidden email]
> > > > > > wrote:
> > > > >
> > > > > > Hi all!
> > > > > > What is the point of sending GridDhtTxPrepareRequest and
> > > > > > GridDhtTxPrepareResponse messages?
> > > > > > What is the logic behind processDhtTxFinishRequest and
> > > > > > processDhtTxPrepareResponse ?
> > > > > > --
> > > > > >
> > > > > > *Best Regards,*
> > > > > >
> > > > > > *Kuznetsov Aleksey*
> > > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > Kind regards,
> > > > > Alex.
> > > > >
> > > > --
> > > >
> > > > *Best Regards,*
> > > >
> > > > *Kuznetsov Aleksey*
> > > >
> > >
> > --
> >
> > *Best Regards,*
> >
> > *Kuznetsov Aleksey*
> >
>
--

*Best Regards,*

*Kuznetsov Aleksey*
Reply | Threaded
Open this post in threaded view
|

Re: prepare phase messages handlers question

Alexey Goncharuk
No, it will not - when a prepare request is received by the node2, it will
create a separate local instance of the transaction (GridCacheMapEntry is
never serialized) and on node2 the entry will not be detached, thus not
triggering the assertion.

2017-03-23 10:56 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:

> in this case assert !entry1.detached() will throw exception
>
> ср, 22 мар. 2017 г. в 23:17, Alexey Goncharuk <[hidden email]
> >:
>
> > Yes, that is correct. Note, however, that in this case, node1 will send a
> > NearTxPrepareRequest to node2 and lockMultiple() will be called on node2,
> > not on node1.
> >
> > 2017-03-22 20:26 GMT+03:00 ALEKSEY KUZNETSOV <[hidden email]>:
> >
> > > correct me if im wrong. Consider node1 called cache.put(key1, val1);
> > > So node1 creates cacheEntry1. If Affinity function decides node2 holds
> > key1
> > > then cacheEntry1 will be detached, otherwise cacheEntry isnt detached.
> > >
> > > ср, 22 Мар 2017 г., 18:43 Alexey Goncharuk <[hidden email]
> >:
> > >
> > > > This assertion ensures that an entry locked by an optimistic
> > transaction
> > > is
> > > > locked on a primary or backup node. Like you said, if an entry is
> > > detached,
> > > > it means that it is created by a node to which this entry does not
> > > belong,
> > > > and thus must not be locked.
> > > >
> > > > --AG
> > > >
> > > > 2017-03-22 18:37 GMT+03:00 ALEKSEY KUZNETSOV <
> [hidden email]
> > >:
> > > >
> > > > > When optimistic transaction occures, there is a lock on entities -
> > > > > org.apache.ignite.internal.processors.cache.transactions.
> > > > > IgniteTxManager#lockMultiple
> > > > > Don't you know, why there is a strange string inside this method :
> > > > >
> > > > > assert !entry1.detached() : "Expected non-detached entry for near
> > > > > transaction " +
> > > > >     "[locNodeId=" + cctx.localNodeId() + ", entry=" + entry1 + ']';
> > > > >
> > > > > As far as I know, detached entry is one, created by non-local node.
> > > > >
> > > > > ср, 22 мар. 2017 г. в 18:08, Alexander Fedotov <
> > > > > [hidden email]
> > > > > >:
> > > > >
> > > > > > Hi,
> > > > > >
> > > > > > These messages are part of 2-phase commit protocol.
> > > > > > They are sent from a primary node to backup nodes.
> > > > > >
> > > > > >
> > > > > > On Mon, Mar 20, 2017 at 7:41 PM, ALEKSEY KUZNETSOV <
> > > > > > [hidden email]
> > > > > > > wrote:
> > > > > >
> > > > > > > Hi all!
> > > > > > > What is the point of sending GridDhtTxPrepareRequest and
> > > > > > > GridDhtTxPrepareResponse messages?
> > > > > > > What is the logic behind processDhtTxFinishRequest and
> > > > > > > processDhtTxPrepareResponse ?
> > > > > > > --
> > > > > > >
> > > > > > > *Best Regards,*
> > > > > > >
> > > > > > > *Kuznetsov Aleksey*
> > > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > Kind regards,
> > > > > > Alex.
> > > > > >
> > > > > --
> > > > >
> > > > > *Best Regards,*
> > > > >
> > > > > *Kuznetsov Aleksey*
> > > > >
> > > >
> > > --
> > >
> > > *Best Regards,*
> > >
> > > *Kuznetsov Aleksey*
> > >
> >
> --
>
> *Best Regards,*
>
> *Kuznetsov Aleksey*
>