[Commits] Rev 2902: Merge fix for lp:697174 in http://bazaar.launchpad.net/~maria-captains/maria/5.2

knielsen at knielsen-hq.org knielsen at knielsen-hq.org
Thu Jan 27 17:54:55 EET 2011


At http://bazaar.launchpad.net/~maria-captains/maria/5.2

------------------------------------------------------------
revno: 2902 [merge]
revision-id: knielsen at knielsen-hq.org-20110127155449-yzsqhc97ypcrmhwy
parent: knielsen at knielsen-hq.org-20110127145644-dxfpvvf85i3hqoxi
parent: knielsen at knielsen-hq.org-20110127155111-2kp6ohampq91ewl4
committer: knielsen at knielsen-hq.org
branch nick: work-5.2-rpl
timestamp: Thu 2011-01-27 16:54:49 +0100
message:
  Merge fix for lp:697174
modified:
  mysql-test/suite/binlog/r/binlog_consistent.result binlog_consistent.re-20101105120739-ojgp0zizzli5dgjq-1
  sql/log.cc                     sp1f-log.cc-19700101030959-r3hdfovek4kl6nd64ovoaknmirota6bq
=== modified file 'mysql-test/suite/binlog/r/binlog_consistent.result'
--- a/mysql-test/suite/binlog/r/binlog_consistent.result	2011-01-27 14:56:44 +0000
+++ b/mysql-test/suite/binlog/r/binlog_consistent.result	2011-01-27 15:54:49 +0000
@@ -6,7 +6,7 @@ File	Position	Binlog_Do_DB	Binlog_Ignore
 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

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2011-01-27 14:56:00 +0000
+++ b/sql/log.cc	2011-01-27 15:54:49 +0000
@@ -6719,6 +6719,18 @@ static struct st_mysql_sys_var *binlog_s
 
 
 /*
+  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 
   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;
   }
 }



More information about the commits mailing list