Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

asked 2016-04-17 21:49:35 -0500

don gravatar image

trouble migrating keystone database from juno to mitaka

I have a juno installation of keystone (schema ver 55) and am trying to migrate to mitaka. if i run keystone-manage db_sync on mitaka, it fails with:

KeyError: <VerNum(56)>

OK, so lets try a migration to liberty first. That succeeds without error. Now lets try mitaka again.

2016-04-18 02:39:43.258 2860 ERROR keystone DBError: (_mysql_exceptions.IntegrityError) (1215, 'Cannot add foreign key constraint') [SQL: u'\nCREATE TABLE local_user (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tuser_id VARCHAR(64) NOT NULL, \n\tdomain_id VARCHAR(64) NOT NULL, \n\tname VARCHAR(255) NOT NULL, \n\tPRIMARY KEY (id), \n\tUNIQUE (domain_id, name), \n\tUNIQUE (user_id), \n\tFOREIGN KEY(user_id) REFERENCES user (id) ON DELETE CASCADE\n)\n\n']

ok, why is that?

if i run 'show engine innodb status' i get:

2016-04-17 23:09:32 7f2cd4aed700 Error in foreign key constraint of table keystone/local_user:
FOREIGN KEY(user_id) REFERENCES user (id) ON DELETE CASCADE ):
Cannot find an index in the referenced table where the
referenced columns appear as the first columns, or column types
in the table and the referenced table do not match for constraint.
Note that the internal storage type of ENUM and SET changed in
tables created with >= InnoDB-4.1.12, and such columns in old tables
cannot be referenced by such columns in new tables.
See http://dev.mysql.com/doc/refman/5.6/en/innodb-foreign-key-constraints.html
for correct foreign key definition.

so it is complaining about the foreign key in the local_user table its trying to create.

if i look @ user:

mysql> describe user;
+--------------------+--------------+------+-----+---------+-------+
| Field              | Type         | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| id                 | varchar(64)  | NO   | PRI | NULL    |       |
| name               | varchar(255) | NO   |     | NULL    |       |
| extra              | text         | YES  |     | NULL    |       |
| password           | varchar(128) | YES  |     | NULL    |       |
| enabled            | tinyint(1)   | YES  |     | NULL    |       |
| domain_id          | varchar(64)  | NO   | MUL | NULL    |       |
| default_project_id | varchar(64)  | YES  |     | NULL    |       |
+--------------------+--------------+------+-----+---------+-------+
7 rows in set (0.00 sec)
mysql> show index from user;                                                                                                                                                                                                    +-------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name  | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| user  |          0 | PRIMARY   |            1 | id          | A         |        1055 |     NULL | NULL   |      | BTREE      |         |               |
| user  |          0 | domain_id |            1 | domain_id   | A         |           4 |     NULL | NULL   |      | BTREE      |         |               |
| user  |          0 | domain_id |            2 | name        | A         |        1055 |     NULL | NULL   |      | BTREE      |         |               |
+-------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)

so, uh, any suggestions?

trouble migrating keystone database from juno to mitaka

I have a juno installation of keystone (schema ver 55) and am trying to migrate to mitaka. if i run keystone-manage db_sync on mitaka, it fails with:

KeyError: <VerNum(56)>

OK, so lets try a migration to liberty first. That succeeds without error. Now lets try mitaka again.

2016-04-18 02:39:43.258 2860 ERROR keystone DBError: (_mysql_exceptions.IntegrityError) (1215, 'Cannot add foreign key constraint') [SQL: u'\nCREATE TABLE local_user (\n\tid INTEGER NOT NULL AUTO_INCREMENT, \n\tuser_id VARCHAR(64) NOT NULL, \n\tdomain_id VARCHAR(64) NOT NULL, \n\tname VARCHAR(255) NOT NULL, \n\tPRIMARY KEY (id), \n\tUNIQUE (domain_id, name), \n\tUNIQUE (user_id), \n\tFOREIGN KEY(user_id) REFERENCES user (id) ON DELETE CASCADE\n)\n\n']

ok, why is that?

if i run 'show engine innodb status' i get:

2016-04-17 23:09:32 7f2cd4aed700 Error in foreign key constraint of table keystone/local_user:
FOREIGN KEY(user_id) REFERENCES user (id) ON DELETE CASCADE ):
Cannot find an index in the referenced table where the
referenced columns appear as the first columns, or column types
in the table and the referenced table do not match for constraint.
Note that the internal storage type of ENUM and SET changed in
tables created with >= InnoDB-4.1.12, and such columns in old tables
cannot be referenced by such columns in new tables.
See http://dev.mysql.com/doc/refman/5.6/en/innodb-foreign-key-constraints.html
for correct foreign key definition.

so it is complaining about the foreign key in the local_user table its trying to create.

if i look @ user:

mysql> describe user;
+--------------------+--------------+------+-----+---------+-------+
| Field              | Type         | Null | Key | Default | Extra |
+--------------------+--------------+------+-----+---------+-------+
| id                 | varchar(64)  | NO   | PRI | NULL    |       |
| name               | varchar(255) | NO   |     | NULL    |       |
| extra              | text         | YES  |     | NULL    |       |
| password           | varchar(128) | YES  |     | NULL    |       |
| enabled            | tinyint(1)   | YES  |     | NULL    |       |
| domain_id          | varchar(64)  | NO   | MUL | NULL    |       |
| default_project_id | varchar(64)  | YES  |     | NULL    |       |
+--------------------+--------------+------+-----+---------+-------+
7 rows in set (0.00 sec)
mysql> show index from user;                                                                                                                                                                                                    +-------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| Table | Non_unique | Key_name  | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment | Index_comment |
+-------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
| user  |          0 | PRIMARY   |            1 | id          | A         |        1055 |     NULL | NULL   |      | BTREE      |         |               |
| user  |          0 | domain_id |            1 | domain_id   | A         |           4 |     NULL | NULL   |      | BTREE      |         |               |
| user  |          0 | domain_id |            2 | name        | A         |        1055 |     NULL | NULL   |      | BTREE      |         |               |
+-------+------------+-----------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+---------------+
3 rows in set (0.00 sec)

so, uh, any suggestions?suggestions? its the 89-90 step that fails