Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcc609c4

Browse files
committed
Allow pg_dump to use jobs and serializable transactions together.
Since 9.3, when the --jobs option was introduced, using it togetherwith the --serializable-deferrable option generated multipleerrors. We can get correct behavior by allowing the connectionwhich acquires the snapshot to use SERIALIZABLE, READ ONLY,DEFERRABLE and pass that to the workers running the otherconnections using REPEATABLE READ, READ ONLY. This is a bit of akluge since the SERIALIZABLE behavior is achieved by running someof the participating connections at a different isolation level,but it is a simple and safe change, suitable for back-patching.This will be followed by a proposal for a more invasive fix withsome slight behavioral changes on just the master branch, based onsuggestions from Andres Freund, but the kluge will be applied tomaster until something is agreed along those lines.Back-patched to 9.3, where the --jobs option was added.Based on report from Alexander Korotkov
1 parent39c46c5 commitcc609c4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

‎src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1004,7 +1004,15 @@ setup_connection(Archive *AH, const char *dumpencoding, char *use_role)
10041004
ExecuteSqlStatement(AH,"BEGIN");
10051005
if (AH->remoteVersion >=90100)
10061006
{
1007-
if (serializable_deferrable)
1007+
/*
1008+
* To support the combination of serializable_deferrable with the jobs
1009+
* option we use REPEATABLE READ for the worker connections that are
1010+
* passed a snapshot. As long as the snapshot is acquired in a
1011+
* SERIALIZABLE, READ ONLY, DEFERRABLE transaction, its use within a
1012+
* REPEATABLE READ transaction provides the appropriate integrity
1013+
* guarantees. This is a kluge, but safe for back-patching.
1014+
*/
1015+
if (serializable_deferrable&&AH->sync_snapshot_id==NULL)
10081016
ExecuteSqlStatement(AH,
10091017
"SET TRANSACTION ISOLATION LEVEL "
10101018
"SERIALIZABLE, READ ONLY, DEFERRABLE");

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp