Closed Bug 1385248 Opened 7 years ago Closed 7 years ago

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

Categories

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

defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 1376331

People

(Reporter: jlorenzo, Unassigned)

References

Details

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

Looks like a fallout of https://github.com/mozilla/balrog/pull/350. 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/manage-db.py -d mysql://balrogadmin:balrogadmin@balrogdb/balrog upgrade > balrogadmin_1 | /usr/local/lib/python2.7/site-packages/sqlalchemy/pool.py:638: 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/pool.py:145: 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/manage-db.py", line 217, in <module> > balrogadmin_1 | db.upgrade(options.version) > balrogadmin_1 | File "scripts/../auslib/db.py", line 2617, in upgrade > balrogadmin_1 | schema.runchange(step, change, 1) > balrogadmin_1 | File "/usr/local/lib/python2.7/site-packages/migrate/versioning/schema.py", line 91, in runchange > balrogadmin_1 | change.run(self.engine, step) > balrogadmin_1 | File "/usr/local/lib/python2.7/site-packages/migrate/versioning/script/py.py", line 145, in run > balrogadmin_1 | script_func(engine) > balrogadmin_1 | File "scripts/../auslib/migrate/versions/028_remove_systemCapabilities.py", 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/_collections.py", 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 https://github.com/mozilla/balrog/blob/master/scripts/initdb_and_run.sh#L7, 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]
Status: NEW → RESOLVED
Closed: 7 years ago
Resolution: --- → DUPLICATE
Product: Release Engineering → Release Engineering Graveyard
You need to log in before you can comment on or make changes to this bug.