cardano-db-sync
cardano-db-sync copied to clipboard
Restoring from snapshot error - role "cexplorer" does not exist
Versions
The db-sync version (eg cardano-db-sync --version): 13.2.0.1
PostgreSQL version: 16
Build/Install Method
The method you use to build or install cardano-db-sync: static binaries
Problem Report When restoring a snapshot (new version https://update-cardano-mainnet.iohk.io/cardano-db-sync/index.html#13.2/) postgresql-setup.sh fails with
pg_restore: error: could not execute query: ERROR: role "cexplorer" does not exist
Command was: ALTER DOMAIN public.addr29type OWNER TO cexplorer;
since there is no cexlporer user in the system
The --no-owner flag (and maybe --role too?) needs to be added. Something like that
pg_restore \
--schema=public \
--jobs="${numcores}" \
--format=directory \
--dbname="${PGDATABASE}" \
--no-owner \
--exit-on-error \
"${tmp_dir}/db/"
I just ran into the same issue and had to use an older snapshot. Thanks for reporting!
119836792-2b11e4c6c8-474.lstate.gz
DROP OWNED
pg_restore: error: could not execute query: ERROR: role "cexplorer" does not exist
Command was: ALTER DOMAIN public.addr29type OWNER TO cexplorer;
I'm running Postgres through a container and I'm experiencing an inability to delete the DB PG: postgres:14.10-alpine
bash-5.2#
pg_restore --schema=public --no-owner --jobs="4" --format=directory --dbname="${PGDATABASE}" --exit-on-error /tmp/db-sync-snapshot-gnn0s1exBH/db/
pg_restore: [archiver] unsupported version (1.14) in file header
Is the version of pg_restore too low?
https://update-cardano-mainnet.iohk.io/cardano-db-sync/13.2/db-sync-snapshot-schema-13.2-block-10102605-x86_64.tgz
Yes, adding --exit-on-error in https://github.com/IntersectMBO/cardano-db-sync/commit/bfe1133195c10c26d8b12bcd7a92492eb8230d61 introduced that issue.
I've just finished restoration of latest available snapshot with --no-owner added to the script and it ended successfully.
Once restoration ended I started cardano-db-sync and have it running for around ~1h - no issues.
Fixed in 13.2.0.2 via 1f26396e91a0124a545201d4c6519d015b24fa6e