can't drop CHECK constraint when upgrading from mitaka02 to ocata01
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Glance |
New
|
Undecided
|
Unassigned |
Bug Description
Database: Mariadb 10.2.6
alembic: 0.9.2
SQLAlchemy: 1.0.17
sqlalchemy-migrate: 0.11.0
PyMySQL: 0.7.11
glance: 14.0.0
python-
I started a clean database <glance> and did a "glance-manage db_sync" command.
It faults an error even "check_
InternalError: (pymysql.
ANALYSIS:
is_public is created by " Column('is_public', Boolean(), nullable=False)" defined in glance.
This logic will create all unnamed CHECK constraint.
To solve the error,
the is_public unnamed CHECK constraint should be dropped before dropping its column.
In ocata01_
First attempt:
op.drop_
+ op.drop_
op.drop_
It fails, as the CHECK constraint is unnamed, and drop_constraint faults "MySQL does not support CHECK constraints." in alembic/
Second attempt:
op.drop_
+ op.execute("""ALTER TABLE images DROP CONSTRAINT CONSTRAINT_1""")
op.drop_
It works but it is nasty as the constraint name "CONSTRAINT_1" is only be found in "SHOW CREATE TABLE images"
It seems that the db upgrade scripts do no support MariaDB well.
Any comments?
Same problem here
New installation of Glance Ocata
MariaDB: 10.2.7
OS: CentOS 7.3
The workaround was downgrade to MariaDB 10.1.25
Error: python2. 7/site- packages/ oslo_db/ sqlalchemy/ enginefacade. py:1241: OsloDBDeprecati onWarning: EngineFacade is deprecated; please use oslo_db. sqlalchemy. enginefacade on_commit= expire_ on_commit, _conf=conf) runtime. migration] Context impl MySQLImpl. runtime. migration] Will assume non-transactional DDL. runtime. migration] Running upgrade -> liberty, liberty initial runtime. migration] Running upgrade liberty -> mitaka01, add index on created_at and updated_at columns of 'images' table python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_1` CHECK (`is_public` in (0,1)),' warn("Unknown schema content: %r" % line) python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_2` CHECK (`deleted` in (0,1)),' warn("Unknown schema content: %r" % line) python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_3` CHECK (`protected` in (0,1))' warn("Unknown schema content: %r" % line) runtime. migration] Running upgrade mitaka01 -> mitaka02, update metadef os_nova_server python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_1` CHECK (`protected` in (0,1))' warn("Unknown schema content: %r" % line) runtime. migration] Running upgrade mitaka02 -> ocata01, add visibility to and remove is_public from images python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_1` CHECK (`is_public` in (0,1)),' warn("Unknown schema content: %r" % line) python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_2` CHECK (`deleted` in (0,1)),' warn("Unknown schema content: %r" % line) python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_3` CHECK (`protected` in (0,1))' warn("Unknown schema content: %r" % line) python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_1` CHECK (`can_share` in (0,1)),' warn("Unknown schema content: %r" % line) python2. 7/site- packages/ sqlalchemy/ dialects/ mysql/base. py:3000: SAWarning: Unknown schema content: u' CONSTRAINT `CONSTRAINT_2` CHECK (`deleted` in (0,1))' warn("Unknown schema content: %r" % line) err.InternalErr or) (1054, u"Unknown column 'is_public' in 'CHECK'") [SQL: u'ALT...
[root@controller01 ~]# su -s /bin/sh -c "glance-manage db_sync" glance
Option "verbose" from group "DEFAULT" is deprecated for removal. Its value may be silently ignored in the future.
/usr/lib/
expire_
INFO [alembic.
INFO [alembic.
INFO [alembic.
INFO [alembic.
/usr/lib64/
util.
/usr/lib64/
util.
/usr/lib64/
util.
INFO [alembic.
/usr/lib64/
util.
INFO [alembic.
/usr/lib64/
util.
/usr/lib64/
util.
/usr/lib64/
util.
/usr/lib64/
util.
/usr/lib64/
util.
CRITI [glance] InternalError: (pymysql.