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

Commita9c56ff

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 parent332be65 commita9c56ff

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
@@ -1960,6 +1960,9 @@ InitWalSenderSlot(void)
19601960
*/
19611961
walsnd->pid=MyProcPid;
19621962
walsnd->sentPtr=InvalidXLogRecPtr;
1963+
walsnd->write=InvalidXLogRecPtr;
1964+
walsnd->flush=InvalidXLogRecPtr;
1965+
walsnd->apply=InvalidXLogRecPtr;
19631966
walsnd->state=WALSNDSTATE_STARTUP;
19641967
walsnd->latch=&MyProc->procLatch;
19651968
SpinLockRelease(&walsnd->mutex);
@@ -2825,15 +2828,15 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
28252828
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
28262829
values[2]=LSNGetDatum(sentPtr);
28272830

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

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

2836-
if (apply==0)
2839+
if (XLogRecPtrIsInvalid(apply))
28372840
nulls[5]= true;
28382841
values[5]=LSNGetDatum(apply);
28392842

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp