Below is the list of changes that have just been committed into a local
6.0 repository of cbell. When cbell does a push these changes
will be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html
ChangeSet@stripped, 2008-05-06 14:04:24-04:00, cbell@mysql_cab_desk. +3 -0
BUG#35249 : Mysql server crash for delete operation followed by backup in memory SE
Patch allows default and consistent snapshot drivers to skip deleted
rows on backup.
mysql-test/r/backup.result@stripped, 2008-05-06 14:04:19-04:00, cbell@mysql_cab_desk. +35 -0
BUG#35249 : Mysql server crash for delete operation followed by backup in memory SE
New result file.
mysql-test/t/backup.test@stripped, 2008-05-06 14:04:20-04:00, cbell@mysql_cab_desk. +32 -0
BUG#35249 : Mysql server crash for delete operation followed by backup in memory SE
New test to backup when rows are deleted.
sql/backup/be_default.cc@stripped, 2008-05-06 14:04:21-04:00, cbell@mysql_cab_desk. +6 -0
BUG#35249 : Mysql server crash for delete operation followed by backup in memory SE
Added code to skip deleted rows.
diff -Nrup a/mysql-test/r/backup.result b/mysql-test/r/backup.result
--- a/mysql-test/r/backup.result 2008-03-31 03:16:54 -04:00
+++ b/mysql-test/r/backup.result 2008-05-06 14:04:19 -04:00
@@ -523,4 +523,39 @@ COUNT(*)
SELECT COUNT(*) FROM bup_default.wide;
COUNT(*)
1
+create the database
+CREATE DATABASE bup_delete;
+create a table and populate it
+CREATE TABLE bup_delete.me(id int, ccode varchar(20)) ENGINE=MEMORY;
+INSERT INTO bup_delete.me VALUES (1,'aa'),(2,'bb'),(3,'cc'),(4,'dd');
+show the data
+SELECT * FROM bup_delete.me;
+id ccode
+1 aa
+2 bb
+3 cc
+4 dd
+delete a row
+DELETE FROM bup_delete.me WHERE ccode='cc';
+do backup
+BACKUP DATABASE bup_delete TO 'bup_delete.bak';
+backup_id
+#
+show the data
+SELECT * FROM bup_delete.me;
+id ccode
+1 aa
+2 bb
+4 dd
+do restore
+RESTORE FROM 'bup_delete.bak';
+backup_id
+#
+show the data
+SELECT * FROM bup_delete.me;
+id ccode
+1 aa
+2 bb
+4 dd
+DROP DATABASE IF EXISTS bup_delete;
DROP DATABASE IF EXISTS bup_default;
diff -Nrup a/mysql-test/t/backup.test b/mysql-test/t/backup.test
--- a/mysql-test/t/backup.test 2008-03-31 03:16:54 -04:00
+++ b/mysql-test/t/backup.test 2008-05-06 14:04:20 -04:00
@@ -391,11 +391,43 @@ SELECT * FROM bup_default.t2;
SELECT COUNT(*) FROM bup_default.t1_blob;
SELECT COUNT(*) FROM bup_default.wide;
+#
+# BUG#35249 : Test backup when rows are deleted
+#
+
+--echo create the database
+CREATE DATABASE bup_delete;
+
+--echo create a table and populate it
+CREATE TABLE bup_delete.me(id int, ccode varchar(20)) ENGINE=MEMORY;
+INSERT INTO bup_delete.me VALUES (1,'aa'),(2,'bb'),(3,'cc'),(4,'dd');
+
+--echo show the data
+SELECT * FROM bup_delete.me;
+
+--echo delete a row
+DELETE FROM bup_delete.me WHERE ccode='cc';
+
+--echo do backup
+--replace_column 1 #
+BACKUP DATABASE bup_delete TO 'bup_delete.bak';
+
+--echo show the data
+SELECT * FROM bup_delete.me;
+
+--echo do restore
+--replace_column 1 #
+RESTORE FROM 'bup_delete.bak';
+
+--echo show the data
+SELECT * FROM bup_delete.me;
--disable_warnings
+DROP DATABASE IF EXISTS bup_delete;
DROP DATABASE IF EXISTS bup_default;
--enable_warnings
+--remove_file $MYSQLTEST_VARDIR/master-data/bup_delete.bak
--remove_file $MYSQLTEST_VARDIR/master-data/bup_default.bak
--error 0,1
--remove_file $MYSQLTEST_VARDIR/master-data/test.ba
diff -Nrup a/sql/backup/be_default.cc b/sql/backup/be_default.cc
--- a/sql/backup/be_default.cc 2008-03-04 11:08:40 -05:00
+++ b/sql/backup/be_default.cc 2008-05-06 14:04:21 -04:00
@@ -363,6 +363,12 @@ result_t Backup::get_data(Buffer &buf)
cur_blob= 0;
cur_table->use_all_columns();
last_read_res = hdl->rnd_next(cur_table->record[0]);
+ /*
+ Skip all records marked as deleted.
+ */
+ while ((last_read_res == HA_ERR_RECORD_DELETED) &&
+ (last_read_res != HA_ERR_END_OF_FILE))
+ last_read_res = hdl->rnd_next(cur_table->record[0]);
DBUG_EXECUTE_IF("SLEEP_DRIVER", sleep(4););
/*
If we are end of file, stop the read process and signal the
| Thread |
|---|
| • bk commit into 6.0 tree (cbell:1.2616) BUG#35249 | cbell | 6 May |