Skip to content

Commit

Permalink
MDEV-21117 post-push fixes
Browse files Browse the repository at this point in the history
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
  • Loading branch information
andrelkin committed Jun 15, 2021
1 parent e41522d commit 79a2dbc
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 14 deletions.
19 changes: 9 additions & 10 deletions sql/handler.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 4 additions & 0 deletions sql/handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion sql/log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down
2 changes: 1 addition & 1 deletion sql/log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
5 changes: 5 additions & 0 deletions sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions sql/sql_table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -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;
}

Expand Down

0 comments on commit 79a2dbc

Please sign in to comment.