Comment 2 for bug 1228341

Revision history for this message
Raghavendra D Prabhu (raghavendra-prabhu) wrote :

This affects codership tree as well, just that due to UNIV_SYNC_DEBUG being disabled, it is masked.

 === modified file 'Percona-Server/storage/innobase/trx/trx0sys.cc'
 --- Percona-Server/storage/innobase/trx/trx0sys.cc 2013-09-05 13:50:58 +0000
 +++ Percona-Server/storage/innobase/trx/trx0sys.cc 2013-09-30 12:22:41 +0000
 @@ -358,12 +358,14 @@
         mtr_start(&mtr);

         sys_header = trx_sysf_get(&mtr);
 -
 - if ((magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO
 - + TRX_SYS_WSREP_XID_MAGIC_N_FLD))
 - != TRX_SYS_WSREP_XID_MAGIC_N) {
 + magic = mach_read_from_4(sys_header + TRX_SYS_WSREP_XID_INFO + TRX_SYS_WSREP_XID_MAGIC_N_FLD);
 +
 + mtr_commit(&mtr);
 +
 + if (magic != TRX_SYS_WSREP_XID_MAGIC_N) {
                  memset(xid, 0, sizeof(*xid));
                  xid->formatID = -1;
 + mtr_start(&mtr);
                  trx_sys_update_wsrep_checkpoint(xid, &mtr);
                  mtr_commit(&mtr);
                  return;

fixes it, but a better fix will also do.

The problem is, as the crash states, is due to X-lock.

     sys_header = trx_sysf_get(&mtr); is called twice in the code:

a) first in trx_sys_read_wsrep_checkpoint(XID* xid)

b) second in trx_sys_update_wsrep_checkpoint(xid, &mtr); while the first X-lock is still held which causes the crash.

Hence, the fix above works. Tested with SST.

>>./run.sh -c galera55 -d /pxc56 -t t/xb_galera_sst.sh
Detecting server version...
Running against Percona Server 5.6.13-24.0-debug (XtraDB 5.6.13-rc60.5)
Using 'xtrabackup_55' as xtrabackup binary
Using 8 parallel workers

==============================================================================
TEST WORKER RESULT TIME(s) or COMMENT
------------------------------------------------------------------------------
xb_galera_sst w1 [passed] 52
==============================================================================
Spent 52 of 68 seconds executing testcases

SUMMARY: 1 run, 1 successful, 0 skipped, 0 failed

See results/ for detailed output
./run.sh -c galera55 -d /pxc56 -t t/xb_galera_sst.sh 8.03s user 2.92s system 16% cpu 1:07.86 total