From 2a97416e9b0ad90f99499717331e1acc03d8e097 Mon Sep 17 00:00:00 2001
From: unknown <knielsen@knielsen-hq.org>
Date: Mon, 8 Nov 2010 11:59:39 +0100
Subject: [PATCH] MWL#136: Rename binlog_trx_{file,position} to the much better
 binlog_snapshot_{file,position}

---
 client/mysqldump.c                            | 10 ++++----
 .../suite/binlog/r/binlog_consistent.result   | 24 +++++++++----------
 .../suite/binlog/t/binlog_consistent.test     |  8 +++----
 sql/log.cc                                    | 23 +++++++++---------
 4 files changed, 33 insertions(+), 32 deletions(-)

diff --git a/client/mysqldump.c b/client/mysqldump.c
index bc7f495eb98..1c968553329 100644
--- a/client/mysqldump.c
+++ b/client/mysqldump.c
@@ -1114,8 +1114,8 @@ static int fetch_db_collation(const char *db_name,
 
 /*
   Check if server supports non-blocking binlog position using the
-  binlog_trx_file and binlog_trx_position status variables. If it does,
-  also return the position obtained if output pointers are non-NULL.
+  binlog_snapshot_file and binlog_snapshot_position status variables. If it
+  does, also return the position obtained if output pointers are non-NULL.
   Returns 1 if position available, 0 if not.
 */
 static int
@@ -1126,19 +1126,19 @@ check_consistent_binlog_pos(char *binlog_pos_file, char *binlog_pos_offset)
   int found;
 
   if (mysql_query_with_error_report(mysql, &res,
-                                    "SHOW STATUS LIKE 'binlog_trx_%'"))
+                                    "SHOW STATUS LIKE 'binlog_snapshot_%'"))
     return 1;
 
   found= 0;
   while ((row= mysql_fetch_row(res)))
   {
-    if (0 == strcmp(row[0], "binlog_trx_file"))
+    if (0 == strcmp(row[0], "binlog_snapshot_file"))
     {
       if (binlog_pos_file)
         strmake(binlog_pos_file, row[1], FN_REFLEN-1);
       found++;
     }
-    else if (0 == strcmp(row[0], "binlog_trx_position"))
+    else if (0 == strcmp(row[0], "binlog_snapshot_position"))
     {
       if (binlog_pos_offset)
         strmake(binlog_pos_offset, row[1], LONGLONG_LEN);
diff --git a/mysql-test/suite/binlog/r/binlog_consistent.result b/mysql-test/suite/binlog/r/binlog_consistent.result
index dc479ebe29c..8784d251c5f 100644
--- a/mysql-test/suite/binlog/r/binlog_consistent.result
+++ b/mysql-test/suite/binlog/r/binlog_consistent.result
@@ -4,10 +4,10 @@ CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
 SHOW MASTER STATUS;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	241		
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 Variable_name	Value
-binlog_trx_file	./master-bin.000001
-binlog_trx_position	241
+binlog_snapshot_file	./master-bin.000001
+binlog_snapshot_position	241
 BEGIN;
 INSERT INTO t1 VALUES (0, "");
 # Connection con1
@@ -35,10 +35,10 @@ COMMIT;
 SELECT * FROM t1 ORDER BY a,b;
 a	b
 0	
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 Variable_name	Value
-binlog_trx_file	./master-bin.000001
-binlog_trx_position	540
+binlog_snapshot_file	./master-bin.000001
+binlog_snapshot_position	540
 SHOW MASTER STATUS;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000001	727		
@@ -57,18 +57,18 @@ FLUSH LOGS;
 SELECT * FROM t1 ORDER BY a,b;
 a	b
 0	
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 Variable_name	Value
-binlog_trx_file	./master-bin.000001
-binlog_trx_position	540
+binlog_snapshot_file	./master-bin.000001
+binlog_snapshot_position	540
 SHOW MASTER STATUS;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000002	106		
 COMMIT;
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 Variable_name	Value
-binlog_trx_file	./master-bin.000002
-binlog_trx_position	106
+binlog_snapshot_file	./master-bin.000002
+binlog_snapshot_position	106
 SHOW MASTER STATUS;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB
 master-bin.000002	106		
diff --git a/mysql-test/suite/binlog/t/binlog_consistent.test b/mysql-test/suite/binlog/t/binlog_consistent.test
index b1df7e45678..21e8ac111d4 100644
--- a/mysql-test/suite/binlog/t/binlog_consistent.test
+++ b/mysql-test/suite/binlog/t/binlog_consistent.test
@@ -17,7 +17,7 @@ connection default;
 
 CREATE TABLE t1 (a INT, b VARCHAR(100), PRIMARY KEY (a,b)) ENGINE=innodb;
 SHOW MASTER STATUS;
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 BEGIN;
 INSERT INTO t1 VALUES (0, "");
 
@@ -56,7 +56,7 @@ COMMIT;
 connection default;
 --echo # Connection default
 SELECT * FROM t1 ORDER BY a,b;
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 SHOW MASTER STATUS;
 SELECT * FROM t2 ORDER BY a;
 
@@ -76,10 +76,10 @@ FLUSH LOGS;
 connection default;
 --echo # Connection default
 SELECT * FROM t1 ORDER BY a,b;
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 SHOW MASTER STATUS;
 COMMIT;
-SHOW STATUS LIKE 'binlog_trx_%';
+SHOW STATUS LIKE 'binlog_snapshot_%';
 SHOW MASTER STATUS;
 
 --replace_regex /\/\* xid=.* \*\//\/* XID *\// /Server ver: .*, Binlog ver: .*/Server ver: #, Binlog ver: #/ /table_id: [0-9]+/table_id: #/
diff --git a/sql/log.cc b/sql/log.cc
index 5b3264986c1..fb42b42e0cb 100644
--- a/sql/log.cc
+++ b/sql/log.cc
@@ -6600,8 +6600,8 @@ mysql_bin_log_commit_pos(THD *thd, ulonglong *out_pos, const char **out_file)
 
 static ulonglong binlog_status_var_num_commits;
 static ulonglong binlog_status_var_num_group_commits;
-static char binlog_trx_file[FN_REFLEN];
-static ulonglong binlog_trx_position;
+static char binlog_snapshot_file[FN_REFLEN];
+static ulonglong binlog_snapshot_position;
 
 static SHOW_VAR binlog_status_vars_detail[]=
 {
@@ -6609,10 +6609,10 @@ static SHOW_VAR binlog_status_vars_detail[]=
     (char *)&binlog_status_var_num_commits, SHOW_LONGLONG},
   {"group_commits",
     (char *)&binlog_status_var_num_group_commits, SHOW_LONGLONG},
-  {"trx_file",
-    (char *)&binlog_trx_file, SHOW_CHAR},
-  {"trx_position",
-   (char *)&binlog_trx_position, SHOW_LONGLONG},
+  {"snapshot_file",
+    (char *)&binlog_snapshot_file, SHOW_CHAR},
+  {"snapshot_position",
+   (char *)&binlog_snapshot_position, SHOW_LONGLONG},
   {NullS, NullS, SHOW_LONG}
 };
 
@@ -6671,16 +6671,17 @@ TC_LOG_BINLOG::set_status_variables(THD *thd)
   binlog_status_var_num_group_commits= this->num_group_commits;
   if (!trx_data || 0 == strcmp(trx_data->last_commit_pos_file, ""))
   {
-    strmake(binlog_trx_file, last_commit_pos_file, sizeof(binlog_trx_file)-1);
-    binlog_trx_position= last_commit_pos_offset;
+    strmake(binlog_snapshot_file, last_commit_pos_file,
+            sizeof(binlog_snapshot_file)-1);
+    binlog_snapshot_position= last_commit_pos_offset;
   }
   pthread_mutex_unlock(&LOCK_commit_ordered);
 
   if (trx_data && 0 != strcmp(trx_data->last_commit_pos_file, ""))
   {
-    strmake(binlog_trx_file, trx_data->last_commit_pos_file,
-            sizeof(binlog_trx_file)-1);
-    binlog_trx_position= trx_data->last_commit_pos_offset;
+    strmake(binlog_snapshot_file, trx_data->last_commit_pos_file,
+            sizeof(binlog_snapshot_file)-1);
+    binlog_snapshot_position= trx_data->last_commit_pos_offset;
   }
 }
 
-- 
2.30.9