MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Jorgen Loland Date:August 18 2008 8:26am
Subject:bzr commit into mysql-6.0 branch (jorgen.loland:2675) Bug#33566, Bug#35117,
Bug#36792
View as plain text  
#At file:///localhome/jl208045/mysql/mysql-6.0-backup-35117/

 2675 Jorgen Loland	2008-08-18
      Bug#35117 - Backup: Server crash for backup of CSV engine with CHAR data type
      Bug 33566 - Backup: crash with partitions and Falcon
      Bug 36792 - Assertion table->in_use == current_thd in Field_string::store, line 6259
                  
      Patch attached to 35117 but applies to all three bugs.
                  
      Before: With default driver, the table->in_use variable is set
      to point to the locking thread when a table is locked. The
      variable points to the wrong thread (i.e., the locking 
      thread) when backup later tries to get the data from the table.
                  
      Now: Before getting data from a table, the default driver sets
      the table->in_use pointer to the backup thread.
added:
  mysql-test/r/backup_default.result
  mysql-test/t/backup_default.test
modified:
  sql/backup/be_default.cc

per-file comments:
  mysql-test/r/backup_default.result
    Tests checking backup is correct when default driver is used.
  mysql-test/t/backup_default.test
    Tests checking backup is correct when default driver is used.
  sql/backup/be_default.cc
    Set cur_table->in_use pointer to the backup thread when moving to next table.
=== added file 'mysql-test/r/backup_default.result'
--- a/mysql-test/r/backup_default.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/backup_default.result	2008-08-18 08:25:56 +0000
@@ -0,0 +1,109 @@
+
+Server should not crash for backup using default driver - CSV
+Test for bug#35117
+
+DROP DATABASE IF EXISTS db1;
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE csv_table(
+id int NOT NULL,
+name char(20) NOT NULL,
+city varchar(20) NOT NULL) 
+ENGINE=csv;
+INSERT INTO csv_table VALUES(1,'aa1','bb1'),(2,'aa2','bb2'),(3,'aa3','bb3');
+backup on csv only
+BACKUP DATABASE db1 to 'bup_csv.bak';
+backup_id
+#
+DROP DATABASE db1;
+restore on csv only
+RESTORE FROM 'bup_csv.bak';
+backup_id
+#
+testing content in restored tables
+SELECT * FROM csv_table ORDER BY id;
+id	name	city
+1	aa1	bb1
+2	aa2	bb2
+3	aa3	bb3
+DROP DATABASE db1;
+
+Server should not crash for backup using default driver 
+Partitioned Falcon tables
+Test for bug#33566, bug#36792 
+
+CREATE DATABASE db1;
+USE db1;
+CREATE TABLE partition_table (
+int_column int(11), 
+char_column char(5))
+engine=falcon
+PARTITION BY HASH (int_column);
+INSERT INTO partition_table VALUES (0,'pVtIa');
+INSERT INTO partition_table VALUES (5,'jTfSg');
+INSERT INTO partition_table VALUES (20,'UezFi');
+INSERT INTO partition_table VALUES (25,'cxmeH');
+INSERT INTO partition_table VALUES (65,'lIuNS');
+backup on partitioned falcon
+BACKUP DATABASE db1 to 'bup_falcon.bak';
+backup_id
+#
+DROP DATABASE db1;
+restore on partitioned falcon
+RESTORE FROM 'bup_falcon.bak';
+backup_id
+#
+testing content in restored tables
+SELECT * FROM partition_table ORDER BY int_column;
+int_column	char_column
+0	pVtIa
+5	jTfSg
+20	UezFi
+25	cxmeH
+65	lIuNS
+
+Server should not crash for backup using default driver 
+Mix of tables
+
+CREATE TABLE csv_table(
+id int NOT NULL,
+name char(20) NOT NULL,
+city varchar(20) NOT NULL) 
+ENGINE=csv;
+INSERT INTO csv_table VALUES(1,'aa1','bb1'),(2,'aa2','bb2'),(3,'aa3','bb3');
+CREATE TABLE myisam_table(
+i int,
+v varchar(20))
+ENGINE=myisam;
+INSERT INTO myisam_table VALUES(1,'v1'),(2,'v2'),(3,'v3');
+backup on mixed table database
+BACKUP DATABASE db1 to 'bup_mixed.bak';
+backup_id
+#
+DROP DATABASE db1;
+restore on mixed table database
+RESTORE FROM 'bup_mixed.bak';
+backup_id
+#
+testing content in restored tables
+SELECT * FROM partition_table ORDER BY int_column;
+int_column	char_column
+0	pVtIa
+5	jTfSg
+20	UezFi
+25	cxmeH
+65	lIuNS
+SELECT * FROM csv_table ORDER BY id;
+id	name	city
+1	aa1	bb1
+2	aa2	bb2
+3	aa3	bb3
+SELECT * FROM myisam_table ORDER BY i;
+i	v
+1	v1
+2	v2
+3	v3
+
+***  CLEANUP  ****
+
+DROP DATABASE db1;

=== added file 'mysql-test/t/backup_default.test'
--- a/mysql-test/t/backup_default.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/backup_default.test	2008-08-18 08:25:56 +0000
@@ -0,0 +1,130 @@
+###########################################################################
+# Purpose: To test backup using default driver
+###############################################################################
+--source include/have_falcon.inc
+--source include/have_partition.inc
+--source include/not_embedded.inc
+
+--echo
+--echo Server should not crash for backup using default driver - CSV
+--echo Test for bug#35117
+--echo
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+--enable_warnings
+
+CREATE DATABASE db1;
+USE db1;
+
+# csv uses default driver
+CREATE TABLE csv_table(
+   id int NOT NULL,
+   name char(20) NOT NULL,
+   city varchar(20) NOT NULL) 
+ENGINE=csv;
+
+INSERT INTO csv_table VALUES(1,'aa1','bb1'),(2,'aa2','bb2'),(3,'aa3','bb3');
+
+--echo backup on csv only
+--replace_column 1 #
+BACKUP DATABASE db1 to 'bup_csv.bak';
+
+DROP DATABASE db1;
+
+--echo restore on csv only
+--replace_column 1 #
+RESTORE FROM 'bup_csv.bak';
+
+--echo testing content in restored tables
+SELECT * FROM csv_table ORDER BY id;
+
+DROP DATABASE db1;
+
+--echo
+--echo Server should not crash for backup using default driver 
+--echo Partitioned Falcon tables
+--echo Test for bug#33566, bug#36792 
+--echo 
+
+CREATE DATABASE db1;
+USE db1;
+
+CREATE TABLE partition_table (
+  int_column int(11), 
+  char_column char(5))
+engine=falcon
+PARTITION BY HASH (int_column);
+
+INSERT INTO partition_table VALUES (0,'pVtIa');
+INSERT INTO partition_table VALUES (5,'jTfSg');
+INSERT INTO partition_table VALUES (20,'UezFi');
+INSERT INTO partition_table VALUES (25,'cxmeH');
+INSERT INTO partition_table VALUES (65,'lIuNS');
+
+--echo backup on partitioned falcon
+--replace_column 1 #
+BACKUP DATABASE db1 to 'bup_falcon.bak';
+
+DROP DATABASE db1;
+
+--echo restore on partitioned falcon
+--replace_column 1 #
+RESTORE FROM 'bup_falcon.bak';
+
+--echo testing content in restored tables
+SELECT * FROM partition_table ORDER BY int_column;
+
+
+--echo
+--echo Server should not crash for backup using default driver 
+--echo Mix of tables
+--echo 
+
+# partition_table already exists in the database
+# re-create the csv_table
+CREATE TABLE csv_table(
+   id int NOT NULL,
+   name char(20) NOT NULL,
+   city varchar(20) NOT NULL) 
+ENGINE=csv;
+
+INSERT INTO csv_table VALUES(1,'aa1','bb1'),(2,'aa2','bb2'),(3,'aa3','bb3');
+
+# create a myisam table (not default driver)
+CREATE TABLE myisam_table(
+   i int,
+   v varchar(20))
+ENGINE=myisam;
+
+INSERT INTO myisam_table VALUES(1,'v1'),(2,'v2'),(3,'v3');
+
+--echo backup on mixed table database
+--replace_column 1 #
+BACKUP DATABASE db1 to 'bup_mixed.bak';
+
+DROP DATABASE db1;
+
+--echo restore on mixed table database
+--replace_column 1 #
+RESTORE FROM 'bup_mixed.bak';
+
+--echo testing content in restored tables
+SELECT * FROM partition_table ORDER BY int_column;
+SELECT * FROM csv_table ORDER BY id;
+SELECT * FROM myisam_table ORDER BY i;
+
+
+# Test cleanup section
+
+--echo
+--echo ***  CLEANUP  ****
+--echo
+
+
+DROP DATABASE db1;
+
+--remove_file $MYSQLTEST_VARDIR/master-data/bup_csv.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/bup_falcon.bak
+--remove_file $MYSQLTEST_VARDIR/master-data/bup_mixed.bak
+

=== modified file 'sql/backup/be_default.cc'
--- a/sql/backup/be_default.cc	2008-07-09 08:19:03 +0000
+++ b/sql/backup/be_default.cc	2008-08-18 08:25:56 +0000
@@ -381,6 +381,14 @@ result_t Backup::get_data(Buffer &buf)
     read_set=  cur_table->read_set;
     start_tbl_read(cur_table);
 
+    // The first time the table is accessed after opening it,
+    // cur_table->in_use points to the locking thread. It has to point
+    // to the backup thread before the table can be read
+    if (cur_table->in_use != locking_thd->m_thd) {
+      DBUG_ASSERT(cur_table->in_use == locking_thd->lock_thd);
+      cur_table->in_use= locking_thd->m_thd;
+    }
+
     buf.table_num= tbl_num;
     mode= READ_RCD;
   }

Thread
bzr commit into mysql-6.0 branch (jorgen.loland:2675) Bug#33566, Bug#35117,Bug#36792Jorgen Loland18 Aug