← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1779813] [NEW] Alembic migrations: Only exists contract version in database

 

Public bug reported:

I had a clean environment(code version: stable/queens), and run DB
update operations.

Step 1. First upgrade to Mitaka:
# neutron-db-manage upgrade mitaka

Result: all things runs ok, the neutron and subprojects are upgrade to
Mitaka version.

Step 2. Then runs the following command:
# neutron-db-manage upgrade expand

Result: meets an error here, exception:
# neutron-db-manage upgrade --expand
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
  Running upgrade (expand) for neutron ...
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
INFO  [alembic.runtime.migration] Running upgrade 4ffceebfcdc -> 7bbb25278f53
INFO  [alembic.runtime.migration] Running upgrade 7bbb25278f53 -> 89ab9a816d70
INFO  [alembic.runtime.migration] Running upgrade 89ab9a816d70 -> c879c5e1ee90
INFO  [alembic.runtime.migration] Running upgrade c879c5e1ee90 -> 8fd3918ef6f4
INFO  [alembic.runtime.migration] Running upgrade 8fd3918ef6f4 -> 4bcd4df1f426
INFO  [alembic.runtime.migration] Running upgrade 4bcd4df1f426 -> b67e765a3524
INFO  [alembic.runtime.migration] Running upgrade 0e66c5227a8a -> 45f8dd33480b
INFO  [alembic.runtime.migration] Running upgrade 45f8dd33480b -> 5abc0278ca73
INFO  [alembic.runtime.migration] Running upgrade 5abc0278ca73 -> d3435b514502
INFO  [alembic.runtime.migration] Running upgrade d3435b514502 -> 30107ab6a3ee
INFO  [alembic.runtime.migration] Running upgrade 30107ab6a3ee -> c415aab1c048
INFO  [alembic.runtime.migration] Running upgrade c415aab1c048 -> a963b38d82f4
INFO  [alembic.runtime.migration] Running upgrade a963b38d82f4 -> 3d0e74aa7d37
INFO  [alembic.runtime.migration] Running upgrade 3d0e74aa7d37 -> 030a959ceafa
INFO  [alembic.runtime.migration] Running upgrade 030a959ceafa -> a5648cfeeadf
INFO  [alembic.runtime.migration] Running upgrade a5648cfeeadf -> 0f5bef0f87d4
INFO  [alembic.runtime.migration] Running upgrade 0f5bef0f87d4 -> 67daae611b6e
INFO  [alembic.runtime.migration] Running upgrade 67daae611b6e -> 6b461a21bcfc
INFO  [alembic.runtime.migration] Running upgrade 6b461a21bcfc -> 5cd92597d11d
INFO  [alembic.runtime.migration] Running upgrade 5cd92597d11d -> 929c968efe70
INFO  [alembic.runtime.migration] Running upgrade 929c968efe70 -> a9c43481023c
INFO  [alembic.runtime.migration] Running upgrade a9c43481023c -> 804a3c76314c
INFO  [alembic.runtime.migration] Running upgrade 804a3c76314c -> 2b42d90729da
INFO  [alembic.runtime.migration] Running upgrade 2b42d90729da -> 62c781cb6192
INFO  [alembic.runtime.migration] Running upgrade 62c781cb6192 -> c8c222d42aa9
INFO  [alembic.runtime.migration] Running upgrade c8c222d42aa9 -> 349b6fd605a6
INFO  [alembic.runtime.migration] Running upgrade 349b6fd605a6 -> 7d32f979895f
INFO  [alembic.runtime.migration] Running upgrade 7d32f979895f -> 594422d373ee
INFO  [alembic.runtime.migration] Running upgrade 594422d373ee -> 61663558142c
  OK
INFO  [alembic.runtime.migration] Context impl MySQLImpl.
INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
Traceback (most recent call last):
  File "/var/lib/kolla/venv/bin/neutron-db-manage", line 10, in <module>
    sys.exit(main())
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 653, in main
    return_val |= bool(CONF.command.func(config, CONF.command.name))
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 172, in do_upgrade
    run_sanity_checks(config, revision)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 637, in run_sanity_checks
    script_dir.run_env()
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/base.py", line 427, in run_env
    util.load_python_file(self.dir, 'env.py')
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
    module = load_module_py(module_id, path)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/util/compat.py", line 141, in load_module_py
    mod = imp.load_source(module_id, path, fp)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/networking_infoblox/neutron/db/migration/alembic_migrations/env.py", line 88, in <module>
    run_migrations_online()
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/networking_infoblox/neutron/db/migration/alembic_migrations/env.py", line 79, in run_migrations_online
    context.run_migrations()
  File "<string>", line 8, in run_migrations
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/runtime/environment.py", line 836, in run_migrations
    self.get_context().run_migrations(**kw)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/runtime/migration.py", line 321, in run_migrations
    for step in self._migrations_fn(heads, self):
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 628, in check_sanity
    revision, rev, implicit_base=True):
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 656, in _iterate_revisions
    uppers = util.dedupe_tuple(self.get_revisions(upper))
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 301, in get_revisions
    resolved_id, branch_label = self._resolve_revision_number(id_)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 445, in _resolve_revision_number
    current_head = self.get_current_head(branch_label)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 267, in get_current_head
    current_heads = self.filter_for_lineage(current_heads, branch_label)
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 405, in filter_for_lineage
    tg, shares, include_dependencies=include_dependencies)]
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 419, in _shares_lineage
    in util.to_tuple(test_against_revs, default=())
  File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 362, in _revision_for_ident
    resolved_id)
alembic.script.revision.ResolutionError: No such revision or branch 'expand'


After Step 1, I found that only one record(Mitaka contract head) in alembic_version table:
MariaDB [neutron]> select * from alembic_version;
+-------------+
| version_num |
+-------------+
| 4ffceebfcdc |
+-------------+
1 row in set (0.00 sec)

There was missing expand head in alembic_version table.

** Affects: neutron
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1779813

Title:
  Alembic migrations: Only exists contract version in database

Status in neutron:
  New

Bug description:
  I had a clean environment(code version: stable/queens), and run DB
  update operations.

  Step 1. First upgrade to Mitaka:
  # neutron-db-manage upgrade mitaka

  Result: all things runs ok, the neutron and subprojects are upgrade to
  Mitaka version.

  Step 2. Then runs the following command:
  # neutron-db-manage upgrade expand

  Result: meets an error here, exception:
  # neutron-db-manage upgrade --expand
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
    Running upgrade (expand) for neutron ...
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
  INFO  [alembic.runtime.migration] Running upgrade 4ffceebfcdc -> 7bbb25278f53
  INFO  [alembic.runtime.migration] Running upgrade 7bbb25278f53 -> 89ab9a816d70
  INFO  [alembic.runtime.migration] Running upgrade 89ab9a816d70 -> c879c5e1ee90
  INFO  [alembic.runtime.migration] Running upgrade c879c5e1ee90 -> 8fd3918ef6f4
  INFO  [alembic.runtime.migration] Running upgrade 8fd3918ef6f4 -> 4bcd4df1f426
  INFO  [alembic.runtime.migration] Running upgrade 4bcd4df1f426 -> b67e765a3524
  INFO  [alembic.runtime.migration] Running upgrade 0e66c5227a8a -> 45f8dd33480b
  INFO  [alembic.runtime.migration] Running upgrade 45f8dd33480b -> 5abc0278ca73
  INFO  [alembic.runtime.migration] Running upgrade 5abc0278ca73 -> d3435b514502
  INFO  [alembic.runtime.migration] Running upgrade d3435b514502 -> 30107ab6a3ee
  INFO  [alembic.runtime.migration] Running upgrade 30107ab6a3ee -> c415aab1c048
  INFO  [alembic.runtime.migration] Running upgrade c415aab1c048 -> a963b38d82f4
  INFO  [alembic.runtime.migration] Running upgrade a963b38d82f4 -> 3d0e74aa7d37
  INFO  [alembic.runtime.migration] Running upgrade 3d0e74aa7d37 -> 030a959ceafa
  INFO  [alembic.runtime.migration] Running upgrade 030a959ceafa -> a5648cfeeadf
  INFO  [alembic.runtime.migration] Running upgrade a5648cfeeadf -> 0f5bef0f87d4
  INFO  [alembic.runtime.migration] Running upgrade 0f5bef0f87d4 -> 67daae611b6e
  INFO  [alembic.runtime.migration] Running upgrade 67daae611b6e -> 6b461a21bcfc
  INFO  [alembic.runtime.migration] Running upgrade 6b461a21bcfc -> 5cd92597d11d
  INFO  [alembic.runtime.migration] Running upgrade 5cd92597d11d -> 929c968efe70
  INFO  [alembic.runtime.migration] Running upgrade 929c968efe70 -> a9c43481023c
  INFO  [alembic.runtime.migration] Running upgrade a9c43481023c -> 804a3c76314c
  INFO  [alembic.runtime.migration] Running upgrade 804a3c76314c -> 2b42d90729da
  INFO  [alembic.runtime.migration] Running upgrade 2b42d90729da -> 62c781cb6192
  INFO  [alembic.runtime.migration] Running upgrade 62c781cb6192 -> c8c222d42aa9
  INFO  [alembic.runtime.migration] Running upgrade c8c222d42aa9 -> 349b6fd605a6
  INFO  [alembic.runtime.migration] Running upgrade 349b6fd605a6 -> 7d32f979895f
  INFO  [alembic.runtime.migration] Running upgrade 7d32f979895f -> 594422d373ee
  INFO  [alembic.runtime.migration] Running upgrade 594422d373ee -> 61663558142c
    OK
  INFO  [alembic.runtime.migration] Context impl MySQLImpl.
  INFO  [alembic.runtime.migration] Will assume non-transactional DDL.
  Traceback (most recent call last):
    File "/var/lib/kolla/venv/bin/neutron-db-manage", line 10, in <module>
      sys.exit(main())
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 653, in main
      return_val |= bool(CONF.command.func(config, CONF.command.name))
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 172, in do_upgrade
      run_sanity_checks(config, revision)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 637, in run_sanity_checks
      script_dir.run_env()
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/base.py", line 427, in run_env
      util.load_python_file(self.dir, 'env.py')
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/util/pyfiles.py", line 81, in load_python_file
      module = load_module_py(module_id, path)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/util/compat.py", line 141, in load_module_py
      mod = imp.load_source(module_id, path, fp)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/networking_infoblox/neutron/db/migration/alembic_migrations/env.py", line 88, in <module>
      run_migrations_online()
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/networking_infoblox/neutron/db/migration/alembic_migrations/env.py", line 79, in run_migrations_online
      context.run_migrations()
    File "<string>", line 8, in run_migrations
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/runtime/environment.py", line 836, in run_migrations
      self.get_context().run_migrations(**kw)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/runtime/migration.py", line 321, in run_migrations
      for step in self._migrations_fn(heads, self):
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/neutron/db/migration/cli.py", line 628, in check_sanity
      revision, rev, implicit_base=True):
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 656, in _iterate_revisions
      uppers = util.dedupe_tuple(self.get_revisions(upper))
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 301, in get_revisions
      resolved_id, branch_label = self._resolve_revision_number(id_)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 445, in _resolve_revision_number
      current_head = self.get_current_head(branch_label)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 267, in get_current_head
      current_heads = self.filter_for_lineage(current_heads, branch_label)
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 405, in filter_for_lineage
      tg, shares, include_dependencies=include_dependencies)]
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 419, in _shares_lineage
      in util.to_tuple(test_against_revs, default=())
    File "/var/lib/kolla/venv/lib/python2.7/site-packages/alembic/script/revision.py", line 362, in _revision_for_ident
      resolved_id)
  alembic.script.revision.ResolutionError: No such revision or branch 'expand'

  
  After Step 1, I found that only one record(Mitaka contract head) in alembic_version table:
  MariaDB [neutron]> select * from alembic_version;
  +-------------+
  | version_num |
  +-------------+
  | 4ffceebfcdc |
  +-------------+
  1 row in set (0.00 sec)

  There was missing expand head in alembic_version table.

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1779813/+subscriptions