We're updating the issue view to help you get more done. 

xa transaction broken the database

Description

The xa transcation reference the table file while it in 'prepare' phase.

How to reproduce the bug:

1 2 3 4 5 6 7 8 9 10 11 client1: mysql> create database sbtest5; mysql> create table sbtest5.t1(a int) engine=tokudb; mysql> xa start 'x5'; mysql> insert into sbtest5.t1 values(1); mysql> xa end 'x5'; mysql> xa prepare 'x5'; client2: mysql-1> drop database sbtest5; ERROR 1051 (42S02): Unknown table 'sbtest5.t1'

and the debug info:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 13735 /home/ubuntu/src/tokudb/storage/tokudb/hatoku_hton.cc:943 tokudb_xa_prepare▫ 387 13735 /home/ubuntu/src/tokudb/storage/tokudb/hatoku_hton.cc:975 tokudb_xa_prepare return 0 388 13735 0x7fe7f6680030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1253 ha_tokudb::ha_tokudb▫ 389 13735 0x7fe7f6680030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1312 ha_tokudb::ha_tokudb return 390 13735 0x7fe7f6680030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:457 ha_tokudb::bas_ext▫ 391 13735 0x7fe7f6680030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1316 ha_tokudb::~ha_tokudb▫ 392 13735 0x7fe7f6680030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1323 ha_tokudb::~ha_tokudb return 393 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:2274 ha_tokudb::close▫ 394 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:2280 ha_tokudb::__close▫ 395 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:2281 ha_tokudb::__close close:0x7fe7f66bc030 396 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:6357 ha_tokudb::reset▫ 397 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:6363 ha_tokudb::reset return 0 398 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:301 TOUDB_SHARE::release file[./sbtest4/t1]:state[OPENED]:use_count[1] 399 13735 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:318 release dbclose:0x7fe7f6620540 400 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:351 TOUDB_SHARE::release return 0 401 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:2298 ha_tokudb::__close return 0 402 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:2276 ha_tokudb::close return 0 403 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1316 ha_tokudb::~ha_tokudb▫ 404 13735 0x7fe7f66bc030 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1323 ha_tokudb::~ha_tokudb return 405 13735 0x7fe7f66e6a70 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1253 ha_tokudb::ha_tokudb▫ 406 13735 0x7fe7f66e6a70 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1312 ha_tokudb::ha_tokudb return 407 13735 0x7fe7f66e6a70 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:7690 ha_tokudb::delete_table ./sbtest4/t1 408 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.h:323 TOUDB_SHARE::lock file[./sbtest4/t1]:state[CLOSED]:use_count[0] 409 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.h:325 TOUDB_SHARE::lock return 410 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.h:331 TOUDB_SHARE::unlock file[./sbtest4/t1]:state[CLOSED]:use_count[1] 411 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.h:333 TOUDB_SHARE::unlock return 412 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:301 TOUDB_SHARE::release file[./sbtest4/t1]:state[CLOSED]:use_count[1] 413 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:351 TOUDB_SHARE::release return 0 414 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:213 TOUDB_SHARE::destroy file[./sbtest4/t1]:state[CLOSED]:use_count[0] 415 13735 0x7fe7f6628420 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:219 TOUDB_SHARE::destroy return 416 13735 /home/ubuntu/src/tokudb/storage/tokudb/tokudb_txn.h:127 txn_begin begin txn (nil) 0x7fe7f6721100 0 r=0 417 13735 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1360 open_status_dictionary open:./sbtest4/t1-status 418 13735 /home/ubuntu/src/tokudb/storage/tokudb/tokudb_txn.h:144 abort_txn abort txn 0x7fe7f6721100 419 2017-03-13T05:05:41.479211Z 4 [ERROR] Could not delete table ./sbtest4/t1 because another transaction has accessed the table. To drop the table, make sure no transactions touch the table. 420 13735 0x7fe7f66e6a70 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:7711 ha_tokudb::delete_table return -30994 421 13735 0x7fe7f66e6a70 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1316 ha_tokudb::~ha_tokudb▫ 422 13735 0x7fe7f66e6a70 /home/ubuntu/src/tokudb/storage/tokudb/ha_tokudb.cc:1323 ha_tokudb::~ha_tokudb return

InnoDB tables will be ok under this case.

Environment

percona-server 5.7.17

Status

Assignee

Unassigned

Reporter

Bohu TANG

Labels

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

External issue ID

None

Freshdesk Tickets

None

Priority

Major