Page MenuHomeSoftware Heritage

getting started guide: db-init fails with "relation entity_history does not exist"
Closed, MigratedEdits Locked

Description

I got the following errors while using the getting started guide.

swh-storage/sql/bin/db-init softwareheritage-dev

in (step 3) gave me the following errors:

psql:swh-data.sql:34: ERROR:  relation "entity_history" does not exist
LINE 1: insert into entity_history
                    ^
psql:swh-data.sql:39: ERROR:  relation "listable_entity" does not exist
LINE 1: insert into listable_entity
                    ^

they were not fatal as the db still got created, but I wasn't sure if this is expected behaviour.

When trying to inject the first repo (step 4)

python3 -m swh.loader.git.updater --origin-url https://github.com/SoftwareHeritage/swh-storage.git

I get the following error (only included stacktrace for swh related code)

  File "/home/fv/Code/Python/swh-environment/swh-loader-core/swh/loader/core/loader.py", line 233, in send_origin
    origin_id = self.storage.origin_add_one(origin)
  File "/home/fv/Code/Python/swh-environment/swh-storage/swh/storage/api/client.py", line 131, in origin_add_one
    return self.post('origin/add', {'origin': origin})
  File "/home/fv/Code/Python/swh-environment/swh-core/swh/core/api.py", line 67, in post
    return self._decode_response(response)
  File "/home/fv/Code/Python/swh-environment/swh-core/swh/core/api.py", line 96, in _decode_response
    raise pickle.loads(decode_response(response))
psycopg2.ProgrammingError: relation "origin" does not exist
LINE 2:                    FROM origin
                                ^

I still tried to build the webapp (you could add the following first line to the doc)

cd swh-web
make run-django-webpack-devserver

, but got the following error:

python3 swh/web/manage.py migrate 2>/dev/null
Makefile.local:15: recipe for target 'run-migrations' failed
make: *** [run-migrations] Error 1

This seems to be related to the following command in local Makefile:

python3 swh/web/manage.py migrate

and the problem seems to be an issue between Python3.7 and django.

So now I went back to step 3 deleted the .venv directory and switched pyenv to Python3.6.6. I had to use

pip3.6 install $( bin/pip-swh-packages )

to install stuff properly. I am not sure if this has not something to do with compatibility issues of pyenv and venv.

When injecting a repository, I still got the same error as for Python3.7.

Compiling the web-app worked this time.

Event Timeline

fivo triaged this task as Normal priority.Oct 9 2018, 10:51 PM
fivo created this task.
fivo created this object in space S1 Public.

Thanks for this bug report!

The DB initialization failure in step (3) is not normal and it's probably the cause of the subsequent problems. Unfortunately I cannot reproduce it with the current HEAD of the swh-storage module (commit 7ae19dbbd5c447863faf25e5ad938031e46aef33), so we need to figure out what's the difference between your setup and mine.

Can you maybe send over a paste of the full db-init step?

Also, can you tell us more about the postgres version you're using?

zack renamed this task from Issues with getting started guide. to getting started guide: db-init fails with "relation entity_history does not exist".Oct 10 2018, 11:22 AM
zack added a project: Unreproducible.

Ok. I got it to work. I think the problem was just that I had an old postgresql version and you updated the doc Tuesday and I had instantiated the db Monday night.

Oh, yeah, that makes sense. We're doing some refactoring work on
swh-storage these days, so if you did part of the DB setup back then and
part now, weird things might have happened :-)