List:Commits« Previous MessageNext Message »
From:Satya B Date:January 21 2009 11:21am
Subject:bzr commit into mysql-5.1-bugteam branch (satya.bn:2749) Bug#41574
View as plain text  
#At file:///home/satya/WORK/mysql-5.1-bugteam-41574/

 2749 Satya B	2009-01-21
      Fix for BUG#41574 REPAIR TABLE: crashes for compressed tables
      
      REPAIR TABLE after myisam compression on myisam tables crashes the server
      
      After the table is compressed , it becomes read-only. When opening the tables
      for repair,the server detects the table as read-only but it doesn't send the
      error message properly. 
modified:
  mysql-test/r/repair.result
  mysql-test/t/repair.test
  sql/lock.cc

per-file messages:
  mysql-test/r/repair.result
    Result file for the modified repair.test
  mysql-test/t/repair.test
    test case added to test REPAIR TABLE for compressed tables
  sql/lock.cc
    Fixed get_lock_data() to reset (main_da.reset_diagonstics_area()) when it detects to send the error "table is read only"
=== modified file 'mysql-test/r/repair.result'
--- a/mysql-test/r/repair.result	2008-06-18 01:05:56 +0000
+++ b/mysql-test/r/repair.result	2009-01-21 11:21:00 +0000
@@ -157,3 +157,19 @@ REPAIR TABLE tt1 USE_FRM;
 Table	Op	Msg_type	Msg_text
 tt1	repair	error	Cannot repair temporary table from .frm file
 DROP TABLE tt1;
+# ====== REPAIR COMPRESSED TABLE WHEN UNLOCKED ==========
+CREATE TABLE t1 (i INT NOT NULL);
+FLUSH TABLES;
+REPAIR TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	error	Table 'test.t1' is read only
+Warnings:
+Error	1036	Table 't1' is read only
+DROP TABLE t1;
+# ====== REPAIR COMPRESSED TABLE WHEN LOCKED ==========
+CREATE TABLE t1 ( i INT NOT NULL);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+REPAIR TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	status	OK
+DROP TABLE t1;

=== modified file 'mysql-test/t/repair.test'
--- a/mysql-test/t/repair.test	2008-05-12 19:37:45 +0000
+++ b/mysql-test/t/repair.test	2009-01-21 11:21:00 +0000
@@ -156,3 +156,35 @@ CREATE TEMPORARY TABLE tt1 (c1 INT);
 REPAIR TABLE tt1 USE_FRM;
 DROP TABLE tt1;
 
+#
+# BUG#41574 - REPAIR TABLE: crashes for compressed tables
+#
+##########################################################################
+# Testcase REPARI TABLE.1: testcase for REPAIR TABLE to test compressed
+# tables when they are not locked (FLUSH TABLES used)
+##########################################################################
+--echo # ====== REPAIR COMPRESSED TABLE WHEN UNLOCKED ==========
+CREATE TABLE t1 (i INT NOT NULL);
+FLUSH TABLES;
+--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
+REPAIR TABLE t1;
+DROP TABLE t1;
+
+##########################################################################
+# Testcase REPARI TABLE.2: testcase for REPAIR TABLE to test compressed
+# tables when they are locked (FLUSH TABLES NOT used)
+##########################################################################
+--echo # ====== REPAIR COMPRESSED TABLE WHEN LOCKED ==========
+CREATE TABLE t1 ( i INT NOT NULL);
+INSERT INTO t1 VALUES (1),(2),(3),(4),(5),(6),(7),(8);
+let $i=9;
+--disable_query_log
+while ($i)
+{
+ INSERT INTO t1 SELECT * FROM t1; 
+ dec $i; 
+}
+--enable_query_log
+--exec $MYISAMPACK $MYSQLTEST_VARDIR/master-data/test/t1
+REPAIR TABLE t1;
+DROP TABLE t1;

=== modified file 'sql/lock.cc'
--- a/sql/lock.cc	2008-11-10 20:21:49 +0000
+++ b/sql/lock.cc	2009-01-21 11:21:00 +0000
@@ -864,6 +864,8 @@ static MYSQL_LOCK *get_lock_data(THD *th
         /* Clear the lock type of the lock data that are stored already. */
         sql_lock->lock_count= locks - sql_lock->locks;
         reset_lock_data(sql_lock);
+        if (thd->main_da.is_error())
+          thd->main_da.reset_diagnostics_area();
 	my_free((uchar*) sql_lock,MYF(0));
 	DBUG_RETURN(0);
       }

Thread
bzr commit into mysql-5.1-bugteam branch (satya.bn:2749) Bug#41574Satya B21 Jan