Skip to content
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

Add a backup page, due to problems with parallelized restore #17

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

Krysztophe
Copy link
Contributor

A parallelized logical restore may fail, as seen in #16. Add the procedure. Add a Backups page and some generalities as there was none.

Restoring logical backups
-------------------------

In a general way, restoring a backup created with pg_dump should not be a problem as the backup contains the necessary `CREATE EXTENSION` orders. The extension binaries must be present.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OPM doesn't have any binaries. If you want to be stick to general recommendation that to apply to OPM, we should mention something like "All extension files (binaries, shared librraries, SQL files...)".

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, sorry I totally forgot about that PR. I will come back to it very soon!

opm-core/Backups.rst Outdated Show resolved Hide resolved
opm-core/Backups.rst Outdated Show resolved Hide resolved
opm-core/Backups.rst Outdated Show resolved Hide resolved
@Krysztophe
Copy link
Contributor Author

Sorry, I had totally forgotten this PR.

I've pushed the modifications.

@rjuju rjuju self-assigned this Oct 26, 2021

In a general way, restoring a backup created with pg_dump should not be a problem, as the backup contains the necessary `CREATE EXTENSION` orders. The extensions must be installed for the target PostgreSQL version (see `Installation <Installation>`).

You may wish to parallelize the restoration to spare time. In this case, it may fail with a foreign key error, as the extensions install tables with foreign keys at the very beginning of the restore, and pg_restore does not try to respect this order. The trick is to parallelize only the restoration of the biggest tables.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would be better to say "to save time".

Also, you mention the target PostgreSQL version. It kind of imply that this is a procedure generally used for major upgrade more than a general backup solution. It would be better to be more precise here that as we don't want to recommend pg_dump style backup as the best backup approach. So I would recommend to mention that PITR style backup don't have specific gotchas with OPM, and that's a form of backup that should generally be preferred.

I'm also not a fan of simply saying "The trick is...". Maybe "the best way to work around that problem is..."?

It also wouldn't hurt to explicitly mention here that the service_counters_* tables are the biggest table for OPM.


You may wish to parallelize the restoration to spare time. In this case, it may fail with a foreign key error, as the extensions install tables with foreign keys at the very beginning of the restore, and pg_restore does not try to respect this order. The trick is to parallelize only the restoration of the biggest tables.

The following commands assume that the database and the roles were already created,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "The following commands are an example of such a workaround, and assume that..."?

.. code-block:: bash

pg_restore -e --section=pre-data -d opm opm.dump
pg_restore -e --section=data -l opm.dump|grep -v 'service_counters_' > restore.1.list
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe some better names? Like opm_small_tables.list and opm_big_tables? Feel free to suggest better names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants