[
https://issues.apache.org/jira/browse/IGNITE-9384?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Andrey Gura updated IGNITE-9384:
--------------------------------
Description:
I see the following issues in the {{GridDhtTxPrepareFutureAdapter}} class:
1) {{PREPARED}} state on near local transaction may be set during the future
completion. I think the {{onComplete(res)}} method should be corrected as
follows:
{code}
if ((last || tx.isSystemInvalidate()) && !(tx.near() && tx.local()))
tx.state(PREPARED);
...
{code}
2) In {{onDone}} we have the following code:
{code}
if (REPLIED_UPD.compareAndSet(this, 0, 1)) {
GridNearTxPrepareResponse res = createPrepareResponse(this.err);
try {
sendPrepareResponse(res);
}
finally {
// Will call super.onDone().
onComplete(res);
}
return true;
}
...
{code}
This code will send near prepare response to the near node before the local DHT
transaction sets it's state to {{PREPARED}} which violates the invariant that
all transactions are prepared before any of the transactions is committed. I
think these two methods should be swapped, but we need to carefully check the
error handling (note that {{onComplete}} is called in {{finally}} block).
was:
I see the following issues in the {{GridDhtTxPrepareFutureAdapter}} class:
1) {{PREPARED}} state on near local transaction may be set during the future
completion. I think the {{onComplete(res)}} method should be corrected as
follows:
{code}
if (last || tx.isSystemInvalidate() && !(tx.near() && tx.local()))
tx.state(PREPARED);
...
{code}
2) In {{onDone}} we have the following code:
{code}
if (REPLIED_UPD.compareAndSet(this, 0, 1)) {
GridNearTxPrepareResponse res = createPrepareResponse(this.err);
try {
sendPrepareResponse(res);
}
finally {
// Will call super.onDone().
onComplete(res);
}
return true;
}
...
{code}
This code will send near prepare response to the near node before the local DHT
transaction sets it's state to {{PREPARED}} which violates the invariant that
all transactions are prepared before any of the transactions is committed. I
think these two methods should be swapped, but we need to carefully check the
error handling (note that {{onComplete}} is called in {{finally}} block).
> Transaction state PREPARED may be set too early or too late
> -----------------------------------------------------------
>
> Key: IGNITE-9384
> URL: https://issues.apache.org/jira/browse/IGNITE-9384
> Project: Ignite
> Issue Type: Bug
> Reporter: Alexey Goncharuk
> Assignee: Andrey Gura
> Priority: Major
> Fix For: 2.7
>
>
> I see the following issues in the {{GridDhtTxPrepareFutureAdapter}} class:
> 1) {{PREPARED}} state on near local transaction may be set during the future
> completion. I think the {{onComplete(res)}} method should be corrected as
> follows:
> {code}
> if ((last || tx.isSystemInvalidate()) && !(tx.near() && tx.local()))
> tx.state(PREPARED);
> ...
> {code}
> 2) In {{onDone}} we have the following code:
> {code}
> if (REPLIED_UPD.compareAndSet(this, 0, 1)) {
> GridNearTxPrepareResponse res =
> createPrepareResponse(this.err);
> try {
> sendPrepareResponse(res);
> }
> finally {
> // Will call super.onDone().
> onComplete(res);
> }
> return true;
> }
> ...
> {code}
> This code will send near prepare response to the near node before the local
> DHT transaction sets it's state to {{PREPARED}} which violates the invariant
> that all transactions are prepared before any of the transactions is
> committed. I think these two methods should be swapped, but we need to
> carefully check the error handling (note that {{onComplete}} is called in
> {{finally}} block).
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)