Commit 09bd2894 authored by unknown's avatar unknown

Merge MWL#136 after-review fixes into mariadb-5.2-rpl

parents 92dfbd42 6c8a23c8
......@@ -155,7 +155,7 @@ public:
using_xa(FALSE), xa_xid(0)
{
trans_log.end_of_file= max_binlog_cache_size;
strcpy(last_commit_pos_file, "");
last_commit_pos_file[0]= 0;
}
~binlog_trx_data()
......@@ -213,7 +213,7 @@ public:
incident= FALSE;
trans_log.end_of_file= max_binlog_cache_size;
using_xa= FALSE;
strcpy(last_commit_pos_file, "");
last_commit_pos_file[0]= 0;
last_commit_pos_offset= 0;
DBUG_ASSERT(empty());
}
......@@ -4388,6 +4388,10 @@ MYSQL_BIN_LOG::flush_and_set_pending_rows_event(THD *thd,
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
}
/*
Take mutex to protect against a reader seeing partial writes of 64-bit
offset on 32-bit CPUs.
*/
pthread_mutex_lock(&LOCK_commit_ordered);
last_commit_pos_offset= my_b_tell(&log_file);
pthread_mutex_unlock(&LOCK_commit_ordered);
......@@ -4607,8 +4611,13 @@ bool MYSQL_BIN_LOG::write(Log_event *event_info, my_bool *with_annotate)
err_unlock:
if (file == &log_file)
{
my_off_t offset= my_b_tell(&log_file);
/*
Take mutex to protect against a reader seeing partial writes of 64-bit
offset on 32-bit CPUs.
*/
pthread_mutex_lock(&LOCK_commit_ordered);
last_commit_pos_offset= my_b_tell(&log_file);
last_commit_pos_offset= offset;
pthread_mutex_unlock(&LOCK_commit_ordered);
pthread_mutex_unlock(&LOCK_log);
}
......@@ -4906,6 +4915,7 @@ int query_error_code(THD *thd, bool not_killed)
bool MYSQL_BIN_LOG::write_incident(THD *thd)
{
uint error= 0;
my_off_t offset;
DBUG_ENTER("MYSQL_BIN_LOG::write_incident");
Incident incident= INCIDENT_LOST_EVENTS;
Incident_log_event ev(thd, incident, write_error_msg);
......@@ -4921,8 +4931,13 @@ bool MYSQL_BIN_LOG::write_incident(THD *thd)
rotate_and_purge(RP_LOCK_LOG_IS_ALREADY_LOCKED);
}
}
offset= my_b_tell(&log_file);
/*
Take mutex to protect against a reader seeing partial writes of 64-bit
offset on 32-bit CPUs.
*/
pthread_mutex_lock(&LOCK_commit_ordered);
last_commit_pos_offset= my_b_tell(&log_file);
last_commit_pos_offset= offset;
pthread_mutex_unlock(&LOCK_commit_ordered);
pthread_mutex_unlock(&LOCK_log);
......@@ -6734,8 +6749,7 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
else
trx_data= NULL;
bool have_snapshot=
(trx_data && 0 != strcmp(trx_data->last_commit_pos_file, ""));
bool have_snapshot= (trx_data && trx_data->last_commit_pos_file[0] != 0);
pthread_mutex_lock(&LOCK_commit_ordered);
binlog_status_var_num_commits= this->num_commits;
binlog_status_var_num_group_commits= this->num_group_commits;
......
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