#At file:///home/ngb/mysql/bzr/telco6.3-bug35599/
2662 Guangbao Ni 2008-08-12 [merge]
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
constrait violation test
sql/ha_ndbcluster.cc
share shouldn't be freed in alter_frm(),
it should be freed and have 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 12:47:40 +0000
@@ -33,3 +33,14 @@ 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);
+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-11-29 10:29:35 +0000
+++ b/mysql-test/suite/ndb/t/ndb_alter_table3.test 2008-08-12 13:52:59 +0000
@@ -45,3 +45,21 @@ 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;
+--disable_result_log
+--error 1022
+insert into t6 values(1,12), (2,12);
+--enable_result_log
+--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 11:51:34 +0000
+++ b/sql/ha_ndbcluster.cc 2008-08-12 13:52:59 +0000
@@ -11799,7 +11799,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);
}
@@ -11839,8 +11838,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:2662) Bug#35599 | Guangbao Ni | 12 Aug 2008 |