Alembic migrations: Only exists contract version in database

Bug #1779813 reported by Dongcan Ye
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
New
Undecided
Dongcan Ye

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.

Dongcan Ye (hellochosen)
description: updated
Revision history for this message
Brian Haley (brian-haley) wrote :

I have a couple of questions since I'm confused by the description.

1. Where did you start the upgrade from? Something before Mitaka?

2. Since only Ocata and later are supported upstream, does an upgrade from Ocata to Pike work correctly?

Changed in neutron:
status: New → Incomplete
Revision history for this message
Dongcan Ye (hellochosen) wrote :
Download full text (6.2 KiB)

@Brian, I just start from an empty database.

I try to upgrade empty database to Ocata(neutron-db-manage upgrade ocata), then the alembic_version is Ocata expand. [1]
MariaDB [neutron]> select * from alembic_version;
+--------------+
| version_num |
+--------------+
| a9c43481023c |
+--------------+
1 row in set (0.00 sec)

Then I upgrade expand branch, it raises an exception here:
# 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 kilo -> 30018084ec99
INFO [alembic.runtime.migration] Running upgrade 30018084ec99 -> 4ffceebfada
INFO [alembic.runtime.migration] Running upgrade 4ffceebfada -> 5498d17be016
INFO [alembic.runtime.migration] Running upgrade 5498d17be016 -> 2a16083502f3
INFO [alembic.runtime.migration] Running upgrade 2a16083502f3 -> 2e5352a0ad4d
INFO [alembic.runtime.migration] Running upgrade 2e5352a0ad4d -> 11926bcfe72d
INFO [alembic.runtime.migration] Running upgrade 11926bcfe72d -> 4af11ca47297
INFO [alembic.runtime.migration] Running upgrade 4af11ca47297 -> 1b294093239c
INFO [alembic.runtime.migration] Running upgrade 1b294093239c -> 8a6d8bdae39
INFO [alembic.runtime.migration] Running upgrade 8a6d8bdae39 -> 2b4c2465d44b
INFO [alembic.runtime.migration] Running upgrade 2b4c2465d44b -> e3278ee65050
INFO [alembic.runtime.migration] Running upgrade e3278ee65050 -> c6c112992c9
INFO [alembic.runtime.migration] Running upgrade c6c112992c9 -> 5ffceebfada
INFO [alembic.runtime.migration] Running upgrade 5ffceebfada -> 4ffceebfcdc
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 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/l...

Read more...

Dongcan Ye (hellochosen)
Changed in neutron:
assignee: nobody → Dongcan Ye (hellochosen)
Revision history for this message
YAMAMOTO Takashi (yamamoto) wrote :

a feedback has been provided

Changed in neutron:
status: Incomplete → New
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.