InitDb.pl failed

I’m recreating a mirror slave and failed on

sudo docker-compose run --rm musicbrainz createdb.sh -fetch

/musicbrainz-server
Tue 20 Sep 2022 09:37:24 PM UTC: Done fetching dump files.
found existing dumps
2022/09/20 21:37:24 Waiting for: tcp://db:5432
2022/09/20 21:37:24 Connected to tcp://db:5432
2022/09/20 21:37:24 Command finished successfully.
Tue Sep 20 21:37:25 2022 : InitDb.pl starting
ERROR:  schema "musicbrainz" already exists
ERROR:  schema "cover_art_archive" already exists
ERROR:  schema "documentation" already exists
ERROR:  schema "event_art_archive" already exists
ERROR:  schema "json_dump" already exists
ERROR:  schema "report" already exists
ERROR:  schema "sitemaps" already exists
ERROR:  schema "statistics" already exists
ERROR:  schema "wikidocs" already exists
ERROR:  schema "dbmirror2" already exists
Tue Sep 20 21:37:26 2022 : Installing extensions (Extensions.sql)
Tue Sep 20 21:37:26 2022 : Creating collations ... (CreateCollations.sql)
Tue Sep 20 21:37:26 2022 : psql:/musicbrainz-server/admin/sql/CreateCollations.sql:10: ERROR:  collation "musicbrainz" already exists
Error during CreateCollations.sql at /musicbrainz-server/admin/InitDb.pl line 93.

is that an uncatched error as the previous ones ? Can I just continue ?

Hi,

InitDB.pl is only able to create a new database from scratch. If something already exists, it will avoid messing it up and leave it in place, thus the error messages. Since you mentioned you are “recreating” the database, it is not surprising that these schemata already exist.

There is a dedicated script for recreating database, which basically DROP everything before calling the regular script, see the section “Recreate database”.

As you already fetched the data dumps with your last attempt to create the database, you can avoid downloading these again by recreating the database as follows:

sudo docker-compose run --rm musicbrainz recreatedb.sh
2 Likes

Thanks, this did work. I’ve pruned the old dockers and thought DB is removed with it.

The Docker containers, images, and volumes, are not stored under the musicbrainz-docker directory.

To find which directory is used by Docker:

sudo docker info -f '{{.DockerRootDir}}'

To prune all the containers, images, and volumes created by musicbrainz-docker (and remove it):

cd musicbrainz-docker/ &&
sudo docker-compose down --remove-orphans --rmi all --volumes &&
cd .. &&
rm -fr musicbrainz-docker/
2 Likes