Skip to content

Commit 841f656

Browse files
committed
Skip bgwriter's lock on newly promoted standby servers
Fixes ticket #1.
1 parent 0511137 commit 841f656

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

bin/pg_reorg.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,13 @@ const char *PROGRAM_EMAIL = "reorg-general@lists.pgfoundry.org";
2626
*/
2727
#define APPLY_COUNT 1000
2828

29+
/* The '1/1, -1/0' lock skipped is from the bgwriter on newly promoted
30+
* servers. See GH ticket #1.
31+
*/
2932
#define SQL_XID_SNAPSHOT \
3033
"SELECT reorg.array_accum(virtualtransaction) FROM pg_locks"\
31-
" WHERE locktype = 'virtualxid' AND pid <> pg_backend_pid()"
34+
" WHERE locktype = 'virtualxid' AND pid <> pg_backend_pid()"\
35+
" AND (virtualxid, virtualtransaction) <> ('1/1', '-1/0')"
3236

3337
#define SQL_XID_ALIVE \
3438
"SELECT pid FROM pg_locks WHERE locktype = 'virtualxid'"\

0 commit comments

Comments
 (0)