Closed Bug 1385248 Opened 4 years ago Closed 4 years ago

local database creation fails when production db and current master do not have the same database version


(Release Engineering Graveyard :: Applications: Balrog (backend), defect, P2)



(Not tracked)



(Reporter: u504868, Unassigned)



(Whiteboard: [lang=python][ready])

Looks like a fallout of I wasn't able to start docker-compose on a machine that never got a database created.

> balrogadmin_1  | + export LOCAL_DUMP=/app/scripts/prod_db_dump.sql
> balrogadmin_1  | + LOCAL_DUMP=/app/scripts/prod_db_dump.sql
> balrogadmin_1  | + '[' '!' -e /app/.cache/mysql/db.done ']'
> balrogadmin_1  | + python scripts/ -d mysql://balrogadmin:balrogadmin@balrogdb/balrog upgrade
> balrogadmin_1  | /usr/local/lib/python2.7/site-packages/sqlalchemy/ SADeprecationWarning: The 'listeners' argument to Pool (and create_engine()) is deprecated.  Use event.listen().
> balrogadmin_1  |   Pool.__init__(self, creator, **kw)
> balrogadmin_1  | /usr/local/lib/python2.7/site-packages/sqlalchemy/ SADeprecationWarning: Pool.add_listener is deprecated.  Use event.listen()
> balrogadmin_1  |   self.add_listener(l)
> balrogadmin_1  | Traceback (most recent call last):
> balrogadmin_1  |   File "scripts/", line 217, in <module>
> balrogadmin_1  |     db.upgrade(options.version)
> balrogadmin_1  |   File "scripts/../auslib/", line 2617, in upgrade
> balrogadmin_1  |     schema.runchange(step, change, 1)
> balrogadmin_1  |   File "/usr/local/lib/python2.7/site-packages/migrate/versioning/", line 91, in runchange
> balrogadmin_1  |, step)
> balrogadmin_1  |   File "/usr/local/lib/python2.7/site-packages/migrate/versioning/script/", line 145, in run
> balrogadmin_1  |     script_func(engine)
> balrogadmin_1  |   File "scripts/../auslib/migrate/versions/", line 7, in upgrade
> balrogadmin_1  |     Table('rules', metadata, autoload=True).c.systemCapabilities.drop()
> balrogadmin_1  |   File "/usr/local/lib/python2.7/site-packages/sqlalchemy/util/", line 106, in __getattr__
> balrogadmin_1  |     raise AttributeError(key)
> balrogadmin_1  | AttributeError: systemCapabilities
Unfortunately, this happens whenever we have a mismatch in database version between the current master and production. You can workaround this particular one by deleting .cache, setting "--version 27" in, and starting it again.

The problem boils down to the fact that we create a local database first, then try to import production data. This fails during times like this, because the production dump contains columns that the current master doesn't. Probably what we should be doing instead is importing the production dump first (which will require it to create all the tables), and then upgrading it to the current master version.
Priority: -- → P2
Summary: Cannot `docker-compose up`: AttributeError: systemCapabilities during database creation → local database creation fails when production db and current master do not have the same database version
Whiteboard: [lang=python][ready]
Closed: 4 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 1376331
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.