cleanup: remove few #ifdef's

This commit is contained in:
Sergei Golubchik 2019-07-28 00:04:57 +02:00
parent 4af932e899
commit eb8f7005bd

View file

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