Commit 79a2dbc8 authored by Andrei Elkin's avatar Andrei Elkin

MDEV-21117 post-push fixes

1. work around MDEV-25912 to not apply assert
   at wsrep running time;
2. handle wsrep mode of the server recovery
3. convert hton calls to static binlog_commit ones.
4. satisfy MSAN complain on uninitialized std::pair
parent e41522d6
...@@ -2401,16 +2401,16 @@ struct xarecover_st ...@@ -2401,16 +2401,16 @@ struct xarecover_st
static xid_recovery_member* static xid_recovery_member*
xid_member_insert(HASH *hash_arg, my_xid xid_arg, MEM_ROOT *ptr_mem_root) xid_member_insert(HASH *hash_arg, my_xid xid_arg, MEM_ROOT *ptr_mem_root)
{ {
xid_recovery_member *member= (xid_recovery_member*) xid_recovery_member *member= (xid_recovery_member *)
alloc_root(ptr_mem_root, sizeof(xid_recovery_member)); alloc_root(ptr_mem_root, sizeof(xid_recovery_member));
if (!member) if (!member)
return NULL; return NULL;
member->xid= xid_arg; *member= xid_recovery_member(xid_arg, 1, false);
member->in_engine_prepare= 1;
member->decided_to_commit= false;
return my_hash_insert(hash_arg, (uchar*) member) ? NULL : member; return
my_hash_insert(hash_arg, (uchar*) member) ? NULL : member;
} }
/* /*
...@@ -2636,13 +2636,11 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, ...@@ -2636,13 +2636,11 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
sql_print_error("Error in memory allocation at xarecover_handlerton"); sql_print_error("Error in memory allocation at xarecover_handlerton");
break; break;
} }
} else }
if (IF_WSREP((wsrep_emulate_bin_log && if (IF_WSREP((wsrep_emulate_bin_log &&
wsrep_is_wsrep_xid(info->list + i) && wsrep_is_wsrep_xid(info->list + i) &&
x <= wsrep_limit), false) || x <= wsrep_limit), false) ||
(info->commit_list ? tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT)
my_hash_search(info->commit_list, (uchar *)&x, sizeof(x)) != 0 :
tc_heuristic_recover == TC_HEURISTIC_RECOVER_COMMIT))
{ {
int rc= hton->commit_by_xid(hton, info->list+i); int rc= hton->commit_by_xid(hton, info->list+i);
if (rc == 0) if (rc == 0)
...@@ -2653,7 +2651,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin, ...@@ -2653,7 +2651,8 @@ static my_bool xarecover_handlerton(THD *unused, plugin_ref plugin,
}); });
} }
} }
else else if (WSREP_ON ||
tc_heuristic_recover == TC_HEURISTIC_RECOVER_ROLLBACK)
{ {
int rc= hton->rollback_by_xid(hton, info->list+i); int rc= hton->rollback_by_xid(hton, info->list+i);
if (rc == 0) if (rc == 0)
......
...@@ -956,6 +956,10 @@ struct xid_recovery_member ...@@ -956,6 +956,10 @@ struct xid_recovery_member
uint in_engine_prepare; // number of engines that have xid prepared uint in_engine_prepare; // number of engines that have xid prepared
bool decided_to_commit; bool decided_to_commit;
Binlog_offset binlog_coord; // semisync recovery binlog offset Binlog_offset binlog_coord; // semisync recovery binlog offset
xid_recovery_member(my_xid xid_arg, uint prepare_arg, bool decided_arg)
: xid(xid_arg), in_engine_prepare(prepare_arg),
decided_to_commit(decided_arg) {};
}; };
/* for recover() handlerton call */ /* for recover() handlerton call */
......
...@@ -11040,7 +11040,7 @@ void Recovery_context::process_gtid(int round, Gtid_log_event *gev, ...@@ -11040,7 +11040,7 @@ void Recovery_context::process_gtid(int round, Gtid_log_event *gev,
last_gtid_coord= Binlog_offset(id_binlog, prev_event_pos); last_gtid_coord= Binlog_offset(id_binlog, prev_event_pos);
DBUG_ASSERT(!last_gtid_valid); DBUG_ASSERT(!last_gtid_valid);
DBUG_ASSERT(!last_gtid.seq_no == 0); DBUG_ASSERT(last_gtid.seq_no != 0);
if (round == 1 || (do_truncate && !truncate_validated)) if (round == 1 || (do_truncate && !truncate_validated))
{ {
......
...@@ -1243,7 +1243,7 @@ class Gtid_list_log_event; ...@@ -1243,7 +1243,7 @@ class Gtid_list_log_event;
const char * const char *
get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list); get_gtid_list_event(IO_CACHE *cache, Gtid_list_log_event **out_gtid_list);
int binlog_commit(THD *thd, bool all, bool is_ro_1pc); int binlog_commit(THD *thd, bool all, bool is_ro_1pc= false);
int binlog_commit_by_xid(handlerton *hton, XID *xid); int binlog_commit_by_xid(handlerton *hton, XID *xid);
int binlog_rollback_by_xid(handlerton *hton, XID *xid); int binlog_rollback_by_xid(handlerton *hton, XID *xid);
......
...@@ -2624,6 +2624,11 @@ Gtid_log_event::Gtid_log_event(const uchar *buf, uint event_len, ...@@ -2624,6 +2624,11 @@ Gtid_log_event::Gtid_log_event(const uchar *buf, uint event_len,
*/ */
DBUG_ASSERT(static_cast<uint>(buf - buf_0) <= event_len); DBUG_ASSERT(static_cast<uint>(buf - buf_0) <= event_len);
/* and the last of them is tested. */ /* and the last of them is tested. */
#ifdef MYSQL_SERVER
#ifdef WITH_WSREP
if (!WSREP_ON)
#endif
#endif
DBUG_ASSERT(static_cast<uint>(buf - buf_0) == event_len || DBUG_ASSERT(static_cast<uint>(buf - buf_0) == event_len ||
buf_0[event_len - 1] == 0); buf_0[event_len - 1] == 0);
} }
......
...@@ -10410,7 +10410,7 @@ do_continue:; ...@@ -10410,7 +10410,7 @@ do_continue:;
DROP + CREATE + data statement to the binary log DROP + CREATE + data statement to the binary log
*/ */
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF; thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
(binlog_hton->commit)(binlog_hton, thd, 1); binlog_commit(thd, true);
} }
/* We don't replicate alter table statement on temporary tables */ /* We don't replicate alter table statement on temporary tables */
...@@ -10624,7 +10624,7 @@ do_continue:; ...@@ -10624,7 +10624,7 @@ do_continue:;
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF; thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
thd->binlog_xid= thd->query_id; thd->binlog_xid= thd->query_id;
ddl_log_update_xid(&ddl_log_state, thd->binlog_xid); ddl_log_update_xid(&ddl_log_state, thd->binlog_xid);
binlog_hton->commit(binlog_hton, thd, 1); binlog_commit(thd, true);
thd->binlog_xid= 0; thd->binlog_xid= 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment