Commit 13635803 authored by mkaruza's avatar mkaruza Committed by Julius Goryavsky

MDEV-18590: galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch

Replicated events have time associated with them from originating
node which will be used for commit timestamp. Associated time can
be set in past before event is even applied.

For WSREP replication we don't need to use time information from
event.

Addressed review comments:
	  Jan Lindström <jan.lindstrom@galeracluster.com>
Signed-off-by: default avatarJulius Goryavsky <julius.goryavsky@mariadb.com>
parent 1532f120
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
galera_as_slave_ctas : MDEV-28378 timeout galera_as_slave_ctas : MDEV-28378 timeout
galera_pc_recovery : MDEV-25199 cluster fails to start up galera_pc_recovery : MDEV-25199 cluster fails to start up
galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED galera_sequences : MDEV-32561 WSREP FSM failure: no such a transition REPLICATING -> COMMITTED
versioning_trx_id : MDEV-18590 : galera.versioning_trx_id: Test failure: mysqltest: Result content mismatch
galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert() galera_concurrent_ctas : MDEV-32779 galera_concurrent_ctas: assertion in the galera::ReplicatorSMM::finish_cert()
galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() galera_as_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback() galera_slave_replay : MDEV-32780 galera_as_slave_replay: assertion in the wsrep::transaction::before_rollback()
......
...@@ -17,7 +17,7 @@ a ...@@ -17,7 +17,7 @@ a
select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
count(*) count(*)
0 0
select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp;
count(*) count(*)
0 0
connection node_3; connection node_3;
...@@ -34,7 +34,7 @@ a ...@@ -34,7 +34,7 @@ a
select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
count(*) count(*)
0 0
select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp;
count(*) count(*)
0 0
connection node_1; connection node_1;
...@@ -50,7 +50,7 @@ a ...@@ -50,7 +50,7 @@ a
select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
count(*) count(*)
0 0
select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp;
count(*) count(*)
0 0
drop table t1; drop table t1;
......
...@@ -13,29 +13,29 @@ set session wsrep_sync_wait=15; ...@@ -13,29 +13,29 @@ set session wsrep_sync_wait=15;
insert into t1 (a) values (3),(4); insert into t1 (a) values (3),(4);
select a from t1; select a from t1;
select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp`) { if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp`) {
select * from mysql.transaction_registry; select * from mysql.transaction_registry;
} }
select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp;
--connection node_3 --connection node_3
set session wsrep_sync_wait=15; set session wsrep_sync_wait=15;
insert into t1 (a) values (5),(6); insert into t1 (a) values (5),(6);
select a from t1; select a from t1;
select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp`) { if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp`) {
select * from mysql.transaction_registry; select * from mysql.transaction_registry;
} }
select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp;
--connection node_1 --connection node_1
set session wsrep_sync_wait=15; set session wsrep_sync_wait=15;
select a from t1; select a from t1;
select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0'; select count(*) from mysql.transaction_registry where begin_timestamp='0-0-0';
if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp`) { if (`SELECT count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp`) {
select * from mysql.transaction_registry; select * from mysql.transaction_registry;
} }
select count(*) from mysql.transaction_registry where begin_timestamp>=commit_timestamp; select count(*) from mysql.transaction_registry where begin_timestamp>commit_timestamp;
drop table t1; drop table t1;
......
...@@ -5554,6 +5554,9 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi, ...@@ -5554,6 +5554,9 @@ int Query_log_event::do_apply_event(rpl_group_info *rgi,
*/ */
if (is_trans_keyword() || rpl_filter->db_ok(thd->db.str)) if (is_trans_keyword() || 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->set_query_and_id((char*)query_arg, q_len_arg,
thd->charset(), next_query_id()); thd->charset(), next_query_id());
...@@ -7433,6 +7436,9 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi, ...@@ -7433,6 +7436,9 @@ int Load_log_event::do_apply_event(NET* net, rpl_group_info *rgi,
*/ */
if (rpl_filter->db_ok(thd->db.str)) 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->set_query_id(next_query_id());
thd->get_stmt_da()->opt_clear_warning_info(thd->query_id); thd->get_stmt_da()->opt_clear_warning_info(thd->query_id);
...@@ -11629,6 +11635,9 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi) ...@@ -11629,6 +11635,9 @@ int Rows_log_event::do_apply_event(rpl_group_info *rgi)
TIMESTAMP column to a table with one. TIMESTAMP column to a table with one.
So we call set_time(), like in SBR. Presently it changes nothing. 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)) if (m_width == table->s->fields && bitmap_is_set_all(&m_cols))
......
...@@ -31,6 +31,9 @@ ...@@ -31,6 +31,9 @@
#include "log_event_old.h" #include "log_event_old.h"
#include "rpl_record_old.h" #include "rpl_record_old.h"
#include "transaction.h" #include "transaction.h"
#ifdef WITH_WSREP
#include "wsrep_mysqld.h"
#endif /* WITH_WSREP */
#if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION) #if !defined(MYSQL_CLIENT) && defined(HAVE_REPLICATION)
...@@ -203,6 +206,9 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi) ...@@ -203,6 +206,9 @@ Old_rows_log_event::do_apply_event(Old_rows_log_event *ev, rpl_group_info *rgi)
TIMESTAMP column to a table with one. TIMESTAMP column to a table with one.
So we call set_time(), like in SBR. Presently it changes nothing. So we call set_time(), like in SBR. Presently it changes nothing.
*/ */
#ifdef WITH_WSREP
if (!wsrep_thd_is_applying(thd))
#endif
ev_thd->set_time(ev->when, ev->when_sec_part); ev_thd->set_time(ev->when, ev->when_sec_part);
/* /*
There are a few flags that are replicated with each row event. There are a few flags that are replicated with each row event.
...@@ -1507,6 +1513,9 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi) ...@@ -1507,6 +1513,9 @@ int Old_rows_log_event::do_apply_event(rpl_group_info *rgi)
TIMESTAMP column to a table with one. TIMESTAMP column to a table with one.
So we call set_time(), like in SBR. Presently it changes nothing. 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);
/* /*
There are a few flags that are replicated with each row event. There are a few flags that are replicated with each row event.
......
...@@ -182,16 +182,7 @@ int wsrep_apply_events(THD* thd, ...@@ -182,16 +182,7 @@ int wsrep_apply_events(THD* thd,
/* Use the original server id for logging. */ /* Use the original server id for logging. */
thd->set_server_id(ev->server_id); thd->set_server_id(ev->server_id);
thd->set_time(); // time the query
thd->transaction.start_time.reset(thd);
thd->lex->current_select= 0; thd->lex->current_select= 0;
if (!ev->when)
{
my_hrtime_t hrtime= my_hrtime();
ev->when= hrtime_to_my_time(hrtime);
ev->when_sec_part= hrtime_sec_part(hrtime);
}
thd->variables.option_bits= thd->variables.option_bits=
(thd->variables.option_bits & ~OPTION_SKIP_REPLICATION) | (thd->variables.option_bits & ~OPTION_SKIP_REPLICATION) |
(ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0); (ev->flags & LOG_EVENT_SKIP_REPLICATION_F ? OPTION_SKIP_REPLICATION : 0);
......
...@@ -197,6 +197,7 @@ int Wsrep_high_priority_service::start_transaction( ...@@ -197,6 +197,7 @@ int Wsrep_high_priority_service::start_transaction(
const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta) const wsrep::ws_handle& ws_handle, const wsrep::ws_meta& ws_meta)
{ {
DBUG_ENTER(" Wsrep_high_priority_service::start_transaction"); DBUG_ENTER(" Wsrep_high_priority_service::start_transaction");
m_thd->set_time();
DBUG_RETURN(m_thd->wsrep_cs().start_transaction(ws_handle, ws_meta) || DBUG_RETURN(m_thd->wsrep_cs().start_transaction(ws_handle, ws_meta) ||
trans_begin(m_thd)); trans_begin(m_thd));
} }
...@@ -391,6 +392,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta, ...@@ -391,6 +392,7 @@ int Wsrep_high_priority_service::apply_toi(const wsrep::ws_meta& ws_meta,
};); };);
#endif #endif
thd->set_time();
int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size()); int ret= wsrep_apply_events(thd, m_rli, data.data(), data.size());
if (ret != 0 || thd->wsrep_has_ignored_error) if (ret != 0 || thd->wsrep_has_ignored_error)
{ {
......
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