You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ignite.apache.org by "Alexey Goncharuk (JIRA)" <ji...@apache.org> on 2018/08/27 09:58:00 UTC

[jira] [Created] (IGNITE-9384) Transaction state PREPARED may be set too early or too late

Alexey Goncharuk created IGNITE-9384:
----------------------------------------

             Summary: 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


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)