#At file:///D:/source/bzr/mysql-6.0-bug-35585/ based on revid:charles.bell@stripped
2810 Chuck Bell 2009-05-13
BUG#35585 : Online backup: Apparent synonyms for binlog start_position
There are synonyms used in the backup code, tests, and logs
that refer to the binlog start position as 'binlog_pos'. This
is confusing and should be changed to match the documentation
and general practice of replication and binary logs.
This patch changes the backup code, tests, and logs such that
all 'backup_pos[..]' that reference the binlog start position
have been changed to 'backup_start_pos' and where 'binlog_pos'
is used to refer to both the binlog file and binlog start
position have been changed to 'binlog_info'.
modified:
client/backup_stream.c
client/mysqlbackup.cc
mysql-test/suite/backup/r/backup.result
mysql-test/suite/backup/r/backup_logs.result
mysql-test/suite/backup/t/backup.test
mysql-test/suite/backup_ptr/r/backup_ptr_commits.result
mysql-test/suite/backup_ptr/t/backup_ptr.test
mysql-test/suite/backup_ptr/t/backup_ptr_commits.test
mysql-test/suite/backup_ptr/t/backup_ptr_objects.test
mysql-test/suite/rpl/r/rpl_backup_extra.result
mysql-test/suite/rpl/t/rpl_backup_extra.test
mysql-test/suite/rpl/t/rpl_backup_ptr.test
scripts/mysql_system_tables.sql
scripts/mysql_system_tables_fix.sql
sql/backup/data_backup.cc
sql/backup/image_info.cc
sql/backup/image_info.h
sql/backup/kernel.cc
sql/backup/logger.h
sql/backup/stream_v1.c
sql/backup/stream_v1.h
sql/log.cc
sql/log.h
sql/si_logs.cc
sql/si_logs.h
per-file messages:
client/backup_stream.c
Changed code to use 'binlog_info' instead of 'binlog_pos'.
client/mysqlbackup.cc
Changed code to use 'binlog_info' instead of 'binlog_pos'.
mysql-test/suite/backup/r/backup.result
Corrected test result with 'binlog_start_pos'.
mysql-test/suite/backup/t/backup.test
Corrected test with 'binlog_start_pos' instead of
'binlog_pos'.
mysql-test/suite/backup_ptr/r/backup_ptr_commits.result
Corrected test result with 'binlog_start_pos'.
mysql-test/suite/backup_ptr/t/backup_ptr.test
Corrected test with 'binlog_start_pos' instead of
'binlog_pos'.
mysql-test/suite/backup_ptr/t/backup_ptr_commits.test
Corrected test result with 'binlog_start_pos'.Corrected test with 'binlog_start_pos' instead of
'binlog_pos'.
mysql-test/suite/backup_ptr/t/backup_ptr_objects.test
Corrected test with 'binlog_start_pos' instead of
'binlog_pos'.
mysql-test/suite/rpl/r/rpl_backup_extra.result
Corrected test result with 'binlog_start_pos'.
mysql-test/suite/rpl/t/rpl_backup_extra.test
Corrected test with 'binlog_start_pos' instead of
'binlog_pos'.
mysql-test/suite/rpl/t/rpl_backup_ptr.test
Corrected test with 'binlog_start_pos' instead of
'binlog_pos'.
scripts/mysql_system_tables.sql
Changed 'binlog_pos' to 'binlog_start_pos' for log.
scripts/mysql_system_tables_fix.sql
Changed 'binlog_pos' to 'binlog_start_pos' for log.
sql/backup/data_backup.cc
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
Changed to use rename of 'master_pos' to 'master_binlog_pos'.
sql/backup/image_info.cc
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
Changed to use rename of 'master_pos' to 'master_binlog_pos'.
sql/backup/image_info.h
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
Changed to use rename of 'master_pos' to 'master_binlog_pos'.
Changed method names accordingly.
sql/backup/kernel.cc
Changed code to use 'binlog_info' instead of 'binlog_pos'.
sql/backup/logger.h
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
Changed to use rename of 'master_pos' to 'master_binlog_pos'.
Changed method names accordingly.
sql/backup/stream_v1.c
Changed code to use 'binlog_info' instead of 'binlog_pos'.
sql/backup/stream_v1.h
Changed code to use 'binlog_info' instead of 'binlog_pos'.
sql/log.cc
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
sql/log.h
Changed enum to match code and log file changes.
sql/si_logs.cc
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
sql/si_logs.h
Changed code to use 'binlog_start_pos' instead of 'binlog_pos'.
=== modified file 'client/backup_stream.c'
--- a/client/backup_stream.c 2009-02-27 09:46:43 +0000
+++ b/client/backup_stream.c 2009-05-13 20:08:02 +0000
@@ -1930,8 +1930,8 @@ backup_catalog_free(struct st_backup_cat
/* Header, binlog file. */
DBUG_PRINT("bupstrm", ("freeing header, binlog file."));
- if (hdr->binlog_pos.file)
- bstream_free(hdr->binlog_pos.file);
+ if (hdr->binlog_info.file)
+ bstream_free(hdr->binlog_info.file);
/* Header, server version. */
DBUG_PRINT("bupstrm", ("freeing header, server version."));
=== modified file 'client/mysqlbackup.cc'
--- a/client/mysqlbackup.cc 2009-02-27 09:46:43 +0000
+++ b/client/mysqlbackup.cc 2009-05-13 20:08:02 +0000
@@ -1416,8 +1416,8 @@ print_summary(struct st_backup_catalog *
if (hdr->flags & BSTREAM_FLAG_BINLOG)
{
printf("Binlog coordinates: %s:%lu\n",
- hdr->binlog_pos.file ? hdr->binlog_pos.file : "[NULL]",
- hdr->binlog_pos.pos);
+ hdr->binlog_info.file ? hdr->binlog_info.file : "[NULL]",
+ hdr->binlog_info.pos);
printf("Binlog group coords: %s:%lu\n",
hdr->binlog_group.file ? hdr->binlog_group.file : "[NULL]",
hdr->binlog_group.pos);
=== modified file 'mysql-test/suite/backup/r/backup.result'
--- a/mysql-test/suite/backup/r/backup.result 2009-02-20 09:31:52 +0000
+++ b/mysql-test/suite/backup/r/backup.result 2009-05-13 20:08:02 +0000
@@ -53,7 +53,7 @@ SELECT validity_point_time FROM mysql.ba
WHERE backup_id = @bid INTO @vp_time;
SELECT binlog_file FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_file;
-SELECT binlog_pos FROM mysql.backup_history
+SELECT binlog_start_pos FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_pos;
DROP DATABASE db1;
DROP DATABASE db2;
@@ -123,10 +123,10 @@ tasking CREATE TABLE `tasking` (
) ENGINE=BLACKHOLE DEFAULT CHARSET=latin1
SELECT validity_point_time = @vp_time,
binlog_file = @vp_file,
-binlog_pos = @vp_pos
+binlog_start_pos = @vp_pos
FROM mysql.backup_history
WHERE backup_id = @bid;
-validity_point_time = @vp_time binlog_file = @vp_file binlog_pos = @vp_pos
+validity_point_time = @vp_time binlog_file = @vp_file binlog_start_pos = @vp_pos
1 1 1
DROP DATABASE db1;
DROP DATABASE db2;
@@ -141,7 +141,7 @@ SELECT validity_point_time FROM mysql.ba
WHERE backup_id = @bid INTO @vp_time;
SELECT binlog_file FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_file;
-SELECT binlog_pos FROM mysql.backup_history
+SELECT binlog_start_pos FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_pos;
DROP DATABASE db1;
RESTORE FROM 'db1.bkp';
@@ -150,10 +150,10 @@ backup_id
SELECT MAX(backup_id) FROM mysql.backup_history INTO @bid;
SELECT validity_point_time = @vp_time,
binlog_file = @vp_file,
-binlog_pos = @vp_pos
+binlog_start_pos = @vp_pos
FROM mysql.backup_history
WHERE backup_id = @bid;
-validity_point_time = @vp_time binlog_file = @vp_file binlog_pos = @vp_pos
+validity_point_time = @vp_time binlog_file = @vp_file binlog_start_pos = @vp_pos
1 1 1
DROP DATABASE db1;
DROP DATABASE IF EXISTS bup_default;
=== modified file 'mysql-test/suite/backup/r/backup_logs.result'
--- a/mysql-test/suite/backup/r/backup_logs.result 2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup/r/backup_logs.result 2009-05-13 20:08:02 +0000
@@ -245,7 +245,7 @@ log_backup_output FILE,TABLE
SELECT * FROM mysql.backup_history WHERE backup_id = 500;;
backup_id #
process_id #
-binlog_pos #
+binlog_start_pos #
binlog_file #
backup_state complete
operation backup
@@ -314,7 +314,7 @@ timediff(now(),@start_restore) > 5
SELECT * FROM mysql.backup_history WHERE backup_id = 501;;
backup_id #
process_id #
-binlog_pos #
+binlog_start_pos #
binlog_file #
backup_state complete
operation restore
=== modified file 'mysql-test/suite/backup/t/backup.test'
--- a/mysql-test/suite/backup/t/backup.test 2009-02-24 20:57:21 +0000
+++ b/mysql-test/suite/backup/t/backup.test 2009-05-13 20:08:02 +0000
@@ -132,7 +132,7 @@ SELECT validity_point_time FROM mysql.ba
WHERE backup_id = @bid INTO @vp_time;
SELECT binlog_file FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_file;
-SELECT binlog_pos FROM mysql.backup_history
+SELECT binlog_start_pos FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_pos;
DROP DATABASE db1;
@@ -180,7 +180,7 @@ SHOW CREATE TABLE tasking;
SELECT validity_point_time = @vp_time,
binlog_file = @vp_file,
- binlog_pos = @vp_pos
+ binlog_start_pos = @vp_pos
FROM mysql.backup_history
WHERE backup_id = @bid;
@@ -209,7 +209,7 @@ SELECT validity_point_time FROM mysql.ba
WHERE backup_id = @bid INTO @vp_time;
SELECT binlog_file FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_file;
-SELECT binlog_pos FROM mysql.backup_history
+SELECT binlog_start_pos FROM mysql.backup_history
WHERE backup_id = @bid INTO @vp_pos;
DROP DATABASE db1;
@@ -226,7 +226,7 @@ SELECT MAX(backup_id) FROM mysql.backup_
SELECT validity_point_time = @vp_time,
binlog_file = @vp_file,
- binlog_pos = @vp_pos
+ binlog_start_pos = @vp_pos
FROM mysql.backup_history
WHERE backup_id = @bid;
=== modified file 'mysql-test/suite/backup_ptr/r/backup_ptr_commits.result'
--- a/mysql-test/suite/backup_ptr/r/backup_ptr_commits.result 2009-03-05 20:05:02 +0000
+++ b/mysql-test/suite/backup_ptr/r/backup_ptr_commits.result 2009-05-13 20:08:02 +0000
@@ -142,7 +142,7 @@ id name
4 ab4
5 ab5
DROP DATABASE ptr;
-*** Recovering data till point of backup using mysql binlog_position ***
+*** Recovering data till point of backup using mysql binlog_start_position ***
SELECT * FROM ptr.t1;
id details
1 testing1
=== modified file 'mysql-test/suite/backup_ptr/t/backup_ptr.test'
--- a/mysql-test/suite/backup_ptr/t/backup_ptr.test 2009-03-05 20:05:02 +0000
+++ b/mysql-test/suite/backup_ptr/t/backup_ptr.test 2009-05-13 20:08:02 +0000
@@ -162,7 +162,7 @@ SELECT * FROM ptr.d2;
--echo ** Backup data **
LET $backup_id = `BACKUP DATABASE ptr TO 'ptr.bak'`;
set timestamp=@a+2;
-LET $binlog_pos = `SELECT binlog_pos FROM mysql.backup_history WHERE backup_id =$backup_id`;
+LET $binlog_start_pos = `SELECT binlog_start_pos FROM mysql.backup_history WHERE backup_id =$backup_id`;
LET $binlog_file =query_get_value(SHOW MASTER STATUS, File, 1);
--echo
@@ -221,7 +221,7 @@ DROP DATABASE ptr;
--echo **** Execute mysqlbinlog to recover the data from start to backup ****
--exec $MYSQL_BINLOG --database=ptr $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/q1.bin
---exec $MYSQL_BINLOG --database=ptr --stop-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --database=ptr --stop-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
# Verify that the table we just dropped has been restored
SHOW TABLES FROM ptr;
@@ -232,7 +232,7 @@ SELECT * FROM ptr.d1;
SELECT * FROM ptr.d2;
--echo **** Now perform another recovery to recover data after backup ****
---exec $MYSQL_BINLOG --database=ptr --start-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --database=ptr --start-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
SHOW TABLES FROM ptr;
@@ -262,7 +262,7 @@ SELECT * FROM ptr.d1;
SELECT * FROM ptr.d2;
--echo Recovering data contents after backup
---exec $MYSQL_BINLOG --database=ptr --start-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --database=ptr --start-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
SHOW TABLES FROM ptr;
DESCRIBE ptr.t1;
=== modified file 'mysql-test/suite/backup_ptr/t/backup_ptr_commits.test'
--- a/mysql-test/suite/backup_ptr/t/backup_ptr_commits.test 2009-03-05 20:05:02 +0000
+++ b/mysql-test/suite/backup_ptr/t/backup_ptr_commits.test 2009-05-13 20:08:02 +0000
@@ -119,7 +119,7 @@ SELECT COUNT(*) FROM ptr.t3;
SELECT * FROM ptr.t3;
LET $binlog_file =query_get_value(SHOW MASTER STATUS, File, 1);
-LET $binlog_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+LET $binlog_start_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
--echo con1:
connection con1;
@@ -141,15 +141,15 @@ SELECT * FROM ptr.t3;
DROP DATABASE ptr;
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/qcommit.bin
---exec $MYSQL_BINLOG --stop-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
---echo *** Recovering data till point of backup using mysql binlog_position ***
+--exec $MYSQL_BINLOG --stop-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--echo *** Recovering data till point of backup using mysql binlog_start_position ***
SELECT * FROM ptr.t1;
SELECT * FROM ptr.t2;
SELECT * FROM ptr.t3;
--echo *** Recover data after backup ***
---exec $MYSQL_BINLOG --start-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
SELECT * FROM ptr.t1;
SELECT * FROM ptr.t2;
@@ -170,7 +170,7 @@ SELECT * FROM ptr.t1;
SELECT * FROM ptr.t2;
SELECT * FROM ptr.t3;
---exec $MYSQL_BINLOG --start-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
--echo *** Recover data using binlog position after backup ***
SELECT * FROM ptr.t1;
=== modified file 'mysql-test/suite/backup_ptr/t/backup_ptr_objects.test'
--- a/mysql-test/suite/backup_ptr/t/backup_ptr_objects.test 2009-03-05 20:05:02 +0000
+++ b/mysql-test/suite/backup_ptr/t/backup_ptr_objects.test 2009-05-13 20:08:02 +0000
@@ -261,7 +261,7 @@ SELECT ptr_ob1.f1();
# Perform backup operation and obtain binlog position and dates.
LET $backup_id = `BACKUP DATABASE ptr_ob1, ptr_ob2 TO 'ptr_objects.bak'`;
set timestamp=@a+2;
-LET $binlog_pos = `SELECT binlog_pos FROM mysql.backup_history WHERE backup_id =$backup_id`;
+LET $binlog_start_pos = `SELECT binlog_start_pos FROM mysql.backup_history WHERE backup_id =$backup_id`;
LET $binlog_file =query_get_value(SHOW MASTER STATUS, File, 1);
--echo Make some changes to objects.
@@ -360,7 +360,7 @@ DROP DATABASE ptr_ob2;
--echo **** Execute mysqlbinlog to recover the data from start to backup ****
--exec $MYSQL_BINLOG $MYSQLD_DATADIR/master-bin.000001 > $MYSQLTEST_VARDIR/tmp/qobject.bin
---exec $MYSQL_BINLOG --stop-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --stop-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
# Verify that the table we just dropped has been restored
@@ -385,7 +385,7 @@ SELECT ptr_ob1.f1();
--echo **** Now perform another recovery to recover data after backup ****
---exec $MYSQL_BINLOG --start-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
--replace_column 5 # 6 # 9 # 10 # 11 #
SHOW PROCEDURE STATUS WHERE Db LIKE 'ptr_%';
@@ -439,7 +439,7 @@ SELECT * FROM ptr_ob1.vv;
SELECT ptr_ob1.f1();
--echo Now use binlog position to recover data after backup
---exec $MYSQL_BINLOG --start-position=$binlog_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --start-position=$binlog_start_pos $MYSQLD_DATADIR/$binlog_file |$MYSQL
--replace_column 5 # 6 # 9 # 10 # 11 #
SHOW PROCEDURE STATUS WHERE Db LIKE 'ptr_%';
=== modified file 'mysql-test/suite/rpl/r/rpl_backup_extra.result'
--- a/mysql-test/suite/rpl/r/rpl_backup_extra.result 2009-04-29 18:20:21 +0000
+++ b/mysql-test/suite/rpl/r/rpl_backup_extra.result 2009-05-13 20:08:02 +0000
@@ -100,7 +100,7 @@ BACKUP DATABASE db1, db2 TO 'dbs.bak';
backup_id
#
# Verify the backup logs has recorded the slaves binary logs information
-SELECT binlog_pos INTO @master_pos_log FROM mysql.backup_history;
+SELECT binlog_start_pos INTO @master_pos_log FROM mysql.backup_history;
1
# If result is 1, then slaves binary log position is same in backup
# logs and there is no advance in binary log position in slave status
@@ -301,7 +301,7 @@ backup_id
# Connecting to slave
# Verify that performing backup on the master will not lead to changes
# to the backup logs on the slave.
-SELECT MAX(binlog_pos) INTO @binlog_pos_s FROM mysql.backup_history;
+SELECT MAX(binlog_start_pos) INTO @binlog_start_pos_s FROM mysql.backup_history;
1
# If result is 1, then slaves binary log position is same in backup
# logs. This will show that changes to backup logs in master will not
=== modified file 'mysql-test/suite/rpl/t/rpl_backup_extra.test'
--- a/mysql-test/suite/rpl/t/rpl_backup_extra.test 2009-04-29 18:20:21 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_extra.test 2009-05-13 20:08:02 +0000
@@ -49,7 +49,7 @@ let $master_pos = query_get_value("SHOW
BACKUP DATABASE db1, db2 TO 'dbs.bak';
--echo # Verify the backup logs has recorded the slaves binary logs information
-SELECT binlog_pos INTO @master_pos_log FROM mysql.backup_history;
+SELECT binlog_start_pos INTO @master_pos_log FROM mysql.backup_history;
let $result=`SELECT @master_pos_log = $master_pos AS are_identical`;
--echo $result
--echo # If result is 1, then slaves binary log position is same in backup
@@ -165,7 +165,7 @@ connection slave;
--echo # Note down the binary log position from backup logs in slave
-Let $binlog_pos = `SELECT binlog_pos FROM mysql.backup_history`;
+Let $binlog_start_pos = `SELECT binlog_start_pos FROM mysql.backup_history`;
--echo # Connecting to master...
connection master;
@@ -180,8 +180,8 @@ connection slave;
--echo # Verify that performing backup on the master will not lead to changes
--echo # to the backup logs on the slave.
-SELECT MAX(binlog_pos) INTO @binlog_pos_s FROM mysql.backup_history;
-let $result=`SELECT @binlog_pos_s = $binlog_pos AS are_identical`;
+SELECT MAX(binlog_start_pos) INTO @binlog_start_pos_s FROM mysql.backup_history;
+let $result=`SELECT @binlog_start_pos_s = $binlog_start_pos AS are_identical`;
--echo $result
--echo # If result is 1, then slaves binary log position is same in backup
--echo # logs. This will show that changes to backup logs in master will not
=== modified file 'mysql-test/suite/rpl/t/rpl_backup_ptr.test'
--- a/mysql-test/suite/rpl/t/rpl_backup_ptr.test 2009-04-29 18:20:21 +0000
+++ b/mysql-test/suite/rpl/t/rpl_backup_ptr.test 2009-05-13 20:08:02 +0000
@@ -95,7 +95,7 @@ connection master;
--replace_column 1 #
BACKUP DATABASE db1, db2 TO 'db12m_ptr.bak';
-let $binlog_pos = `SELECT binlog_pos FROM mysql.backup_history`;
+let $binlog_start_pos = `SELECT binlog_start_pos FROM mysql.backup_history`;
let $binlog_file = query_get_value(SHOW MASTER STATUS, File, 1);
DROP PROCEDURE test.show_objects;
@@ -120,7 +120,7 @@ START SLAVE;
--echo # Execute mysqlbinlog
connection master;
---exec $MYSQL_BINLOG --stop-position=$binlog_pos $MYSQLD_M_DATADIR/$binlog_file |$MYSQL
+--exec $MYSQL_BINLOG --stop-position=$binlog_start_pos $MYSQLD_M_DATADIR/$binlog_file |$MYSQL
--remove_file $MYSQLD_M_DATADIR/db12m_ptr.bak
--echo
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql 2009-04-17 14:46:18 +0000
+++ b/scripts/mysql_system_tables.sql 2009-05-13 20:08:02 +0000
@@ -89,7 +89,7 @@ DROP TABLE IF EXISTS mysql.online_backup
DROP TABLE IF EXISTS mysql.online_backup_progress;
-CREATE TABLE IF NOT EXISTS backup_history ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Surrogate key for (near) duplicate entries', process_id INT UNSIGNED NOT NULL COMMENT 'The process id that operation ran as', binlog_pos INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64) NOT NULL DEFAULT '' COMMENT 'The recorded binlog filename at time of backup/restore', backup_state ENUM('complete', 'starting', 'validity point', 'running', 'error', 'cancel') NOT NULL COMMENT 'Status of current operation', operation ENUM('backup', 'restore') NOT NULL COMMENT 'Type of operation', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', num_objects INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of objects in the backup', total_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The size of the backup repository in bytes', validity_point_time datetime NOT NULL DEFAULT 0 COMMENT 'The time of the validity !
point.',
+CREATE TABLE IF NOT EXISTS backup_history ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Surrogate key for (near) duplicate entries', process_id INT UNSIGNED NOT NULL COMMENT 'The process id that operation ran as', binlog_start_pos INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The recorded binlog start position of backup/restore', binlog_file CHAR(64) NOT NULL DEFAULT '' COMMENT 'The recorded binlog filename at time of backup/restore', backup_state ENUM('complete', 'starting', 'validity point', 'running', 'error', 'cancel') NOT NULL COMMENT 'Status of current operation', operation ENUM('backup', 'restore') NOT NULL COMMENT 'Type of operation', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', num_objects INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of objects in the backup', total_bytes BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The size of the backup repository in bytes', validity_point_time datetime NOT NULL DEFAULT 0 COMMENT 'The time of t!
he validi
CREATE TABLE IF NOT EXISTS backup_progress ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Key for backup_history table entries', object CHAR (30) NOT NULL DEFAULT '' COMMENT 'The object being operated on', start_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of start of operation', stop_time datetime NOT NULL DEFAULT 0 COMMENT 'The date/time of end of operation', total_bytes BIGINT NOT NULL DEFAULT 0 COMMENT 'The size of the object in bytes', progress BIGINT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The number of bytes processed', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', notes CHAR(100) NOT NULL DEFAULT '' COMMENT 'Commentary from the backup engine') ENGINE=CSV DEFAULT CHARACTER SET utf8;
=== modified file 'scripts/mysql_system_tables_fix.sql'
--- a/scripts/mysql_system_tables_fix.sql 2009-04-17 14:46:18 +0000
+++ b/scripts/mysql_system_tables_fix.sql 2009-05-13 20:08:02 +0000
@@ -607,4 +607,6 @@ UPDATE user SET Create_tablespace_priv =
flush privileges;
ALTER TABLE backup_history ADD COLUMN backup_file_path VARCHAR (512) NOT NULL DEFAULT '' COMMENT 'The full path to the backup image file' AFTER backup_file;
+ALTER TABLE backup_history CHANGE COLUMN binlog_pos binlog_start_pos INT UNSIGNED NOT NULL DEFAULT 0 COMMENT 'The recorded binlog start position of backup/restore';
+
=== modified file 'sql/backup/data_backup.cc'
--- a/sql/backup/data_backup.cc 2009-04-30 09:24:45 +0000
+++ b/sql/backup/data_backup.cc 2009-05-13 20:08:02 +0000
@@ -457,7 +457,7 @@ void unblock_commits(THD *thd)
static
int save_vp_info(Backup_info &info)
{
- LOG_INFO binlog_pos;
+ LOG_INFO binlog_start_pos;
int ret=0;
/*
@@ -470,20 +470,20 @@ int save_vp_info(Backup_info &info)
*/
if (mysql_bin_log.is_open())
{
- if (mysql_bin_log.get_current_log(&binlog_pos))
+ if (mysql_bin_log.get_current_log(&binlog_start_pos))
{
info.m_log.report_error(ER_BACKUP_BINLOG);
ret= TRUE;
}
else
- info.save_binlog_pos(binlog_pos);
+ info.save_binlog_info(binlog_start_pos);
}
/*
Save master's binlog information if we are a connected slave.
*/
if (obs::is_slave() && active_mi)
- info.save_master_pos(*active_mi);
+ info.save_master_binlog_info(*active_mi);
return ret;
}
@@ -505,9 +505,9 @@ void report_vp_info(Backup_info &info)
TRUE // = also write to progress log
);
if (info.flags & BSTREAM_FLAG_BINLOG)
- info.m_log.report_binlog_pos(info.binlog_pos);
- if (info.master_pos.pos)
- info.m_log.report_master_binlog_pos(info.master_pos);
+ info.m_log.report_binlog_info(info.binlog_info);
+ if (info.master_binlog_info.pos)
+ info.m_log.report_master_binlog_info(info.master_binlog_info);
}
=== modified file 'sql/backup/image_info.cc'
--- a/sql/backup/image_info.cc 2009-04-15 20:25:14 +0000
+++ b/sql/backup/image_info.cc 2009-05-13 20:08:02 +0000
@@ -57,7 +57,7 @@ Image_info::Image_info() :
#endif
bzero(m_snap, sizeof(m_snap));
- bzero(&master_pos, sizeof(master_pos));
+ bzero(&master_binlog_info, sizeof(master_binlog_info));
}
Image_info::~Image_info()
@@ -394,11 +394,11 @@ Image_info::Obj *find_obj(const Image_in
}
}
-void Image_info::save_master_pos(const ::Master_info &mi)
+void Image_info::save_master_binlog_info(const ::Master_info &mi)
{
// store binlog coordinates
- master_pos.pos= static_cast<unsigned long int>(mi.master_log_pos);
- master_pos.file= const_cast<char*>(mi.master_log_name);
+ master_binlog_info.pos= static_cast<unsigned long int>(mi.master_log_pos);
+ master_binlog_info.file= const_cast<char*>(mi.master_log_name);
}
=== modified file 'sql/backup/image_info.h'
--- a/sql/backup/image_info.h 2009-02-16 12:20:31 +0000
+++ b/sql/backup/image_info.h 2009-05-13 20:08:02 +0000
@@ -88,7 +88,8 @@ public: // public interface
virtual bool is_valid() =0; ///< Is the structure valid?
size_t data_size; ///< How much of table data is saved in the image.
- st_bstream_binlog_pos master_pos; ///< To store master position info.
+ /// To store master position info.
+ st_bstream_binlog_info master_binlog_info;
ulong object_count() const;
ulong table_count() const;
@@ -128,9 +129,9 @@ public: // public interface
void save_end_time(const time_t time);
void save_vp_time(const time_t time);
- void save_binlog_pos(const ::LOG_INFO&);
+ void save_binlog_info(const ::LOG_INFO&);
/// Save the master's binlog position.
- void save_master_pos(const ::Master_info&);
+ void save_master_binlog_info(const ::Master_info&);
/// Return the validity point time.
time_t get_vp_time() const;
@@ -935,7 +936,7 @@ void Image_info::save_vp_time(const time
backup image contains a valid binlog position.
*/
inline
-void Image_info::save_binlog_pos(const ::LOG_INFO &li)
+void Image_info::save_binlog_info(const ::LOG_INFO &li)
{
// save current binlog file name only, not full path
m_binlog_file.length(0);
@@ -943,8 +944,8 @@ void Image_info::save_binlog_pos(const :
m_binlog_file.append(li.log_file_name + dn_length);
// store binlog coordinates
- binlog_pos.pos= (unsigned long int)li.pos;
- binlog_pos.file= const_cast<char*>(m_binlog_file.ptr());
+ binlog_info.pos= (unsigned long int)li.pos;
+ binlog_info.file= const_cast<char*>(m_binlog_file.ptr());
// make flags bitmap reflect that this backup image contains a valid
// binlog position
=== modified file 'sql/backup/kernel.cc'
--- a/sql/backup/kernel.cc 2009-05-07 01:44:37 +0000
+++ b/sql/backup/kernel.cc 2009-05-13 20:08:02 +0000
@@ -1514,7 +1514,7 @@ int Backup_restore_ctx::do_restore(bool
report_vp_time(info.get_vp_time(), FALSE); // FALSE = do not write to progress log
if (info.flags & BSTREAM_FLAG_BINLOG)
- report_binlog_pos(info.binlog_pos);
+ report_binlog_info(info.binlog_info);
report_stats_post(info); // Never errors
=== modified file 'sql/backup/logger.h'
--- a/sql/backup/logger.h 2009-03-16 14:38:05 +0000
+++ b/sql/backup/logger.h 2009-05-13 20:08:02 +0000
@@ -64,8 +64,8 @@ public:
void report_aborted(time_t, bool data_changed);
void report_state(enum_backup_state);
void report_vp_time(time_t, bool);
- void report_binlog_pos(const st_bstream_binlog_pos&);
- void report_master_binlog_pos(const st_bstream_binlog_pos&);
+ void report_binlog_info(const st_bstream_binlog_info&);
+ void report_master_binlog_info(const st_bstream_binlog_info&);
void report_driver(const char *driver);
void report_backup_file(char * path);
void report_stats_pre(const Image_info&);
@@ -353,11 +353,11 @@ void Logger::report_vp_time(time_t when,
@todo Write binlog position also to server's error log (as info entry).
*/
inline
-void Logger::report_binlog_pos(const st_bstream_binlog_pos &pos)
+void Logger::report_binlog_info(const st_bstream_binlog_info &pos)
{
DBUG_ASSERT(m_state == RUNNING);
DBUG_ASSERT(backup_log);
- backup_log->binlog_pos(pos.pos);
+ backup_log->binlog_start_pos(pos.pos);
backup_log->binlog_file(pos.file);
}
@@ -367,11 +367,11 @@ void Logger::report_binlog_pos(const st_
@todo Write this information to the backup image file.
*/
inline
-void Logger::report_master_binlog_pos(const st_bstream_binlog_pos &pos)
+void Logger::report_master_binlog_info(const st_bstream_binlog_info &pos)
{
if (active_mi)
{
- backup_log->master_binlog_pos(pos.pos);
+ backup_log->master_binlog_start_pos(pos.pos);
backup_log->master_binlog_file(pos.file);
backup_log->write_master_binlog_info();
}
=== modified file 'sql/backup/stream_v1.c'
--- a/sql/backup/stream_v1.c 2009-03-10 18:19:41 +0000
+++ b/sql/backup/stream_v1.c 2009-05-13 20:08:02 +0000
@@ -251,7 +251,7 @@ int bstream_rd_preamble(backup_stream *s
*/
/** Save binlog position. */
-int bstream_wr_binlog_pos(backup_stream *s, struct st_bstream_binlog_pos pos)
+int bstream_wr_binlog_pos(backup_stream *s, struct st_bstream_binlog_info pos)
{
blob name;
int ret= BSTREAM_OK;
@@ -274,7 +274,7 @@ int bstream_wr_binlog_pos(backup_stream
@retval BSTREAM_EOC Read successful and end of chunk has been reached
@retval BSTREAM_EOS Read successful and end of stream has been reached
*/
-int bstream_rd_binlog_pos(backup_stream *s, struct st_bstream_binlog_pos *pos)
+int bstream_rd_binlog_pos(backup_stream *s, struct st_bstream_binlog_info *pos)
{
blob name= {NULL, NULL};
int ret= BSTREAM_OK;
@@ -304,7 +304,7 @@ int bstream_wr_summary(backup_stream *s,
CHECK_WR_RES(bstream_wr_byte(s,0x00));
CHECK_WR_RES(bstream_wr_time(s,&hdr->vp_time));
CHECK_WR_RES(bstream_wr_time(s,&hdr->end_time));
- CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_pos));
+ CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_info));
CHECK_WR_RES(bstream_wr_binlog_pos(s,hdr->binlog_group));
wr_error:
@@ -329,7 +329,7 @@ int bstream_rd_summary(backup_stream *s,
CHECK_RD_OK(bstream_rd_time(s,&hdr->vp_time));
CHECK_RD_OK(bstream_rd_time(s,&hdr->end_time));
- CHECK_RD_OK(bstream_rd_binlog_pos(s,&hdr->binlog_pos));
+ CHECK_RD_OK(bstream_rd_binlog_pos(s,&hdr->binlog_info));
CHECK_RD_RES(bstream_rd_binlog_pos(s,&hdr->binlog_group));
rd_error:
=== modified file 'sql/backup/stream_v1.h'
--- a/sql/backup/stream_v1.h 2008-12-18 21:46:36 +0000
+++ b/sql/backup/stream_v1.h 2009-05-13 20:08:02 +0000
@@ -63,7 +63,7 @@ typedef struct st_bstream_time bstream_t
The event is identified by the name of the file in which it is stored and
the position within that file.
*/
-struct st_bstream_binlog_pos
+struct st_bstream_binlog_info
{
char *file; /**< binlog file storing the event */
unsigned long int pos; /**< position (offset) within the file */
@@ -163,9 +163,9 @@ struct st_bstream_image_header
*/
/** position of the last binlog entry at the VP time */
- struct st_bstream_binlog_pos binlog_pos;
+ struct st_bstream_binlog_info binlog_info;
/** start of the last binlog event group at the VP time */
- struct st_bstream_binlog_pos binlog_group;
+ struct st_bstream_binlog_info binlog_group;
/** number of table data snapshots in the image */
unsigned short int snap_count;
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-05-07 01:44:37 +0000
+++ b/sql/log.cc 2009-05-13 20:08:02 +0000
@@ -854,8 +854,9 @@ bool Log_to_csv_event_handler::
table->field[ET_OBH_FIELD_BACKUP_ID]->set_notnull();
table->field[ET_OBH_FIELD_PROCESS_ID]->store(history_data->process_id, TRUE);
table->field[ET_OBH_FIELD_PROCESS_ID]->set_notnull();
- table->field[ET_OBH_FIELD_BINLOG_POS]->store(history_data->binlog_pos, TRUE);
- table->field[ET_OBH_FIELD_BINLOG_POS]->set_notnull();
+ table->field[ET_OBH_FIELD_BINLOG_START_POS]->
+ store(history_data->binlog_start_pos, TRUE);
+ table->field[ET_OBH_FIELD_BINLOG_START_POS]->set_notnull();
if (history_data->binlog_file)
{
@@ -3597,7 +3598,7 @@ bool MYSQL_BACKUP_LOG::open(const char *
int len=my_snprintf(buff, sizeof(buff), "Columns for this log:\n");
if (history)
- end= strnmov(buff + len, "backup_id \tprocess_id \tbinlog_pos "
+ end= strnmov(buff + len, "backup_id \tprocess_id \tbinlog_start_pos "
"\tbinlog_file \tbackup_state \toperation "
"\terror_num \tnum_objects \ttotal_bytes "
"\tvalidity_point_time \tstart_time \tstop_time "
@@ -3772,7 +3773,7 @@ bool MYSQL_BACKUP_LOG::write(THD *thd, s
goto err;
if (write_int(history_data->process_id))
goto err;
- if (write_int(history_data->binlog_pos))
+ if (write_int(history_data->binlog_start_pos))
goto err;
if (write_str(history_data->binlog_file))
goto err;
=== modified file 'sql/log.h'
--- a/sql/log.h 2009-01-26 16:32:29 +0000
+++ b/sql/log.h 2009-05-13 20:08:02 +0000
@@ -25,7 +25,7 @@ enum enum_backup_history_log_field
{
ET_OBH_FIELD_BACKUP_ID = 0, /* start from 0 to correspond with field array */
ET_OBH_FIELD_PROCESS_ID,
- ET_OBH_FIELD_BINLOG_POS,
+ ET_OBH_FIELD_BINLOG_START_POS,
ET_OBH_FIELD_BINLOG_FILE,
ET_OBH_FIELD_BACKUP_STATE,
ET_OBH_FIELD_OPER,
=== modified file 'sql/si_logs.cc'
--- a/sql/si_logs.cc 2008-10-30 17:53:24 +0000
+++ b/sql/si_logs.cc 2009-05-13 20:08:02 +0000
@@ -143,11 +143,12 @@ bool Backup_log::write_master_binlog_inf
char buff[1024];
bool ret= FALSE;
- if (m_op_hist.master_binlog_file || m_op_hist.master_binlog_pos)
+ if (m_op_hist.master_binlog_file ||
+ m_op_hist.master_binlog_start_pos)
{
sprintf(buff,
"Recording master binlog information. binlog file = '%s', position = %d.",
- m_op_hist.master_binlog_file, m_op_hist.master_binlog_pos);
+ m_op_hist.master_binlog_file, m_op_hist.master_binlog_start_pos);
ret= write_progress(0, 0, 0, 0, 0, 0, (char *)&buff);
}
return ret;
=== modified file 'sql/si_logs.h'
--- a/sql/si_logs.h 2008-11-14 14:49:09 +0000
+++ b/sql/si_logs.h 2009-05-13 20:08:02 +0000
@@ -50,7 +50,7 @@ struct st_backup_history
char *backup_file; ///< the backup image file
char backup_file_path[FN_REFLEN]; ///< the backup image path
char *command; ///< the command used
- int binlog_pos; ///< position in the binary log
+ int binlog_start_pos; ///< position in the binary log
char *binlog_file; ///< the name of the binary log file
int num_objects; ///< number of objects in backup
longlong size; ///< total size of the backup image file
@@ -58,7 +58,7 @@ struct st_backup_history
time_t stop; ///< stop time of operation
time_t vp_time; ///< point in time validation was assured
String driver_name; ///< list of backup engines used
- int master_binlog_pos; ///< position in the binary log
+ int master_binlog_start_pos; ///< position in the binary log
char *master_binlog_file; ///< name of the master's binary log file
};
@@ -132,11 +132,14 @@ public:
ulonglong get_backup_id() { return m_op_hist.backup_id; }
void state(enum_backup_state);
void error_num(int code) { m_op_hist.error_num= code; }
- void binlog_pos(unsigned long int pos) { m_op_hist.binlog_pos= pos; }
+ void binlog_start_pos(unsigned long int pos)
+ {
+ m_op_hist.binlog_start_pos= pos;
+ }
void binlog_file(char *file);
- void master_binlog_pos(unsigned long int pos)
+ void master_binlog_start_pos(unsigned long int pos)
{
- m_op_hist.master_binlog_pos= pos;
+ m_op_hist.master_binlog_start_pos= pos;
}
void master_binlog_file(char *file);
void num_objects(int num) { m_op_hist.num_objects= num; }