From: Date: October 20 2006 2:24pm Subject: bk commit into 5.1 tree (jonas:1.2308) BUG#22838 List-Archive: http://lists.mysql.com/commits/14058 X-Bug: 22838 Message-Id: <20061020122425.4BA9F5C4A90@perch.ndb.mysql.com> Below is the list of changes that have just been committed into a local 5.1 repository of jonas. When jonas 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 14:24:20+02:00, jonas@stripped +1 -0 ndb - bug#22838 when doing create unique index which mysql will silently converts to PK, ndb is not informed so table will be useless. change so that we never do online add index wo/ primary key. this is not good, but it's better than a useless table sql/ha_ndbcluster.cc@stripped, 2006-10-20 14:24:18+02:00, jonas@stripped +25 -0 ndb - bug#22838 when doing create unique index which mysql will silently converts to PK, ndb is not informed so table will be useless. change so that we never do online add index wo/ primary key. this is not good, but it's better than a useless table # 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: jonas # Host: perch.ndb.mysql.com # Root: /home/jonas/src/51-work --- 1.358/sql/ha_ndbcluster.cc 2006-10-20 14:24:25 +02:00 +++ 1.359/sql/ha_ndbcluster.cc 2006-10-20 14:24:25 +02:00 @@ -10113,6 +10113,8 @@ DBUG_RETURN(COMPATIBLE_DATA_NO); } + int pk= 0; + int ai= 0; for (i= 0; i < table->s->fields; i++) { Field *field= table->field[i]; @@ -10128,9 +10130,32 @@ DBUG_PRINT("info", ("add/drop index not supported for disk stored column")); DBUG_RETURN(COMPATIBLE_DATA_NO); } + + if (field->flags & PRI_KEY_FLAG) + pk=1; + if (field->flags & FIELD_IN_ADD_INDEX) + ai=1; } if (table_changes != IS_EQUAL_YES) DBUG_RETURN(COMPATIBLE_DATA_NO); + + /** + * Changing from/to primary key + * + * This is _not_ correct, but check_if_incompatible_data-interface + * doesnt give more info, so I guess that we can't do any + * online add index if not using primary key + * + * This as mysql will handle a unique not null index as primary + * even wo/ user specifiying it... :-( + * + */ + if ((table_share->primary_key == MAX_KEY && pk) || + (table_share->primary_key != MAX_KEY && !pk) || + (table_share->primary_key == MAX_KEY && !pk && ai)) + { + DBUG_RETURN(COMPATIBLE_DATA_NO); + } /* Check that auto_increment value was not changed */ if ((info->used_fields & HA_CREATE_USED_AUTO) &&