yahoo-eng-team team mailing list archive
-
yahoo-eng-team team
-
Mailing list archive
-
Message #68480
[Bug 1723001] [NEW] DB Upgrade: expand command fails while upgrading from ocata to pike
Public bug reported:
If you try to run 'glance-manage db expand' command while upgrading from
ocata to pike then it fails with below error:
InternalError: (pymysql.err.InternalError) (1060, u"Duplicate column
name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility
ENUM('private','public','shared','community')"]
NOTE: Same issue is reproducible on current master as well. (On master
code if you run 'glance-manage db expand' command, then you will get
below error.)
Steps to reproduce:
1. Setup stable/ocata
2. Pulled stable/pike branch using 'git checkout stable/pike'
3. Ran 'glance-manage db expand' command
Error:
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_expand01, add visibility to images
CRITI [glance] InternalError: (pymysql.err.InternalError) (1060, u"Duplicate column name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility ENUM('private','public','shared','community')"]
Traceback (most recent call last):
File "./glance-manage", line 10, in <module>
sys.exit(main())
File "/opt/stack/glance/glance/cmd/manage.py", line 510, in main
return CONF.command.action_fn(*func_args, **func_kwargs)
File "/opt/stack/glance/glance/cmd/manage.py", line 183, in expand
self.sync(version=expand_head)
File "/opt/stack/glance/glance/cmd/manage.py", line 159, in sync
alembic_command.upgrade(a_config, version)
File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 174, in upgrade
script.run_env()
File "/usr/local/lib/python2.7/dist-packages/alembic/script/base.py", line 416, in run_env
util.load_python_file(self.dir, 'env.py')
File "/usr/local/lib/python2.7/dist-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python2.7/dist-packages/alembic/util/compat.py", line 79, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/env.py", line 89, in <module>
run_migrations_online()
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/env.py", line 84, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/usr/local/lib/python2.7/dist-packages/alembic/runtime/environment.py", line 807, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python2.7/dist-packages/alembic/runtime/migration.py", line 321, in run_migrations
step.migration_fn(**kw)
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/versions/ocata_expand01_add_visibility.py", line 149, in upgrade
_add_visibility_column(meta)
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/versions/ocata_expand01_add_visibility.py", line 126, in _add_visibility_column
op.add_column('images', v_col)
File "<string>", line 8, in add_column
File "<string>", line 3, in add_column
File "/usr/local/lib/python2.7/dist-packages/alembic/operations/ops.py", line 1541, in add_column
return operations.invoke(op)
File "/usr/local/lib/python2.7/dist-packages/alembic/operations/base.py", line 318, in invoke
return fn(self, operation)
File "/usr/local/lib/python2.7/dist-packages/alembic/operations/toimpl.py", line 123, in add_column
schema=schema
File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 172, in add_column
self._exec(base.AddColumn(table_name, column, schema=schema))
File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 118, in _exec
return conn.execute(construct, *multiparams, **params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl
compiled
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
exc_info
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 166, in execute
result = self._query(query)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 835, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in _read_query_result
result.read()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in _read_packet
packet.check_error()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (pymysql.err.InternalError) (1060, u"Duplicate column name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility ENUM('private','public','shared','community')"]
** Affects: glance
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to Glance.
https://bugs.launchpad.net/bugs/1723001
Title:
DB Upgrade: expand command fails while upgrading from ocata to pike
Status in Glance:
New
Bug description:
If you try to run 'glance-manage db expand' command while upgrading
from ocata to pike then it fails with below error:
InternalError: (pymysql.err.InternalError) (1060, u"Duplicate column
name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility
ENUM('private','public','shared','community')"]
NOTE: Same issue is reproducible on current master as well. (On master
code if you run 'glance-manage db expand' command, then you will get
below error.)
Steps to reproduce:
1. Setup stable/ocata
2. Pulled stable/pike branch using 'git checkout stable/pike'
3. Ran 'glance-manage db expand' command
Error:
INFO [alembic.runtime.migration] Context impl MySQLImpl.
INFO [alembic.runtime.migration] Will assume non-transactional DDL.
INFO [alembic.runtime.migration] Running upgrade mitaka02 -> ocata_expand01, add visibility to images
CRITI [glance] InternalError: (pymysql.err.InternalError) (1060, u"Duplicate column name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility ENUM('private','public','shared','community')"]
Traceback (most recent call last):
File "./glance-manage", line 10, in <module>
sys.exit(main())
File "/opt/stack/glance/glance/cmd/manage.py", line 510, in main
return CONF.command.action_fn(*func_args, **func_kwargs)
File "/opt/stack/glance/glance/cmd/manage.py", line 183, in expand
self.sync(version=expand_head)
File "/opt/stack/glance/glance/cmd/manage.py", line 159, in sync
alembic_command.upgrade(a_config, version)
File "/usr/local/lib/python2.7/dist-packages/alembic/command.py", line 174, in upgrade
script.run_env()
File "/usr/local/lib/python2.7/dist-packages/alembic/script/base.py", line 416, in run_env
util.load_python_file(self.dir, 'env.py')
File "/usr/local/lib/python2.7/dist-packages/alembic/util/pyfiles.py", line 93, in load_python_file
module = load_module_py(module_id, path)
File "/usr/local/lib/python2.7/dist-packages/alembic/util/compat.py", line 79, in load_module_py
mod = imp.load_source(module_id, path, fp)
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/env.py", line 89, in <module>
run_migrations_online()
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/env.py", line 84, in run_migrations_online
context.run_migrations()
File "<string>", line 8, in run_migrations
File "/usr/local/lib/python2.7/dist-packages/alembic/runtime/environment.py", line 807, in run_migrations
self.get_context().run_migrations(**kw)
File "/usr/local/lib/python2.7/dist-packages/alembic/runtime/migration.py", line 321, in run_migrations
step.migration_fn(**kw)
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/versions/ocata_expand01_add_visibility.py", line 149, in upgrade
_add_visibility_column(meta)
File "/opt/stack/glance/glance/db/sqlalchemy/alembic_migrations/versions/ocata_expand01_add_visibility.py", line 126, in _add_visibility_column
op.add_column('images', v_col)
File "<string>", line 8, in add_column
File "<string>", line 3, in add_column
File "/usr/local/lib/python2.7/dist-packages/alembic/operations/ops.py", line 1541, in add_column
return operations.invoke(op)
File "/usr/local/lib/python2.7/dist-packages/alembic/operations/base.py", line 318, in invoke
return fn(self, operation)
File "/usr/local/lib/python2.7/dist-packages/alembic/operations/toimpl.py", line 123, in add_column
schema=schema
File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 172, in add_column
self._exec(base.AddColumn(table_name, column, schema=schema))
File "/usr/local/lib/python2.7/dist-packages/alembic/ddl/impl.py", line 118, in _exec
return conn.execute(construct, *multiparams, **params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 914, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/ddl.py", line 68, in _execute_on_connection
return connection._execute_ddl(self, multiparams, params)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 968, in _execute_ddl
compiled
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context
context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1341, in _handle_dbapi_exception
exc_info
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context
context)
File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 450, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 166, in execute
result = self._query(query)
File "/usr/local/lib/python2.7/dist-packages/pymysql/cursors.py", line 322, in _query
conn.query(q)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 835, in query
self._affected_rows = self._read_query_result(unbuffered=unbuffered)
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1019, in _read_query_result
result.read()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 1302, in read
first_packet = self.connection._read_packet()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 981, in _read_packet
packet.check_error()
File "/usr/local/lib/python2.7/dist-packages/pymysql/connections.py", line 393, in check_error
err.raise_mysql_exception(self._data)
File "/usr/local/lib/python2.7/dist-packages/pymysql/err.py", line 107, in raise_mysql_exception
raise errorclass(errno, errval)
InternalError: (pymysql.err.InternalError) (1060, u"Duplicate column name 'visibility'") [SQL: u"ALTER TABLE images ADD COLUMN visibility ENUM('private','public','shared','community')"]
To manage notifications about this bug go to:
https://bugs.launchpad.net/glance/+bug/1723001/+subscriptions
Follow ups