Commit 49dd89fc authored by unknown's avatar unknown

Merge fix for lp:697174

parents bd894207 cf2a7c5b
...@@ -6,7 +6,7 @@ File Position Binlog_Do_DB Binlog_Ignore_DB ...@@ -6,7 +6,7 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 375 master-bin.000001 375
SHOW STATUS LIKE 'binlog_snapshot_%'; SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value Variable_name Value
binlog_snapshot_file ./master-bin.000001 binlog_snapshot_file master-bin.000001
binlog_snapshot_position 375 binlog_snapshot_position 375
BEGIN; BEGIN;
INSERT INTO t1 VALUES (0, ""); INSERT INTO t1 VALUES (0, "");
...@@ -37,7 +37,7 @@ a b ...@@ -37,7 +37,7 @@ a b
0 0
SHOW STATUS LIKE 'binlog_snapshot_%'; SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value Variable_name Value
binlog_snapshot_file ./master-bin.000001 binlog_snapshot_file master-bin.000001
binlog_snapshot_position 674 binlog_snapshot_position 674
SHOW MASTER STATUS; SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
...@@ -59,7 +59,7 @@ a b ...@@ -59,7 +59,7 @@ a b
0 0
SHOW STATUS LIKE 'binlog_snapshot_%'; SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value Variable_name Value
binlog_snapshot_file ./master-bin.000001 binlog_snapshot_file master-bin.000001
binlog_snapshot_position 674 binlog_snapshot_position 674
SHOW MASTER STATUS; SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
...@@ -67,7 +67,7 @@ master-bin.000002 240 ...@@ -67,7 +67,7 @@ master-bin.000002 240
COMMIT; COMMIT;
SHOW STATUS LIKE 'binlog_snapshot_%'; SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value Variable_name Value
binlog_snapshot_file ./master-bin.000002 binlog_snapshot_file master-bin.000002
binlog_snapshot_position 240 binlog_snapshot_position 240
SHOW MASTER STATUS; SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB File Position Binlog_Do_DB Binlog_Ignore_DB
......
...@@ -6718,6 +6718,18 @@ static struct st_mysql_sys_var *binlog_sys_vars[]= ...@@ -6718,6 +6718,18 @@ static struct st_mysql_sys_var *binlog_sys_vars[]=
#endif #endif
/*
Copy out the non-directory part of binlog position filename for the
`binlog_snapshot_file' status variable, same way as it is done for
SHOW MASTER STATUS.
*/
static void
set_binlog_snapshot_file(const char *src)
{
int dir_len = dirname_length(src);
strmake(binlog_snapshot_file, src + dir_len, sizeof(binlog_snapshot_file)-1);
}
/* /*
Copy out current values of status variables, for SHOW STATUS or Copy out current values of status variables, for SHOW STATUS or
information_schema.global_status. information_schema.global_status.
...@@ -6734,21 +6746,21 @@ TC_LOG_BINLOG::set_status_variables(THD *thd) ...@@ -6734,21 +6746,21 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
else else
trx_data= NULL; trx_data= NULL;
bool have_snapshot=
(trx_data && 0 != strcmp(trx_data->last_commit_pos_file, ""));
pthread_mutex_lock(&LOCK_commit_ordered); pthread_mutex_lock(&LOCK_commit_ordered);
binlog_status_var_num_commits= this->num_commits; binlog_status_var_num_commits= this->num_commits;
binlog_status_var_num_group_commits= this->num_group_commits; binlog_status_var_num_group_commits= this->num_group_commits;
if (!trx_data || 0 == strcmp(trx_data->last_commit_pos_file, "")) if (!have_snapshot)
{ {
strmake(binlog_snapshot_file, last_commit_pos_file, set_binlog_snapshot_file(last_commit_pos_file);
sizeof(binlog_snapshot_file)-1);
binlog_snapshot_position= last_commit_pos_offset; binlog_snapshot_position= last_commit_pos_offset;
} }
pthread_mutex_unlock(&LOCK_commit_ordered); pthread_mutex_unlock(&LOCK_commit_ordered);
if (trx_data && 0 != strcmp(trx_data->last_commit_pos_file, "")) if (have_snapshot)
{ {
strmake(binlog_snapshot_file, trx_data->last_commit_pos_file, set_binlog_snapshot_file(trx_data->last_commit_pos_file);
sizeof(binlog_snapshot_file)-1);
binlog_snapshot_position= trx_data->last_commit_pos_offset; binlog_snapshot_position= trx_data->last_commit_pos_offset;
} }
} }
......
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