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

Commit504c717

Browse files
committed
Fix bug in handling of connections that pg_receivexlog creates.
Previously pg_receivexlog created new connection for WAL streamingeven though another connection which had been established to createor delete the replication slot was being left. This caused the unusedconnection to be left uselessly until pg_receivexlog exited.This bug was introduced by the commitd9f38c7.This patch changes pg_receivexlog so that the connection forthe replication slot is reused for WAL streaming.Andres Freund, slightly modified by me, reviewed by Michael Paquier
1 parent5c38a1d commit504c717

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

‎src/bin/pg_basebackup/pg_receivexlog.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ StreamLog(void)
293293
/*
294294
* Connect in replication mode to the server
295295
*/
296-
conn=GetConnection();
296+
if (conn==NULL)
297+
conn=GetConnection();
297298
if (!conn)
298299
/* Error message already written in GetConnection() */
299300
return;
@@ -345,6 +346,7 @@ StreamLog(void)
345346
fsync_interval);
346347

347348
PQfinish(conn);
349+
conn=NULL;
348350
}
349351

350352
/*
@@ -591,6 +593,11 @@ main(int argc, char **argv)
591593
disconnect_and_exit(1);
592594
}
593595

596+
/*
597+
* Don't close the connection here so that subsequent StreamLog()
598+
* can reuse it.
599+
*/
600+
594601
while (true)
595602
{
596603
StreamLog();

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp