Skip to content

Fail to recover XA Transaction on startup when xa log is not flushed and server is down #1192

@tankilo

Description

@tankilo
  • dble version:
  • preconditions :
    no
  • configs:

schema.xml

<table name="xa_test" dataNode="dn1,dn2" rule="sharding-by-mod2" primaryKey="ID"/>

rule.xml

<tableRule name="sharding-by-mod2">
        <rule>
            <columns>id</columns>
            <algorithm>hashmod2</algorithm>
        </rule>
    </tableRule>
    <function name="hashmod2" class="Hash">
        <property name="partitionCount">2</property>
        <property name="partitionLength">1</property>
    </function>

server.xml



  • steps:

step1. set breakpoint in method com.actiontech.dble.backend.mysql.nio.handler.transaction.xa.XACommitNodesHandler#executeCommit

image

step 2. executing following command via mysql shell

set xa=1;
delete from xa_test;

step 3. when program stops at the above breakpoint, kill program

image
image

{"id":"'Dble_Server.server_01.786'","state":"12","participants":[{"host":"localhost","port":"3306","p_state":"2","expires":0,"schema":"db2"},{"host":"localhost","port":"3306","p_state":"2","expires":0,"schema":"db1"}]}

step 4. restart dble server, dble failed to recover this prepared transaction.

image
image

  • expect result:

    1. transaction should be rollback
  • real result:

    1. transaction is not rollbacked.
  • supplements:
    1.

/label ~BUG

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions