summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <knielsen@knielsen-hq.org>2011-01-27 16:54:49 +0100
committerunknown <knielsen@knielsen-hq.org>2011-01-27 16:54:49 +0100
commit49dd89fcc91c80809e58111531755ef1d8f5b280 (patch)
treedda2937a68999383c43db6dbefc713710b03629d
parentbd8942070bf70decafa41996a2260da2c309b4e1 (diff)
parentcf2a7c5b5e9ebdd3e2a4c598ea08cdd6949fd313 (diff)
downloadmariadb-git-49dd89fcc91c80809e58111531755ef1d8f5b280.tar.gz
Merge fix for lp:697174
-rw-r--r--mysql-test/suite/binlog/r/binlog_consistent.result8
-rw-r--r--sql/log.cc24
2 files changed, 22 insertions, 10 deletions
diff --git a/mysql-test/suite/binlog/r/binlog_consistent.result b/mysql-test/suite/binlog/r/binlog_consistent.result
index 4561bd70995..428b828d699 100644
--- a/mysql-test/suite/binlog/r/binlog_consistent.result
+++ b/mysql-test/suite/binlog/r/binlog_consistent.result
@@ -6,7 +6,7 @@ File Position Binlog_Do_DB Binlog_Ignore_DB
master-bin.000001 375
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file ./master-bin.000001
+binlog_snapshot_file master-bin.000001
binlog_snapshot_position 375
BEGIN;
INSERT INTO t1 VALUES (0, "");
@@ -37,7 +37,7 @@ a b
0
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file ./master-bin.000001
+binlog_snapshot_file master-bin.000001
binlog_snapshot_position 674
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
@@ -59,7 +59,7 @@ a b
0
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file ./master-bin.000001
+binlog_snapshot_file master-bin.000001
binlog_snapshot_position 674
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
@@ -67,7 +67,7 @@ master-bin.000002 240
COMMIT;
SHOW STATUS LIKE 'binlog_snapshot_%';
Variable_name Value
-binlog_snapshot_file ./master-bin.000002
+binlog_snapshot_file master-bin.000002
binlog_snapshot_position 240
SHOW MASTER STATUS;
File Position Binlog_Do_DB Binlog_Ignore_DB
diff --git a/sql/log.cc b/sql/log.cc
index 8a9ed1906c7..802b1e46c39 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -6719,6 +6719,18 @@ static struct st_mysql_sys_var *binlog_sys_vars[]=
/*
+ 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
information_schema.global_status.
@@ -6734,21 +6746,21 @@ 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, ""));
pthread_mutex_lock(&LOCK_commit_ordered);
binlog_status_var_num_commits= this->num_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,
- sizeof(binlog_snapshot_file)-1);
+ set_binlog_snapshot_file(last_commit_pos_file);
binlog_snapshot_position= last_commit_pos_offset;
}
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,
- sizeof(binlog_snapshot_file)-1);
+ set_binlog_snapshot_file(trx_data->last_commit_pos_file);
binlog_snapshot_position= trx_data->last_commit_pos_offset;
}
}