You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Steve Huston (JIRA)" <qp...@incubator.apache.org> on 2010/02/24 21:09:27 UTC

[jira] Created: (QPID-2420) Windows SQL-based persistence loses prepared two-phase transactions on broker restart

Windows SQL-based persistence loses prepared two-phase transactions on broker restart
-------------------------------------------------------------------------------------

                 Key: QPID-2420
                 URL: https://issues.apache.org/jira/browse/QPID-2420
             Project: Qpid
          Issue Type: Bug
          Components: C++ Broker
    Affects Versions: 0.6
         Environment: Windows, SQL
            Reporter: Steve Huston
            Assignee: Steve Huston
             Fix For: 0.7


If the C++ broker restarts after a 2PC transaction is prepared but not committed, the transaction is lost (as if an abort was done on the transaction) when the broker restarts.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] Commented: (QPID-2420) Windows SQL-based persistence loses prepared two-phase transactions on broker restart

Posted by "Steve Huston (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-2420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12843305#action_12843305 ] 

Steve Huston commented on QPID-2420:
------------------------------------

This problem arose because the original MS SQL store module runs a dtx's operations under an outer SQL transaction and commits the SQL transaction on dtx commit; thus, a prepare followed by a crash loses the SQL transaction and any record of the dtx.

To fix this, here's what I think should be done:

Table changes:
1. The store maintains a SQL table of messageId->queueId mappings, one for each place the message is queued. This table will have two more columns added: add/remove (Boolean; true =add, false=remove) and xid (reference to TPL table's xid key column).

2. Add a new table TPL with prepared Xids. The xid is the key and is referred to by the new xid column in the message mapping table.

Behavior changes:

- When a dtx start is received (in the store, not in AMQP) a SQL transaction is started and a new TPL record is added with the xid.
- On enqueue() add the message mapping record for the operation, and include the 'add' indicator and dtx's xid
- On dequeue() add the xid to the existing mapping record and ensure the add/remove field is 'remove'
- When dtx prepare is received in the store, commit the outer SQL transaction from dtx start

- For dtx commit, under SQL transaction
   1. Remove the xid record from the TPL table
   2. For each mapping record that refers to the xid: delete 'remove' records, remove xid and clear 'add' indicator from add records.

- For dtx rollback, under SQL transaction
   1. Remove the xid record from the TPL table
   2. For each mapping record that refers to the xid: delete 'add' records; remove xid value from 'remove' records.

- On recovery
   1. Read all the xids from the TPL table; there's one for each prepared dtx; call recoverTransaction for each
   2. For each xid, get the mapping records associated with the xid; based on the add/remove indicator, call either RecoverableTransaction::enqueue() or dequeue()


> Windows SQL-based persistence loses prepared two-phase transactions on broker restart
> -------------------------------------------------------------------------------------
>
>                 Key: QPID-2420
>                 URL: https://issues.apache.org/jira/browse/QPID-2420
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker
>    Affects Versions: 0.6
>         Environment: Windows, SQL
>            Reporter: Steve Huston
>            Assignee: Steve Huston
>             Fix For: 0.7
>
>
> If the C++ broker restarts after a 2PC transaction is prepared but not committed, the transaction is lost (as if an abort was done on the transaction) when the broker restarts.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] Commented: (QPID-2420) Windows SQL-based persistence loses prepared two-phase transactions on broker restart

Posted by "Steve Huston (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-2420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12858641#action_12858641 ] 

Steve Huston commented on QPID-2420:
------------------------------------

Added trigger to delete orphaned records and also test execution when store is part of the build. On trunk at r935710.

Need to enable the broker-restarting/recovering tests that are commented out in run_store_tests.ps1 after brokertest.py is resolved to work for both Windows and Linux w/ Python 2.3. See QPID-2492.

> Windows SQL-based persistence loses prepared two-phase transactions on broker restart
> -------------------------------------------------------------------------------------
>
>                 Key: QPID-2420
>                 URL: https://issues.apache.org/jira/browse/QPID-2420
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker
>    Affects Versions: 0.6
>         Environment: Windows, SQL
>            Reporter: Steve Huston
>            Assignee: Steve Huston
>             Fix For: 0.7
>
>
> If the C++ broker restarts after a 2PC transaction is prepared but not committed, the transaction is lost (as if an abort was done on the transaction) when the broker restarts.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org


[jira] Commented: (QPID-2420) Windows SQL-based persistence loses prepared two-phase transactions on broker restart

Posted by "Steve Huston (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-2420?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12857958#action_12857958 ] 

Steve Huston commented on QPID-2420:
------------------------------------

The bulk of the changes are in the trunk at r935068.

I still need to commit the tests, after testing brokertest.py changes on Linux.
Also need to add the trigger creation which removes unreferenced messages from the messages table.

> Windows SQL-based persistence loses prepared two-phase transactions on broker restart
> -------------------------------------------------------------------------------------
>
>                 Key: QPID-2420
>                 URL: https://issues.apache.org/jira/browse/QPID-2420
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Broker
>    Affects Versions: 0.6
>         Environment: Windows, SQL
>            Reporter: Steve Huston
>            Assignee: Steve Huston
>             Fix For: 0.7
>
>
> If the C++ broker restarts after a 2PC transaction is prepared but not committed, the transaction is lost (as if an abort was done on the transaction) when the broker restarts.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org