#At file:///D:/source/bzr/mysql-6.0-bug-39528/ based on revid:charles.bell@stripped
2810 Chuck Bell 2009-05-14
BUG#39528 : No progress bar for backup/restore operation
There are several unused columns in the backup progress log. These columns
include start_time, stop_time, total_bytes, and progress. All of these are
set to 0 by default and except for when the validity point is reported
(only start_time gets set), none of these columns are set.
This is confusing for the users who expect to see progress reported.
WL#4815 was created to address this problem and to design a clear
progress tracking mechanism for MySQL Backup. Until that work is completed,
these extra columns must be removed.
This patch removes the extra columns from the log and source code.
modified:
mysql-test/suite/backup/r/backup_logs.result
mysql-test/suite/backup/r/backup_logs_purge.result
mysql-test/suite/backup/t/backup_logs.test
scripts/mysql_system_tables.sql
scripts/mysql_system_tables_fix.sql
sql/log.cc
sql/log.h
per-file messages:
mysql-test/suite/backup/r/backup_logs.result
New result file.
mysql-test/suite/backup/r/backup_logs_purge.result
New result file.
mysql-test/suite/backup/t/backup_logs.test
Removed columns from progress log selects.
scripts/mysql_system_tables.sql
Removed columns from CREATE TABLE statement.
scripts/mysql_system_tables_fix.sql
Added mechanism to upgrade from previous releases. A stored
procedure was used to ensure success when the upgrade is run
on a current release.
sql/log.cc
Removed writes to the unused columns.
sql/log.h
Removed unused enums.
=== 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-14 13:14:57 +0000
@@ -163,41 +163,38 @@ con1: Wait for the backup to be started.
SET DEBUG_SYNC= 'now WAIT_FOR started';
con1: Display progress
-backup progress tables will always show start_time, stop_time,total_bytes
-and progress as '0' for all phases of backup operation.
-BUG#39356 Backup progress table details aren't updated properly
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
-total_bytes progress notes
-0 0 starting
+notes
+starting
con1: Let backup step to running state.
SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR phase1';
con1: Display progress
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
-total_bytes progress notes
-0 0 starting
-0 0 running
+notes
+starting
+running
con1: Let backup do the backup phase1.
SET DEBUG_SYNC= 'now SIGNAL backup WAIT_FOR validated';
con1: Display progress
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
-total_bytes progress notes
-0 0 starting
-0 0 running
-0 0 validity point
+notes
+starting
+running
+validity point
con1: Let backup do the backup phase2.
SET DEBUG_SYNC= 'now SIGNAL do_phase2 WAIT_FOR phase2';
con1: Display progress
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
-total_bytes progress notes
-0 0 starting
-0 0 running
-0 0 validity point
-0 0 vp time
-0 0 running
+notes
+starting
+running
+validity point
+vp time
+running
con1: Let backup finish.
SET DEBUG_SYNC= 'now SIGNAL finish';
con2: Finish backup command
@@ -263,13 +260,13 @@ user_comment
command BACKUP DATABASE backup_logs to 'backup_logs_orig.bak'
drivers MyISAM, Snapshot, Default, Nodata
SELECT * FROM mysql.backup_progress WHERE backup_id = 500;
-backup_id object start_time stop_time total_bytes progress error_num notes
-# backup kernel # # 0 0 0 starting
-# backup kernel # # 0 0 0 running
-# backup kernel # # 0 0 0 validity point
-# backup kernel # # 0 0 0 vp time
-# backup kernel # # 0 0 0 running
-# backup kernel # # 0 0 0 complete
+backup_id object error_num notes
+# backup kernel # #
+# backup kernel # #
+# backup kernel # #
+# backup kernel # #
+# backup kernel # #
+# backup kernel # #
File sizes are not identical
The actual backup file size and from backup_history logs are different
@@ -285,18 +282,18 @@ SELECT now() INTO @start_restore;
con1: Wait for the restore to be started.
SET DEBUG_SYNC= 'now WAIT_FOR started';
con1: Display progress
-SELECT total_bytes, progress,notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 501;
-total_bytes progress notes
-0 0 starting
+notes
+starting
con1: Let restore step to running state.
SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR running';
con1: Display progress
-SELECT total_bytes, progress,notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 501;
-total_bytes progress notes
-0 0 starting
-0 0 running
+notes
+starting
+running
con1: Let restore do its job and finish.
SET DEBUG_SYNC= 'now SIGNAL finish';
con2: Finish restore command
@@ -332,10 +329,10 @@ user_comment
command RESTORE FROM 'backup_logs_orig.bak' OVERWRITE
drivers MyISAM, Snapshot, Default, Nodata
SELECT * FROM mysql.backup_progress WHERE backup_id = 501;
-backup_id object start_time stop_time total_bytes progress error_num notes
-# backup kernel # # 0 0 0 starting
-# backup kernel # # 0 0 0 running
-# backup kernel # # 0 0 0 complete
+backup_id object error_num notes
+# backup kernel # #
+# backup kernel # #
+# backup kernel # #
SET DEBUG_SYNC= 'RESET';
SET SESSION debug="+d,set_backup_id";
BACKUP DATABASE backup_logs to 'backup_logs_orig.bak';
=== modified file 'mysql-test/suite/backup/r/backup_logs_purge.result'
--- a/mysql-test/suite/backup/r/backup_logs_purge.result 2009-02-13 12:40:13 +0000
+++ b/mysql-test/suite/backup/r/backup_logs_purge.result 2009-05-14 13:14:57 +0000
@@ -279,12 +279,8 @@ count(*)
SELECT * FROM mysql.backup_progress;
backup_id 500
object backup kernel
-start_time #
-stop_time #
-total_bytes 0
-progress 0
-error_num 0
-notes complete
+error_num #
+notes #
Now do the same test for restore.
RESTORE FROM 'backup1.bak' OVERWRITE;
backup_id
@@ -331,12 +327,8 @@ count(*)
SELECT * FROM mysql.backup_progress;
backup_id 505
object backup kernel
-start_time #
-stop_time #
-total_bytes 0
-progress 0
-error_num 0
-notes complete
+error_num #
+notes #
First, run some backups.
BACKUP DATABASE backup_logs TO 'backup1.bak';
backup_id
=== modified file 'mysql-test/suite/backup/t/backup_logs.test'
--- a/mysql-test/suite/backup/t/backup_logs.test 2009-05-07 01:44:37 +0000
+++ b/mysql-test/suite/backup/t/backup_logs.test 2009-05-14 13:14:57 +0000
@@ -252,34 +252,29 @@ SET DEBUG_SYNC= 'now WAIT_FOR started';
--echo
--echo con1: Display progress
---echo backup progress tables will always show start_time, stop_time,total_bytes
---echo and progress as '0' for all phases of backup operation.
---echo BUG#39356 Backup progress table details aren't updated properly
-# Correct backup/restore times and progress should be indicated in the backup
-# logs once this bug is fixed
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
--echo con1: Let backup step to running state.
SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR phase1';
--echo con1: Display progress
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
--echo con1: Let backup do the backup phase1.
SET DEBUG_SYNC= 'now SIGNAL backup WAIT_FOR validated';
--echo con1: Display progress
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
--echo con1: Let backup do the backup phase2.
SET DEBUG_SYNC= 'now SIGNAL do_phase2 WAIT_FOR phase2';
--echo con1: Display progress
-SELECT total_bytes, progress, notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 500;
--echo con1: Let backup finish.
@@ -388,14 +383,14 @@ SELECT now() INTO @start_restore;
SET DEBUG_SYNC= 'now WAIT_FOR started';
--echo con1: Display progress
-SELECT total_bytes, progress,notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 501;
--echo con1: Let restore step to running state.
SET DEBUG_SYNC= 'now SIGNAL do_run WAIT_FOR running';
--echo con1: Display progress
-SELECT total_bytes, progress,notes FROM mysql.backup_progress
+SELECT notes FROM mysql.backup_progress
WHERE backup_id = 501;
--echo con1: Let restore do its job and finish.
=== 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-14 13:14:57 +0000
@@ -91,7 +91,7 @@ DROP TABLE IF EXISTS mysql.online_backup
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_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;
+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', 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;
CREATE TABLE IF NOT EXISTS ndb_binlog_index (Position BIGINT UNSIGNED NOT NULL, File VARCHAR(255) NOT NULL, epoch BIGINT UNSIGNED NOT NULL, inserts INT UNSIGNED NOT NULL, updates INT UNSIGNED NOT NULL, deletes INT UNSIGNED NOT NULL, schemaops INT UNSIGNED NOT NULL, orig_server_id INT UNSIGNED NOT NULL, orig_epoch BIGINT UNSIGNED NOT NULL, gci INT UNSIGNED NOT NULL, PRIMARY KEY(epoch, orig_server_id, orig_epoch)) ENGINE=MARIA;
=== 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-14 13:14:57 +0000
@@ -608,3 +608,22 @@ 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;
+#
+# Remove columns from backup_progress if present.
+#
+DELIMITER ||
+CREATE PROCEDURE fix_backup_progress ()
+BEGIN
+ SELECT count(*) FROM INFORMATION_SCHEMA.COLUMNS WHERE
+ TABLE_SCHEMA = 'mysql' AND TABLE_NAME = 'backup_progress'
+ INTO @x;
+ IF (@x > 4) THEN
+ ALTER TABLE backup_progress DROP COLUMN start_time;
+ ALTER TABLE backup_progress DROP COLUMN stop_time;
+ ALTER TABLE backup_progress DROP COLUMN total_bytes;
+ ALTER TABLE backup_progress DROP COLUMN progress;
+ END IF;
+END ||
+DELIMITER ;
+CALL fix_backup_progress();
+DROP PROCEDURE fix_backup_progress;
=== modified file 'sql/log.cc'
--- a/sql/log.cc 2009-05-07 01:44:37 +0000
+++ b/sql/log.cc 2009-05-14 13:14:57 +0000
@@ -1100,28 +1100,6 @@ bool Log_to_csv_event_handler::
table->field[ET_OBP_FIELD_PROG_OBJECT]->set_notnull();
}
- if (start)
- {
- MYSQL_TIME time;
- my_tz_OFFSET0->gmt_sec_to_TIME(&time, (my_time_t)start);
-
- table->field[ET_OBP_FIELD_PROG_START_TIME]->set_notnull();
- table->field[ET_OBP_FIELD_PROG_START_TIME]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- }
-
- if (stop)
- {
- MYSQL_TIME time;
- my_tz_OFFSET0->gmt_sec_to_TIME(&time, (my_time_t)stop);
-
- table->field[ET_OBP_FIELD_PROG_STOP_TIME]->set_notnull();
- table->field[ET_OBP_FIELD_PROG_STOP_TIME]->store_time(&time, MYSQL_TIMESTAMP_DATETIME);
- }
-
- table->field[ET_OBP_FIELD_PROG_SIZE]->store(size, TRUE);
- table->field[ET_OBP_FIELD_PROG_SIZE]->set_notnull();
- table->field[ET_OBP_FIELD_PROGRESS]->store(progress, TRUE);
- table->field[ET_OBP_FIELD_PROGRESS]->set_notnull();
table->field[ET_OBP_FIELD_PROG_ERROR_NUM]->store(error_num, TRUE);
table->field[ET_OBP_FIELD_PROG_ERROR_NUM]->set_notnull();
@@ -3868,14 +3846,6 @@ bool MYSQL_BACKUP_LOG::write(THD *thd, u
goto err;
if (write_str(object))
goto err;
- if (write_datetime(start))
- goto err;
- if (write_datetime(stop))
- goto err;
- if (write_long(size))
- goto err;
- if (write_long(progress))
- goto err;
if (write_int(error_num))
goto err;
if (write_str(notes))
=== modified file 'sql/log.h'
--- a/sql/log.h 2009-01-26 16:32:29 +0000
+++ b/sql/log.h 2009-05-14 13:14:57 +0000
@@ -52,10 +52,6 @@ enum enum_backup_progress_log_field
{
ET_OBP_FIELD_BACKUP_ID_FK = 0, /* start from 0 to correspond with field array */
ET_OBP_FIELD_PROG_OBJECT,
- ET_OBP_FIELD_PROG_START_TIME,
- ET_OBP_FIELD_PROG_STOP_TIME,
- ET_OBP_FIELD_PROG_SIZE,
- ET_OBP_FIELD_PROGRESS,
ET_OBP_FIELD_PROG_ERROR_NUM,
ET_OBP_FIELD_PROG_NOTES,
ET_OBP_FIELD_PROG_COUNT /* a cool trick to count the number of fields :) */
| Thread |
|---|
| • bzr commit into mysql-6.0-backup branch (charles.bell:2810) Bug#39528 | Chuck Bell | 14 May |