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
static xid_recovery_member*
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));
if (!member)
return NULL;
member->xid= xid_arg;
member->in_engine_prepare= 1;
member->decided_to_commit= false;
*member= xid_recovery_member(xid_arg, 1, 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,
sql_print_error("Error in memory allocation at xarecover_handlerton");
break;
}
} else
}
if (IF_WSREP((wsrep_emulate_bin_log &&
wsrep_is_wsrep_xid(info->list + i) &&
x <= wsrep_limit), false) ||
(info->commit_list ?
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)
{
int rc= hton->commit_by_xid(hton, info->list+i);
if (rc == 0)
......@@ -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);
if (rc == 0)
......
......@@ -956,6 +956,10 @@ struct xid_recovery_member
uint in_engine_prepare; // number of engines that have xid prepared
bool decided_to_commit;
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 */
......
......@@ -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);
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))
{
......
......@@ -1243,7 +1243,7 @@ class Gtid_list_log_event;
const char *
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_rollback_by_xid(handlerton *hton, XID *xid);
......
......@@ -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);
/* 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 ||
buf_0[event_len - 1] == 0);
}
......
......@@ -10410,7 +10410,7 @@ do_continue:;
DROP + CREATE + data statement to the binary log
*/
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 */
......@@ -10624,7 +10624,7 @@ do_continue:;
thd->variables.option_bits&= ~OPTION_BIN_COMMIT_OFF;
thd->binlog_xid= thd->query_id;
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;
}
......
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