Skip to content

Commit

Permalink
cleanup: don't use thd->set_current_time() directly
Browse files Browse the repository at this point in the history
  • Loading branch information
vuvova authored and midenok committed Jan 9, 2018
1 parent d20d7a9 commit c92bf28
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 17 deletions.
2 changes: 1 addition & 1 deletion sql/event_queue.cc
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ Event_queue::get_top_for_execution_if_time(THD *thd,

top= (Event_queue_element*) queue_top(&queue);

thd->set_current_time(); /* Get current time */
thd->set_start_time(); /* Get current time */

next_activation_at= top->execute_at;
if (next_activation_at > thd->query_start())
Expand Down
15 changes: 2 additions & 13 deletions sql/log_event.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12507,13 +12507,7 @@ Rows_log_event::write_row(rpl_group_info *rgi,
bitmap_set_bit(table->read_set, table->vers_start_field()->field_index);
// Check whether a row came from unversioned table and fix vers fields.
if (table->vers_start_field()->get_timestamp(&sec_part) == 0 && sec_part == 0)
{
bitmap_set_bit(table->write_set, table->vers_start_field()->field_index);
bitmap_set_bit(table->write_set, table->vers_end_field()->field_index);
thd->set_current_time();
table->vers_start_field()->set_time();
table->vers_end_field()->set_max();
}
table->vers_update_fields();
}

/*
Expand Down Expand Up @@ -13706,12 +13700,7 @@ Update_rows_log_event::do_exec_row(rpl_group_info *rgi)

m_table->mark_columns_per_binlog_row_image();
if (m_vers_from_plain && m_table->versioned(VERS_TIMESTAMP))
{
bitmap_set_bit(m_table->write_set,
m_table->vers_start_field()->field_index);
thd->set_current_time();
m_table->vers_start_field()->set_time();
}
m_table->vers_update_fields();
error= m_table->file->ha_update_row(m_table->record[1], m_table->record[0]);
if (error == HA_ERR_RECORD_IS_THE_SAME)
error= 0;
Expand Down
5 changes: 4 additions & 1 deletion sql/sql_class.h
Original file line number Diff line number Diff line change
Expand Up @@ -3376,6 +3376,7 @@ class THD :public Statement,
{ query_start_sec_part_used=1; return start_time_sec_part; }
MYSQL_TIME query_start_TIME();

private:
void start_time_inc()
{
++start_time_sec_part;
Expand All @@ -3392,7 +3393,7 @@ class THD :public Statement,
start_time > secs;
}

inline void set_current_time()
void set_current_time()
{
my_hrtime_t hrtime= my_hrtime();
my_time_t secs= hrtime_to_my_time(hrtime);
Expand All @@ -3408,6 +3409,8 @@ class THD :public Statement,
}
PSI_CALL_set_thread_start_time(start_time);
}

public:
inline void set_start_time()
{
if (user_time.val)
Expand Down
2 changes: 1 addition & 1 deletion sql/sql_insert.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2938,7 +2938,7 @@ pthread_handler_t handle_delayed_insert(void *arg)

pthread_detach_this_thread();
/* Add thread to THD list so that's it's visible in 'show processlist' */
thd->set_current_time();
thd->set_start_time();
add_to_active_threads(thd);
if (abort_loop)
thd->set_killed(KILL_CONNECTION);
Expand Down
2 changes: 1 addition & 1 deletion sql/table.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8621,7 +8621,7 @@ bool TR_table::update(ulonglong start_id, ulonglong end_id)
return true;

timeval start_time= {thd->start_time, long(thd->start_time_sec_part)};
thd->set_current_time();
thd->set_start_time();
timeval end_time= {thd->start_time, long(thd->start_time_sec_part)};
store(FLD_TRX_ID, start_id);
store(FLD_COMMIT_ID, end_id);
Expand Down

0 comments on commit c92bf28

Please sign in to comment.