From: Date: October 20 2006 3:07pm Subject: bk commit into 5.1 tree (mskold:1.2317) BUG#21873 List-Archive: http://lists.mysql.com/commits/14067 X-Bug: 21873 Message-Id: <20061020130753.ED75D1CEEE7@linux.site> Below is the list of changes that have just been committed into a local 5.1 repository of marty. When marty 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, 2006-10-20 15:07:39+02:00, mskold@stripped +4 -0 bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info if table->key_info is not set mysql-test/r/ndb_index_unique.result@stripped, 2006-10-20 15:07:15+02:00, mskold@stripped +3 -0 bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info if table->key_info is not set mysql-test/t/ndb_index_unique.test@stripped, 2006-10-20 15:07:15+02:00, mskold@stripped +8 -0 bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info if table->key_info is not set sql/ha_ndbcluster.cc@stripped, 2006-10-20 15:07:15+02:00, mskold@stripped +7 -4 bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info if table->key_info is not set sql/ha_ndbcluster.h@stripped, 2006-10-20 15:07:15+02:00, mskold@stripped +1 -1 bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table: Use passed key_info if table->key_info is not set # This is a BitKeeper patch. What follows are the unified diffs for the # set of deltas contained in the patch. The rest of the patch, the part # that BitKeeper cares about, is below these diffs. # User: mskold # Host: linux.site # Root: /windows/Linux_space/MySQL/mysql-5.1-new-ndb --- 1.28/mysql-test/r/ndb_index_unique.result 2006-10-20 15:07:52 +02:00 +++ 1.29/mysql-test/r/ndb_index_unique.result 2006-10-20 15:07:52 +02:00 @@ -639,3 +639,6 @@ select a, sha1(b) from t1; a sha1(b) 1 08f5d02c8b8bc244f275bdfc22c42c5cab0d9d7d drop table t1; +create table t1(id int not null) engine = NDB; +alter table t1 add constraint uk_test unique (id) using hash; +drop table t1; --- 1.22/mysql-test/t/ndb_index_unique.test 2006-10-20 15:07:52 +02:00 +++ 1.23/mysql-test/t/ndb_index_unique.test 2006-10-20 15:07:52 +02:00 @@ -329,4 +329,12 @@ select a, sha1(b) from t1; drop table t1; +# bug#21873 MySQLD Crash on ALTER...ADD..UNIQUE..USING HASH statement for NDB backed table + +create table t1(id int not null) engine = NDB; + +alter table t1 add constraint uk_test unique (id) using hash; + +drop table t1; + # End of 4.1 tests --- 1.362/sql/ha_ndbcluster.cc 2006-10-20 15:07:52 +02:00 +++ 1.363/sql/ha_ndbcluster.cc 2006-10-20 15:07:52 +02:00 @@ -1399,9 +1399,8 @@ NDB_INDEX_TYPE ha_ndbcluster::get_index_ ORDERED_INDEX); } -int ha_ndbcluster::check_index_fields_not_null(uint inx) +int ha_ndbcluster::check_index_fields_not_null(KEY* key_info) { - KEY* key_info= table->key_info + inx; KEY_PART_INFO* key_part= key_info->key_part; KEY_PART_INFO* end= key_part+key_info->key_parts; DBUG_ENTER("ha_ndbcluster::check_index_fields_not_null"); @@ -5015,10 +5014,14 @@ int ha_ndbcluster::create_index(const ch if (!(error= create_ordered_index(name, key_info))) error= create_unique_index(unique_name, key_info); break; - case UNIQUE_INDEX: - if (!(error= check_index_fields_not_null(idx_no))) + case UNIQUE_INDEX: { + KEY* table_key_info= + (table->key_info) ? table->key_info + idx_no : key_info; + + if (!(error= check_index_fields_not_null(table_key_info))) error= create_unique_index(unique_name, key_info); break; + } case ORDERED_INDEX: error= create_ordered_index(name, key_info); break; --- 1.153/sql/ha_ndbcluster.h 2006-10-20 15:07:52 +02:00 +++ 1.154/sql/ha_ndbcluster.h 2006-10-20 15:07:52 +02:00 @@ -808,7 +808,7 @@ private: NDB_INDEX_TYPE get_index_type_from_table(uint index_no) const; NDB_INDEX_TYPE get_index_type_from_key(uint index_no, KEY *key_info, bool primary) const; - int check_index_fields_not_null(uint index_no); + int check_index_fields_not_null(KEY* key_info); uint set_up_partition_info(partition_info *part_info, TABLE *table,