Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.2.2, 10.3.0
Description
This was originally reported by Roel as MySQL Bug #89087 Assertion `key->flags & 1' failed.
CREATE TABLE t1(c1 INT) ENGINE=InnoDB; |
ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1); |
ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1); |
DROP TABLE t1; |
There is a fix for this in MySQL 8.0.11, but I think that we should fix this differently in MariaDB, and starting from the first potentially affected version (10.0). I was not able to repeat a failure on 10.0 even after adding a debug assertion.
For 10.2, the minimal fix should be as follows:
diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc
|
index 02a8428cdc9..20bac687ccf 100644
|
--- a/storage/innobase/handler/handler0alter.cc
|
+++ b/storage/innobase/handler/handler0alter.cc
|
@@ -2597,10 +2597,8 @@ innobase_create_key_defs(
|
DBUG_ASSERT(got_default_clust);
|
DBUG_ASSERT(altered_table->s->primary_key
|
== 0);
|
- primary_key_number = 0;
|
- } else {
|
- primary_key_number = *add;
|
}
|
+ primary_key_number = altered_table->s->primary_key;
|
} else if (got_default_clust) {
|
/* Create the GEN_CLUST_INDEX */
|
index_def_t* index = indexdef++; |
Attachments
Activity
Field | Original Value | New Value |
---|---|---|
Description |
This was originally reported by [~Roel] as [MySQL Bug #89087 Assertion `key->flags & 1' failed|https://bugs.mysql.com/bug.php?id=89087|.
{code:sql} CREATE TABLE t1(c1 INT) ENGINE=InnoDB; ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1); ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1); DROP TABLE t1; {code} There is a fix for this in MySQL 8.0.11, but I think that we should fix this differently in MariaDB, and starting from the first potentially affected version (10.0). I was not able to repeat a failure on 10.0 even after adding a debug assertion. For 10.2, the minimal fix should be as follows: {code:diff} diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 02a8428cdc9..20bac687ccf 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2597,10 +2597,8 @@ innobase_create_key_defs( DBUG_ASSERT(got_default_clust); DBUG_ASSERT(altered_table->s->primary_key == 0); - primary_key_number = 0; - } else { - primary_key_number = *add; } + primary_key_number = altered_table->s->primary_key; } else if (got_default_clust) { /* Create the GEN_CLUST_INDEX */ index_def_t* index = indexdef++; {code} |
This was originally reported by [~Roel] as [MySQL Bug #89087 Assertion `key->flags & 1' failed|https://bugs.mysql.com/bug.php?id=89087].
{code:sql} CREATE TABLE t1(c1 INT) ENGINE=InnoDB; ALTER TABLE t1 ADD CONSTRAINT UNIQUE KEY i1(c1); ALTER TABLE t1 CHANGE c1 c1 INT NOT NULL,ADD KEY(c1); DROP TABLE t1; {code} There is a fix for this in MySQL 8.0.11, but I think that we should fix this differently in MariaDB, and starting from the first potentially affected version (10.0). I was not able to repeat a failure on 10.0 even after adding a debug assertion. For 10.2, the minimal fix should be as follows: {code:diff} diff --git a/storage/innobase/handler/handler0alter.cc b/storage/innobase/handler/handler0alter.cc index 02a8428cdc9..20bac687ccf 100644 --- a/storage/innobase/handler/handler0alter.cc +++ b/storage/innobase/handler/handler0alter.cc @@ -2597,10 +2597,8 @@ innobase_create_key_defs( DBUG_ASSERT(got_default_clust); DBUG_ASSERT(altered_table->s->primary_key == 0); - primary_key_number = 0; - } else { - primary_key_number = *add; } + primary_key_number = altered_table->s->primary_key; } else if (got_default_clust) { /* Create the GEN_CLUST_INDEX */ index_def_t* index = indexdef++; {code} |
Fix Version/s | 10.0.35 [ 22912 ] | |
Fix Version/s | 10.1.33 [ 22909 ] | |
Fix Version/s | 10.2.15 [ 23006 ] | |
Fix Version/s | 10.3.7 [ 23005 ] | |
Fix Version/s | 10.2 [ 14601 ] | |
Fix Version/s | 10.0 [ 16000 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Fix Version/s | 10.3 [ 22126 ] | |
Resolution | Fixed [ 1 ] | |
Status | Open [ 1 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 86664 ] | MariaDB v4 [ 154193 ] |