MDEV-35157 : wrong binlog timestamps on secondary nodes of a galera cluster

Problem was missing thd->set_time() before binlog event
execution in wsrep_apply_events.

Removed part of earlier commit 1363580 because it had
nothing to do with VERSIONED tables.

Note that this commit does not contain mtr-testcase
because actual timestamps on binlog file depends the
actual time when events are executed and how long
their execution takes.

Signed-off-by: Julius Goryavsky <julius.goryavsky@mariadb.com>
This commit is contained in:
Jan Lindström 2024-10-30 09:37:10 +02:00 committed by Julius Goryavsky
parent db68eb69f9
commit 4b38af06a4
3 changed files with 14 additions and 14 deletions

View File

@ -1721,10 +1721,7 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
Gtid_log_event::FL_COMPLETED_XA))) ||
rpl_filter->db_ok(thd->db.str))
{
#ifdef WITH_WSREP
if (!wsrep_thd_is_applying(thd))
#endif
thd->set_time(when, when_sec_part);
thd->set_time(when, when_sec_part);
thd->set_query_and_id((char*)query_arg, q_len_arg,
thd->charset(), next_query_id());
thd->variables.pseudo_thread_id= thread_id; // for temp tables
@ -2863,10 +2860,7 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
*/
if (rpl_filter->db_ok(thd->db.str))
{
#ifdef WITH_WSREP
if (!wsrep_thd_is_applying(thd))
#endif
thd->set_time(when, when_sec_part);
thd->set_time(when, when_sec_part);
thd->set_query_id(next_query_id());
thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
@ -5701,10 +5695,7 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
TIMESTAMP column to a table with one.
So we call set_time(), like in SBR. Presently it changes nothing.
*/
#ifdef WITH_WSREP
if (!wsrep_thd_is_applying(thd))
#endif
thd->set_time(when, when_sec_part);
thd->set_time(when, when_sec_part);
if (m_width == table->s->fields && bitmap_is_set_all(&m_cols))
set_flags(COMPLETE_ROWS_F);

View File

@ -1,4 +1,4 @@
/* Copyright (C) 2013-2019 Codership Oy <info@codership.com>
/* Copyright (C) 2013-2024 Codership Oy <info@codership.com>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -211,7 +211,17 @@ int wsrep_apply_events(THD* thd,
}
ev->thd= thd;
thd->set_time();
if (!ev->when)
{
my_hrtime_t hrtime= my_hrtime();
ev->when= hrtime_to_my_time(hrtime);
ev->when_sec_part= hrtime_sec_part(hrtime);
}
exec_res= ev->apply_event(thd->wsrep_rgi);
DBUG_PRINT("info", ("exec_event result: %d", exec_res));
if (exec_res)

View File

@ -215,7 +215,6 @@ int Wsrep_high_priority_service::start_transaction(
const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta)
{
DBUG_ENTER(" Wsrep_high_priority_service::start_transaction");
m_thd->set_time();
DBUG_RETURN(m_thd->wsrep_cs().start_transaction(ws_handle, ws_meta) ||
trans_begin(m_thd));
}