summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniele Sciascia <daniele.sciascia@galeracluster.com>2016-07-14 14:29:59 +0200
committerNirbhay Choubey <nirbhay@mariadb.com>2016-07-25 21:37:15 -0400
commit7431368eafb3e531ba3926e85cc515778f6b5e2f (patch)
tree8f21c501bcebd6274e6be5a731e8f004b5190133
parentcbc8a84fa2e65cad7561fa53799ca0273e8a5ff5 (diff)
downloadmariadb-git-7431368eafb3e531ba3926e85cc515778f6b5e2f.tar.gz
MW-292 Reset timestamp after transaction replay
Transaction replay causes the THD to re-apply the replication events from execution, using the same path appliers do. While applying the log events, the THD's timestamp is set to the timestamp of the event. Setting the timestamp explicitly causes function NOW() to always the timestamp that was set. To avoid this behavior we reset the timestamp after replaying is done.
-rw-r--r--sql/sql_class.h1
-rw-r--r--sql/wsrep_thd.cc2
2 files changed, 3 insertions, 0 deletions
diff --git a/sql/sql_class.h b/sql/sql_class.h
index 9ee5a40dc99..bf3d043cc1a 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -68,6 +68,7 @@ struct wsrep_thd_shadow {
ulong tx_isolation;
char *db;
size_t db_length;
+ my_hrtime_t user_time;
};
#endif
class Reprepare_observer;
diff --git a/sql/wsrep_thd.cc b/sql/wsrep_thd.cc
index 464a68a8221..9c2fa4ba856 100644
--- a/sql/wsrep_thd.cc
+++ b/sql/wsrep_thd.cc
@@ -160,6 +160,7 @@ static void wsrep_prepare_bf_thd(THD *thd, struct wsrep_thd_shadow* shadow)
shadow->db = thd->db;
shadow->db_length = thd->db_length;
+ shadow->user_time = thd->user_time;
thd->reset_db(NULL, 0);
}
@@ -170,6 +171,7 @@ static void wsrep_return_from_bf_mode(THD *thd, struct wsrep_thd_shadow* shadow)
thd->wsrep_exec_mode = shadow->wsrep_exec_mode;
thd->net.vio = shadow->vio;
thd->variables.tx_isolation = shadow->tx_isolation;
+ thd->user_time = shadow->user_time;
thd->reset_db(shadow->db, shadow->db_length);
delete thd->system_thread_info.rpl_sql_info;