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

Commita1fb849

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 parent5f1de60 commita1fb849

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
@@ -1195,6 +1195,9 @@ InitWalSenderSlot(void)
11951195
*/
11961196
walsnd->pid=MyProcPid;
11971197
walsnd->sentPtr=InvalidXLogRecPtr;
1198+
walsnd->write=InvalidXLogRecPtr;
1199+
walsnd->flush=InvalidXLogRecPtr;
1200+
walsnd->apply=InvalidXLogRecPtr;
11981201
walsnd->state=WALSNDSTATE_STARTUP;
11991202
SpinLockRelease(&walsnd->mutex);
12001203
/* don't need the lock anymore */
@@ -1994,19 +1997,19 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
19941997
(uint32) (sentPtr >>32), (uint32)sentPtr);
19951998
values[2]=CStringGetTextDatum(location);
19961999

1997-
if (write==0)
2000+
if (XLogRecPtrIsInvalid(write))
19982001
nulls[3]= true;
19992002
snprintf(location,sizeof(location),"%X/%X",
20002003
(uint32) (write >>32), (uint32)write);
20012004
values[3]=CStringGetTextDatum(location);
20022005

2003-
if (flush==0)
2006+
if (XLogRecPtrIsInvalid(flush))
20042007
nulls[4]= true;
20052008
snprintf(location,sizeof(location),"%X/%X",
20062009
(uint32) (flush >>32), (uint32)flush);
20072010
values[4]=CStringGetTextDatum(location);
20082011

2009-
if (apply==0)
2012+
if (XLogRecPtrIsInvalid(apply))
20102013
nulls[5]= true;
20112014
snprintf(location,sizeof(location),"%X/%X",
20122015
(uint32) (apply >>32), (uint32)apply);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp