diff --git a/sql/handler.cc b/sql/handler.cc index c4f5febbdcf..647848f7702 100644 --- a/sql/handler.cc +++ b/sql/handler.cc @@ -2048,9 +2048,9 @@ static char* xid_to_str(char *buf, XID *xid) } #endif -#ifdef WITH_WSREP static my_xid wsrep_order_and_check_continuity(XID *list, int len) { +#ifdef WITH_WSREP wsrep_sort_xid_array(list, len); wsrep::gtid cur_position= wsrep_get_SE_checkpoint(); long long cur_seqno= cur_position.seqno().get(); @@ -2068,8 +2068,10 @@ static my_xid wsrep_order_and_check_continuity(XID *list, int len) } WSREP_INFO("Last wsrep seqno to be recovered %lld", cur_seqno); return (cur_seqno < 0 ? 0 : cur_seqno); -} +#else + return 0; #endif /* WITH_WSREP */ +} /** recover() step of xa. @@ -2107,7 +2109,6 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, { sql_print_information("Found %d prepared transaction(s) in %s", got, hton_name(hton)->str); -#ifdef WITH_WSREP /* If wsrep_on=ON, XIDs are first ordered and then the range of recovered XIDs is checked for continuity. All the XIDs which are in continuous range can be safely committed if binlog @@ -2123,12 +2124,10 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, crashes after T2 finishes prepare step but before T1 starts the prepare. */ - my_xid wsrep_limit= 0; + my_xid wsrep_limit __attribute__((unused))= 0; if (WSREP_ON) - { wsrep_limit= wsrep_order_and_check_continuity(info->list, got); - } -#endif /* WITH_WSREP */ + for (int i=0; i < got; i ++) { my_xid x= IF_WSREP(WSREP_ON && wsrep_is_wsrep_xid(&info->list[i]) ? @@ -2137,10 +2136,10 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, info->list[i].get_my_xid()); if (!x) // not "mine" - that is generated by external TM { -#ifndef DBUG_OFF - char buf[XIDDATASIZE*4+6]; // see xid_to_str - DBUG_PRINT("info", ("ignore xid %s", xid_to_str(buf, info->list+i))); -#endif + DBUG_EXECUTE("info",{ + char buf[XIDDATASIZE*4+6]; + _db_doprnt_("ignore xid %s", xid_to_str(buf, info->list+i)); + }); xid_cache_insert(info->list + i); info->found_foreign_xids++; continue; @@ -2161,32 +2160,25 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 : tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)) { -#ifndef DBUG_OFF - int rc= -#endif - hton->commit_by_xid(hton, info->list+i); -#ifndef DBUG_OFF + int rc= hton->commit_by_xid(hton, info->list+i); if (rc == 0) { - char buf[XIDDATASIZE*4+6]; // see xid_to_str - DBUG_PRINT("info", ("commit xid %s", xid_to_str(buf, info->list+i))); + DBUG_EXECUTE("info",{ + char buf[XIDDATASIZE*4+6]; + _db_doprnt_("commit xid %s", xid_to_str(buf, info->list+i)); + }); } -#endif } else { -#ifndef DBUG_OFF - int rc= -#endif - hton->rollback_by_xid(hton, info->list+i); -#ifndef DBUG_OFF + int rc= hton->rollback_by_xid(hton, info->list+i); if (rc == 0) { - char buf[XIDDATASIZE*4+6]; // see xid_to_str - DBUG_PRINT("info", ("rollback xid %s", - xid_to_str(buf, info->list+i))); + DBUG_EXECUTE("info",{ + char buf[XIDDATASIZE*4+6]; + _db_doprnt_("rollback xid %s", xid_to_str(buf, info->list+i)); + }); } -#endif } } if (got < info->len)