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

Commit61c7bee

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 parent6bdef13 commit61c7bee

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
@@ -1957,6 +1957,9 @@ InitWalSenderSlot(void)
19571957
*/
19581958
walsnd->pid=MyProcPid;
19591959
walsnd->sentPtr=InvalidXLogRecPtr;
1960+
walsnd->write=InvalidXLogRecPtr;
1961+
walsnd->flush=InvalidXLogRecPtr;
1962+
walsnd->apply=InvalidXLogRecPtr;
19601963
walsnd->state=WALSNDSTATE_STARTUP;
19611964
SpinLockRelease(&walsnd->mutex);
19621965
/* don't need the lock anymore */
@@ -2843,15 +2846,15 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
28432846
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
28442847
values[2]=LSNGetDatum(sentPtr);
28452848

2846-
if (write==0)
2849+
if (XLogRecPtrIsInvalid(write))
28472850
nulls[3]= true;
28482851
values[3]=LSNGetDatum(write);
28492852

2850-
if (flush==0)
2853+
if (XLogRecPtrIsInvalid(flush))
28512854
nulls[4]= true;
28522855
values[4]=LSNGetDatum(flush);
28532856

2854-
if (apply==0)
2857+
if (XLogRecPtrIsInvalid(apply))
28552858
nulls[5]= true;
28562859
values[5]=LSNGetDatum(apply);
28572860

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp