Reviewed: https://review.openstack.org/281517 Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=77a9c1c0d49faf9f799d78437f5f1c4863629af2 Submitter: Jenkins Branch: master
commit 77a9c1c0d49faf9f799d78437f5f1c4863629af2 Author: Cedric Brandily <zze...@gmail.com> Date: Wed Feb 17 21:25:46 2016 +0100 Fix GROUP BY usage for PostgreSQL in migrations Currently get_duplicate_l3_ha_port_bindings[1] is not postgres-compliant because it's GROUP BY usage is not postgres-compliant: everything in the SELECT list must be aggregated or in GROUP BY. This change updates get_duplicate_l3_ha_port_bindings to respect previous PostgreSQL rule. [1] neutron.db.migration.alembic_migrations.versions.mitaka.expand\ .1df244e556f5_add_unique_ha_router_agent_port_bindings Change-Id: Ie99dd31d695ab89814a86e50d45ababe53bd56fd Closes-Bug: #1546731 ** Changed in: neutron Status: In Progress => Fix Released -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1546731 Title: 1df244e556f5_add_unique_ha_router_agent_port_bindings revision is not postgres compliant Status in neutron: Fix Released Bug description: 1df244e556f5_add_unique_ha_router_agent_port_bindings.py[1] is not postgres-compliant[2] because it uses GROUP BY incorrectly: column "ha_router_agent_port_bindings.port_id" must appear in the GROUP BY clause or be used in an aggregate function [1] in package neutron.db.migration.alembic_migrations.versions.mitaka.expand [2] # Starting with a liberty neutron db #$ neutron-db-manage upgrade head INFO [alembic.runtime.migration] Context impl PostgresqlImpl. INFO [alembic.runtime.migration] Will assume transactional DDL. Traceback (most recent call last): File "/home/user/projects/os/neutron/.tox/py27/bin/neutron-db-manage", line 10, in <module> sys.exit(main()) File "/home/user/projects/os/neutron/neutron/db/migration/cli.py", line 744, in main return_val |= bool(CONF.command.func(config, CONF.command.name)) File "/home/user/projects/os/neutron/neutron/db/migration/cli.py", line 218, in do_upgrade run_sanity_checks(config, revision) File "/home/user/projects/os/neutron/neutron/db/migration/cli.py", line 726, in run_sanity_checks script_dir.run_env() File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/script/base.py", line 397, in run_env util.load_python_file(self.dir, 'env.py') File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file module = load_module_py(module_id, path) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/util/compat.py", line 79, in load_module_py mod = imp.load_source(module_id, path, fp) File "/home/user/projects/os/neutron/neutron/db/migration/alembic_migrations/env.py", line 126, in <module> run_migrations_online() File "/home/user/projects/os/neutron/neutron/db/migration/alembic_migrations/env.py", line 120, in run_migrations_online context.run_migrations() File "<string>", line 8, in run_migrations File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/runtime/environment.py", line 797, in run_migrations self.get_context().run_migrations(**kw) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/alembic/runtime/migration.py", line 303, in run_migrations for step in self._migrations_fn(heads, self): File "/home/user/projects/os/neutron/neutron/db/migration/cli.py", line 719, in check_sanity script.module.check_sanity(context.connection) File "/home/user/projects/os/neutron/neutron/db/migration/alembic_migrations/versions/mitaka/expand/1df244e556f5_add_unique_ha_router_agent_port_bindings.py", line 57, in check_sanity res = get_duplicate_l3_ha_port_bindings(connection) File "/home/user/projects/os/neutron/neutron/db/migration/alembic_migrations/versions/mitaka/expand/1df244e556f5_add_unique_ha_router_agent_port_bindings.py", line 70, in get_duplicate_l3_ha_port_bindings .having(sa.func.count() > 1)).all() File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2588, in all return list(self) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2736, in __iter__ return self._execute_and_instances(context) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/orm/query.py", line 2751, in _execute_and_instances result = conn.execute(querycontext.statement, self._params) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 914, in execute return meth(self, multiparams, params) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/sql/elements.py", line 323, in _execute_on_connection return connection._execute_clauseelement(self, multiparams, params) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1010, in _execute_clauseelement compiled_sql, distilled_params File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1146, in _execute_context context) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1337, in _handle_dbapi_exception util.raise_from_cause(newraise, exc_info) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/util/compat.py", line 200, in raise_from_cause reraise(type(exception), exception, tb=exc_tb, cause=cause) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/base.py", line 1139, in _execute_context context) File "/home/user/projects/os/neutron/.tox/py27/local/lib/python2.7/site-packages/sqlalchemy/engine/default.py", line 450, in do_execute cursor.execute(statement, parameters) oslo_db.exception.DBError: (psycopg2.ProgrammingError) column "ha_router_agent_port_bindings.port_id" must appear in the GROUP BY clause or be used in an aggregate function LINE 1: SELECT ha_router_agent_port_bindings.port_id AS ha_router_ag... ^ [SQL: 'SELECT ha_router_agent_port_bindings.port_id AS ha_router_agent_port_bindings_port_id, ha_router_agent_port_bindings.router_id AS ha_router_agent_port_bindings_router_id, ha_router_agent_port_bindings.l3_agent_id AS ha_router_agent_port_bindings_l3_agent_id \nFROM ha_router_agent_port_bindings GROUP BY ha_router_agent_port_bindings.router_id, ha_router_agent_port_bindings.l3_agent_id \nHAVING count(*) > %(count_1)s'] [parameters: {'count_1': 1}] To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1546731/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp