Page MenuHomeSoftware Heritage
Paste P773

storage check at startup in deposit tests: dbversion discrepancy make the tests refuse to start...
ActivePublic

Authored by ardumont on Sep 23 2020, 10:08 AM.
```
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> PDB set_trace >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
> /home/tony/work/inria/repo/swh/swh-environment/swh-deposit/.tox/py3-django2/lib/python3.7/site-packages/swh/storage/postgresql/db.py(1344)check_dbversion()
-> return self.dbversion()["version"] == self.current_version
(Pdb) self.dbversion()
{'version': 17, 'release': datetime.datetime(2020, 9, 23, 8, 5, 34, 178882, tzinfo=psycopg2.tz.FixedOffsetTimezone(offset=0, name=None)), 'description': 'Work In Progress'}
(Pdb) self.current_version
162
```
say what!?

Event Timeline

More information:

(Pdb) cfg['storage']
{'check_config': {'check_write': True}, 'cls': 'local', 'db': 'postgresql://postgres@127.0.0.1:16607/tests', 'objstorage': {'args': {}, 'cls': 'memory'}}
(Pdb) cfg['scheduler']
{'args': {'db': "user=postgres password=xxx dbname=tests host=127.0.0.1 port=16607 options=''"}, 'cls': 'local'}

so both the storage and scheduler backends are written to the same db.
It so happens that both scheduler and storage have a dbversion table.

So the storage check fails because the dbversion 17 (from the scheduler) does not match the latest storage dbversion (162)...
This is a current limitation in the swh.core db fixture somewhere there where we don't specify the dbname or schema.

Thanks @douardda ;)