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

Commitd7eb76b

Browse files
committed
Disable synchronous commits in pg_rewind.
If you point pg_rewind to a server that is using synchronous replication,with "pg_rewind --source-server=...", and the replication is not workingfor some reason, pg_rewind will get stuck because it creates a temporarytable, which needs to be replicated. You could call broken replication apilot error, but pg_rewind is often used in special circumstances, whenthere are changes to the replication setup.We don't do any "real" updates, and we don't care about fsyncing orreplicating the operations on the temporary tables, so fix that bysetting synchronous_commit off.Michael Banck, Michael Paquier. Backpatch to 9.5, where pg_rewind wasintroduced.Discussion: <20161005143938.GA12247@nighthawk.caipicrew.dd-dns.de>
1 parentb56fb69 commitd7eb76b

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎src/bin/pg_rewind/libpq_fetch.c

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ void
4949
libpqConnect(constchar*connstr)
5050
{
5151
char*str;
52+
PGresult*res;
5253

5354
conn=PQconnectdb(connstr);
5455
if (PQstatus(conn)==CONNECTION_BAD)
@@ -77,6 +78,19 @@ libpqConnect(const char *connstr)
7778
if (strcmp(str,"on")!=0)
7879
pg_fatal("full_page_writes must be enabled in the source server\n");
7980
pg_free(str);
81+
82+
/*
83+
* Although we don't do any "real" updates, we do work with a temporary
84+
* table. We don't care about synchronous commit for that. It doesn't
85+
* otherwise matter much, but if the server is using synchronous
86+
* replication, and replication isn't working for some reason, we don't
87+
* want to get stuck, waiting for it to start working again.
88+
*/
89+
res=PQexec(conn,"SET synchronous_commit = off");
90+
if (PQresultStatus(res)!=PGRES_COMMAND_OK)
91+
pg_fatal("could not set up connection context: %s",
92+
PQresultErrorMessage(res));
93+
PQclear(res);
8094
}
8195

8296
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp