-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Restoring & pg_restore -j #16
Comments
I'm not sure I understand everything here. What do you mean by "extension tables"? Do you have some log examples of the problem? If you already managed to properly dump/restore an opm database, do you have some recommended procedure that allows you to achieve it? |
How to reproduce: $ createdb opm_clone
$ pg_restore -d opm_clone --section=pre-data opm_2020-02-10_09-00-01.dump
$ pg_restore -d opm_clone -j8 -e --section=data opm_2020-02-10_09-00-01.dump
pg_restore: [programme d'archivage (db)] Erreur pendant le traitement de la TOC (« PROCESSING TOC ») :
pg_restore: [programme d'archivage (db)] Erreur à partir de l'entrée TOC 11198 ; 0 42343 TABLE DATA metrics postgres
pg_restore: [programme d'archivage (db)] COPY échoué pour la table « metrics » : ERROR: insert or update on table "metrics" violates foreign key constraint "metrics_id_service_fkey"
DÉTAIL : Key (id_service)=(1) is not present in table "services".
pg_restore: [archiveur en parallèle] un processus worker a subi un arrêt brutal inattendu The problem comes from the $ createdb opm_clone
We've solved it by loading separately everything except $ pg_restore --section=data -l opm_2020-02-10_09-00-01.dump |grep -v 'service_counters_' > restore.1.list
$ pg_restore --section=data -l opm_2020-02-10_09-00-01.dump |grep 'service_counters_' > restore.2.list
$ pg_restore -d opm_clone -L restore.1.list opm_2020-02-10_09-00-01.dump
$ pg_restore -d opm_clone -j8 -L restore.2.list opm_2020-02-10_09-00-01.dump
|
I see, thanks for the extra details. So this is a limitation due to how extensions work internally. This could be fixed by either moving out of extensions or something like a new function to call after initial setup or restore, but this would be too much work or adding even more complexity to installation, for the only benefit of simplifying logical dump/parallel restore, so I'm not willing to go that way. I'm assuming that you used pg_dump/pg_restore to do a major upgrade? Was pg_upgrade considered, or is there any issue with opm? It seems that your approach is the simplest way to go if you want to use parallel pg_restore. Do you want to submit a documentation patch for it? |
OK,I'll do the patch. pg_upgrade was not considered as it was on a different server (I've just tested, it fails, this will be for another issue) |
Both extensions (omp-core & wh_nagios) create their tables during the CREATE EXTENSION, including foreign keys. So we had a
pg_restore -j8 --section=data
of an OPM database that failed, because it was parallelized, the extensions tables data were not loaded sequentially, and the foreign keys were already there.The doc should state an official upgrade procedure, eg:
The text was updated successfully, but these errors were encountered: