List:Commits« Previous MessageNext Message »
From:Guangbao Ni Date:August 12 2008 1:04pm
Subject:bzr commit into mysql-5.1 branch (gni:2645) Bug#35599
View as plain text  
#At file:///home/ngb/mysql/bzr/telco6.2-bug35599/

 2645 Guangbao Ni	2008-08-12
      BUG#35599 Mysqld crash after delete records from table (with constraint violation)
modified:
  mysql-test/suite/ndb/r/ndb_alter_table3.result
  mysql-test/suite/ndb/t/ndb_alter_table3.test
  sql/ha_ndbcluster.cc

per-file messages:
  mysql-test/suite/ndb/r/ndb_alter_table3.result
    constraint violation test result
  mysql-test/suite/ndb/t/ndb_alter_table3.test
    constraint violation test (bug#35599)
  sql/ha_ndbcluster.cc
    share shouldn't be freed in alter_frm().
    It should be freed and freed at the end of alter_table_phase2() function.
=== modified file 'mysql-test/suite/ndb/r/ndb_alter_table3.result'
--- a/mysql-test/suite/ndb/r/ndb_alter_table3.result	2007-06-27 12:28:02 +0000
+++ b/mysql-test/suite/ndb/r/ndb_alter_table3.result	2008-08-12 11:04:38 +0000
@@ -33,3 +33,15 @@ a
 drop table t4;
 show tables;
 Tables_in_test
+drop table if exists t6;
+create table t6 (a int primary key ,b int) engine=ndbcluster;
+insert into t6 values(1,12), (2,12);
+alter table t6 add unique key ui_t(b);
+ERROR 23000: Can't write, because of unique constraint, to table 't6'
+delete from t6;
+insert into t6 values(1,12), (2,12);
+ERROR 23000: Can't write; duplicate key in table 't6'
+alter table t6 add unique key ui_t(b);
+ERROR HY000: Got error 156 'Unknown error code' from NDBCLUSTER
+delete from t6;
+drop table t6;

=== modified file 'mysql-test/suite/ndb/t/ndb_alter_table3.test'
--- a/mysql-test/suite/ndb/t/ndb_alter_table3.test	2007-07-04 20:38:53 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table3.test	2008-08-12 11:04:38 +0000
@@ -46,3 +46,19 @@ select * from t4;
 drop table t4;
 show tables;
 connection server1;
+
+--disable_warnings
+drop table if exists t6;
+--enable_warnings
+create table t6 (a int primary key ,b int) engine=ndbcluster;
+insert into t6 values(1,12), (2,12);
+--error 1169
+alter table t6 add unique key ui_t(b);
+delete from t6;
+--error 1022
+insert into t6 values(1,12), (2,12);
+--error 1296
+alter table t6 add unique key ui_t(b);
+delete from t6;
+drop table t6;
+

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	2008-08-07 05:29:44 +0000
+++ b/sql/ha_ndbcluster.cc	2008-08-12 11:04:38 +0000
@@ -10669,7 +10669,6 @@ int ha_ndbcluster::alter_frm(THD *thd, c
   /* ndb_share reference schema(?) free */
   DBUG_PRINT("NDB_SHARE", ("%s binlog schema(?) free  use_count: %u",
                            m_share->key, m_share->use_count));
-  free_share(&m_share); // Decrease ref_count
 
   DBUG_RETURN(error);
 }
@@ -10709,8 +10708,8 @@ int ha_ndbcluster::alter_table_phase2(TH
     /* ndb_share reference schema free */
     DBUG_PRINT("NDB_SHARE", ("%s binlog schema free  use_count: %u",
                              m_share->key, m_share->use_count));
-    free_share(&m_share); // Decrease ref_count
   }
+  free_share(&m_share); // Decrease ref_count
   delete alter_data;
   DBUG_RETURN(error);
 }

Thread
bzr commit into mysql-5.1 branch (gni:2645) Bug#35599Guangbao Ni12 Aug