Skip to content

Commit

Permalink
MW-292 Reset timestamp after transaction replay
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sciascid authored and Nirbhay Choubey committed Aug 10, 2016
1 parent 38a0def commit 9a809fe
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct wsrep_thd_shadow {
ulong tx_isolation;
char *db;
size_t db_length;
my_hrtime_t user_time;
};
#endif
class Reprepare_observer;
Expand Down
2 changes: 2 additions & 0 deletions sql/wsrep_thd.cc
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,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);
}

Expand All @@ -137,6 +138,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);

thd->wsrep_rli->cleanup_after_session();
Expand Down

0 comments on commit 9a809fe

Please sign in to comment.