pg_dump: Support using synchronized snapshots on standbys

This became possible by commit
6c2003f8a1.  This just makes pg_dump aware
of it and updates the documentation.

Author: Petr Jelinek <petr.jelinek@2ndquadrant.com>
This commit is contained in:
Peter Eisentraut 2017-08-16 19:46:50 -04:00
parent dcd052c8d2
commit cf851519d4
2 changed files with 12 additions and 10 deletions

View File

@ -337,14 +337,16 @@ PostgreSQL documentation
but to abort the dump. but to abort the dump.
</para> </para>
<para> <para>
For a consistent backup, the database server needs to support synchronized snapshots, For a consistent backup, the database server needs to support
a feature that was introduced in <productname>PostgreSQL</productname> 9.2. With this synchronized snapshots, a feature that was introduced in
feature, database clients can ensure they see the same data set even though they use <productname>PostgreSQL</productname> 9.2 for primary servers and 10
different connections. <command>pg_dump -j</command> uses multiple database for standbys. With this feature, database clients can ensure they see
connections; it connects to the database once with the master process and the same data set even though they use different connections.
once again for each worker job. Without the synchronized snapshot feature, the <command>pg_dump -j</command> uses multiple database connections; it
different worker jobs wouldn't be guaranteed to see the same data in each connection, connects to the database once with the master process and once again
which could lead to an inconsistent backup. for each worker job. Without the synchronized snapshot feature, the
different worker jobs wouldn't be guaranteed to see the same data in
each connection, which could lead to an inconsistent backup.
</para> </para>
<para> <para>
If you want to run a parallel dump of a pre-9.2 server, you need to make sure that the If you want to run a parallel dump of a pre-9.2 server, you need to make sure that the

View File

@ -1134,9 +1134,9 @@ setup_connection(Archive *AH, const char *dumpencoding,
AH->remoteVersion >= 90200 && AH->remoteVersion >= 90200 &&
!dopt->no_synchronized_snapshots) !dopt->no_synchronized_snapshots)
{ {
if (AH->isStandby) if (AH->isStandby && AH->remoteVersion < 100000)
exit_horribly(NULL, exit_horribly(NULL,
"Synchronized snapshots are not supported on standby servers.\n" "Synchronized snapshots on standby servers are not supported by this server version.\n"
"Run with --no-synchronized-snapshots instead if you do not need\n" "Run with --no-synchronized-snapshots instead if you do not need\n"
"synchronized snapshots.\n"); "synchronized snapshots.\n");