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

Commit263c195

Browse files
committed
Properly initialize write, flush and replay locations in walsender slots
These would leak random xlog positions if a walsender used for backup woulda walsender slot previously used by a replication walsender.In passing also fix a couple of cases where the xlog pointer is directlycompared to zero instead of using XLogRecPtrIsInvalid, noted byMichael Paquier.
1 parent6d96cd0 commit263c195

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

‎src/backend/replication/walsender.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1962,6 +1962,9 @@ InitWalSenderSlot(void)
19621962
*/
19631963
walsnd->pid=MyProcPid;
19641964
walsnd->sentPtr=InvalidXLogRecPtr;
1965+
walsnd->write=InvalidXLogRecPtr;
1966+
walsnd->flush=InvalidXLogRecPtr;
1967+
walsnd->apply=InvalidXLogRecPtr;
19651968
walsnd->state=WALSNDSTATE_STARTUP;
19661969
walsnd->latch=&MyProc->procLatch;
19671970
SpinLockRelease(&walsnd->mutex);
@@ -2821,15 +2824,15 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
28212824
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
28222825
values[2]=LSNGetDatum(sentPtr);
28232826

2824-
if (write==0)
2827+
if (XLogRecPtrIsInvalid(write))
28252828
nulls[3]= true;
28262829
values[3]=LSNGetDatum(write);
28272830

2828-
if (flush==0)
2831+
if (XLogRecPtrIsInvalid(flush))
28292832
nulls[4]= true;
28302833
values[4]=LSNGetDatum(flush);
28312834

2832-
if (apply==0)
2835+
if (XLogRecPtrIsInvalid(apply))
28332836
nulls[5]= true;
28342837
values[5]=LSNGetDatum(apply);
28352838

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp