From: Date: July 9 2008 8:38pm Subject: bzr commit into mysql-6.0-backup branch (cbell:2657) Bug#34965 List-Archive: http://lists.mysql.com/commits/49343 X-Bug: 34965 Message-Id: <200807091838.m69IcRvC018269@mail.mysql.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///D:/source/bzr/mysql-6.0-backup-merge/ 2657 Chuck Bell 2008-07-09 BUG#34965 Online backup table has incorrect column name Changes name of column in mysql.online_backup from 'engines' to 'drivers'. modified: mysql-test/r/backup_no_be.result mysql-test/r/backup_progress.result mysql-test/t/backup_no_be.test scripts/mysql_system_tables.sql sql/backup/backup_progress.cc sql/backup/backup_progress.h sql/backup/logger.h === modified file 'mysql-test/r/backup_no_be.result' --- a/mysql-test/r/backup_no_be.result 2008-07-09 07:12:43 +0000 +++ b/mysql-test/r/backup_no_be.result 2008-07-09 18:37:42 +0000 @@ -14,8 +14,8 @@ SHOW WARNINGS; Level Code Message SELECT max(backup_id) INTO @id FROM mysql.online_backup WHERE command LIKE 'BACKUP DATABASE db1 %'; -SELECT engines FROM mysql.online_backup WHERE backup_id=@id; -engines +SELECT drivers FROM mysql.online_backup WHERE backup_id=@id; +drivers MyISAM SET SESSION debug="d,backup_test_dummy_be_factory"; SELECT @@debug; @@ -29,8 +29,8 @@ Level Code Message Warning # Cannot create backup engine for storage engine MyISAM SELECT max(backup_id) INTO @id FROM mysql.online_backup WHERE command LIKE 'BACKUP DATABASE db1 %'; -SELECT engines FROM mysql.online_backup WHERE backup_id=@id; -engines +SELECT drivers FROM mysql.online_backup WHERE backup_id=@id; +drivers Default RESTORE FROM 'db1.bak'; backup_id === modified file 'mysql-test/r/backup_progress.result' --- a/mysql-test/r/backup_progress.result 2008-07-01 20:32:27 +0000 +++ b/mysql-test/r/backup_progress.result 2008-07-09 18:37:42 +0000 @@ -81,7 +81,7 @@ username root backup_file backup_progress_orig.bak user_comment command BACKUP DATABASE backup_progress to 'backup_progress_orig.bak' -engines MyISAM, Default, Snapshot +drivers MyISAM, Default, Snapshot SELECT obp.* FROM mysql.online_backup_progress AS obp JOIN backup_progress.t1_res AS t1 ON obp.backup_id = t1.id; backup_id object start_time stop_time total_bytes progress error_num notes # backup kernel # # 0 0 0 starting @@ -138,7 +138,7 @@ username root backup_file backup_progress_orig.bak user_comment command RESTORE FROM 'backup_progress_orig.bak' -engines MyISAM, Default, Snapshot +drivers MyISAM, Default, Snapshot SELECT obp.* FROM mysql.online_backup_progress AS obp JOIN backup_progress.t1_res AS t1 ON obp.backup_id = t1.id; backup_id object start_time stop_time total_bytes progress error_num notes # backup kernel # # 0 0 0 starting === modified file 'mysql-test/t/backup_no_be.test' --- a/mysql-test/t/backup_no_be.test 2008-07-09 07:12:43 +0000 +++ b/mysql-test/t/backup_no_be.test 2008-07-09 18:37:42 +0000 @@ -51,7 +51,7 @@ WHERE command LIKE 'BACKUP DATABASE db1 # native backup for MyISAM. But when it is added, the SELECT below should list native # MYISAM engine. -SELECT engines FROM mysql.online_backup WHERE backup_id=@id; +SELECT drivers FROM mysql.online_backup WHERE backup_id=@id; # Now see what happens when injected code is activated and MyISAM uses the dummy # factory function. @@ -79,7 +79,7 @@ SHOW WARNINGS; SELECT max(backup_id) INTO @id FROM mysql.online_backup WHERE command LIKE 'BACKUP DATABASE db1 %'; -SELECT engines FROM mysql.online_backup WHERE backup_id=@id; +SELECT drivers FROM mysql.online_backup WHERE backup_id=@id; # check that we can restore from the created image. === modified file 'scripts/mysql_system_tables.sql' --- a/scripts/mysql_system_tables.sql 2008-02-27 10:04:05 +0000 +++ b/scripts/mysql_system_tables.sql 2008-07-09 18:37:42 +0000 @@ -83,7 +83,7 @@ DROP PREPARE stmt; CREATE TABLE IF NOT EXISTS event ( db char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', name char(64) CHARACTER SET utf8 NOT NULL default '', body longblob NOT NULL, definer char(77) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', execute_at DATETIME default NULL, interval_value int(11) default NULL, interval_field ENUM('YEAR','QUARTER','MONTH','DAY','HOUR','MINUTE','WEEK','SECOND','MICROSECOND','YEAR_MONTH','DAY_HOUR','DAY_MINUTE','DAY_SECOND','HOUR_MINUTE','HOUR_SECOND','MINUTE_SECOND','DAY_MICROSECOND','HOUR_MICROSECOND','MINUTE_MICROSECOND','SECOND_MICROSECOND') default NULL, created TIMESTAMP NOT NULL, modified TIMESTAMP NOT NULL, last_executed DATETIME default NULL, starts DATETIME default NULL, ends DATETIME default NULL, status ENUM('ENABLED','DISABLED','SLAVESIDE_DISABLED') NOT NULL default 'ENABLED', on_completion ENUM('DROP','PRESERVE') NOT NULL default 'DROP', sql_mode set('REAL_AS_FLOAT','PIPES_AS_CONCAT','ANSI_QUOTES','IGNORE_SPACE','! NOT_USED','ONLY_FULL_GROUP_BY','NO_UNSIGNED_SUBTRACTION','NO_DIR_IN_CREATE','POSTGRESQL','ORACLE','MSSQL','DB2','MAXDB','NO_KEY_OPTIONS','NO_TABLE_OPTIONS','NO_FIELD_OPTIONS','MYSQL323','MYSQL40','ANSI','NO_AUTO_VALUE_ON_ZERO','NO_BACKSLASH_ESCAPES','STRICT_TRANS_TABLES','STRICT_ALL_TABLES','NO_ZERO_IN_DATE','NO_ZERO_DATE','INVALID_DATES','ERROR_FOR_DIVISION_BY_ZERO','TRADITIONAL','NO_AUTO_CREATE_USER','HIGH_NOT_PRECEDENCE','NO_ENGINE_SUBSTITUTION','PAD_CHAR_TO_FULL_LENGTH') DEFAULT '' NOT NULL, comment char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL default '', originator int(10) NOT NULL, time_zone char(64) CHARACTER SET latin1 NOT NULL DEFAULT 'SYSTEM', character_set_client char(32) collate utf8_bin, collation_connection char(32) collate utf8_bin, db_collation char(32) collate utf8_bin, body_utf8 longblob, PRIMARY KEY (db, name) ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COMMENT 'Events'; -CREATE TABLE IF NOT EXISTS online_backup ( backup_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT 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 DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64) 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 COMMENT 'The size of the backup repository in bytes', validity_point_time datetime COMMENT 'The time of the validity point.', start_time datetime COMMENT 'The date/time ! of start of operation', stop_time datetime COMMENT 'The date/time of end of operation', host_or_server_name CHAR (30) COMMENT 'The server name where operation ran', username CHAR (30) COMMENT 'The user name who ran the operation', backup_file CHAR (100) COMMENT 'The name of the file', user_comment VARCHAR (200) DEFAULT NULL COMMENT 'The comment from user entered at command line', command VARCHAR (512) COMMENT 'The command used to issue operation', engines VARCHAR (100) COMMENT 'The name of the storage engines used in the operation') ENGINE=MYISAM; +CREATE TABLE IF NOT EXISTS online_backup ( backup_id BIGINT UNSIGNED PRIMARY KEY AUTO_INCREMENT 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 DEFAULT 0 COMMENT 'The recorded binlog position of backup/restore', binlog_file CHAR(64) 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 COMMENT 'The size of the backup repository in bytes', validity_point_time datetime COMMENT 'The time of the validity point.', start_time datetime COMMENT 'The date/time ! of start of operation', stop_time datetime COMMENT 'The date/time of end of operation', host_or_server_name CHAR (30) COMMENT 'The server name where operation ran', username CHAR (30) COMMENT 'The user name who ran the operation', backup_file CHAR (100) COMMENT 'The name of the file', user_comment VARCHAR (200) DEFAULT NULL COMMENT 'The comment from user entered at command line', command VARCHAR (512) COMMENT 'The command used to issue operation', drivers VARCHAR (100) COMMENT 'The name of the storage engine backup drivers used in the operation') ENGINE=MYISAM; CREATE TABLE IF NOT EXISTS online_backup_progress ( backup_id BIGINT UNSIGNED NOT NULL COMMENT 'Key for online_backup table entries', object CHAR (30) NOT NULL COMMENT 'The object being operated on', start_time datetime COMMENT 'The date/time of start of operation', stop_time datetime COMMENT 'The date/time of end of operation', total_bytes BIGINT COMMENT 'The size of the object in bytes', progress BIGINT UNSIGNED COMMENT 'The number of bytes processed', error_num INT NOT NULL DEFAULT 0 COMMENT 'The error from this run 0 == none', notes CHAR(100) COMMENT 'Commentary from the backup engine') ENGINE=MYISAM; === modified file 'sql/backup/backup_progress.cc' --- a/sql/backup/backup_progress.cc 2008-07-09 07:12:43 +0000 +++ b/sql/backup/backup_progress.cc 2008-07-09 18:37:42 +0000 @@ -361,9 +361,9 @@ bool backup_history_log_update(THD *thd, } break; } - case ET_OBH_FIELD_ENGINES: + case ET_OBH_FIELD_DRIVERS: { - String str; // engines string + String str; // drivers string str.length(0); table->field[fld]->val_str(&str); if (str.length() > 0) @@ -815,9 +815,9 @@ int report_ob_vp_time(THD *thd, } /** - Update the engines string for the row that matches the backup_id. + Update the drivers string for the row that matches the backup_id. - This method updates the engines information for the backup operation + This method updates the drivers information for the backup operation identified by backup_id. This method appends to the those listed in the table for the backup_id. @@ -828,15 +828,15 @@ int report_ob_vp_time(THD *thd, @retval 0 success @retval 1 failed to find row */ -int report_ob_engines(THD *thd, +int report_ob_drivers(THD *thd, ulonglong backup_id, - const char *engine_name) + const char *driver_name) { int ret= 0; // return value - DBUG_ENTER("report_ob_engines()"); + DBUG_ENTER("report_ob_drivers()"); - ret= backup_history_log_update(thd, backup_id, ET_OBH_FIELD_ENGINES, - 0, 0, engine_name, 0); + ret= backup_history_log_update(thd, backup_id, ET_OBH_FIELD_DRIVERS, + 0, 0, driver_name, 0); DBUG_RETURN(ret); } === modified file 'sql/backup/backup_progress.h' --- a/sql/backup/backup_progress.h 2008-03-21 09:05:40 +0000 +++ b/sql/backup/backup_progress.h 2008-07-09 18:37:42 +0000 @@ -44,7 +44,7 @@ enum enum_backup_history_table_field ET_OBH_FIELD_BACKUP_FILE, ET_OBH_FIELD_COMMENT, ET_OBH_FIELD_COMMAND, - ET_OBH_FIELD_ENGINES, + ET_OBH_FIELD_DRIVERS, ET_OBH_FIELD_COUNT /* a cool trick to count the number of fields :) */ }; @@ -218,13 +218,13 @@ int report_ob_vp_time(THD *thd, time_t vp_time); /* - This method updates the engines information for the backup operation + This method updates the drivers information for the backup operation identified by backup_id. This method appends to the those listed in the table for the backup_id. */ -int report_ob_engines(THD *thd, +int report_ob_drivers(THD *thd, ulonglong backup_id, - const char *engine_name); + const char *driver_name); /* This method inserts a new row in the progress table. === modified file 'sql/backup/logger.h' --- a/sql/backup/logger.h 2008-06-25 13:39:04 +0000 +++ b/sql/backup/logger.h 2008-07-09 18:37:42 +0000 @@ -299,7 +299,7 @@ void Logger::report_driver(const char *n { DBUG_ASSERT(m_state == READY || m_state == RUNNING); - report_ob_engines(m_thd, m_op_id, name); + report_ob_drivers(m_thd, m_op_id, name); } } // backup namespace