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

Commit3f7b04d

Browse files
committed
pg_stat_replication.sync_state was displayed incorrectly at page boundary.
XLogRecPtrIsInvalid() only checks the xrecoff field, which is correct whenchecking if a WAL record could legally begin at the given position, but WALsending can legally be paused at a page boundary, in which case xrecoff is0. Use XLByteEQ(..., InvalidXLogRecPtr) instead, which checks that bothxlogid and xrecoff are 0.9.3 doesn't have this problem because XLogRecPtr is now a single 64-bitinteger, so XLogRecPtrIsInvalid() does the right thing. Apply to 9.2, and9.1 where pg_stat_replication view was introduced.Kyotaro HORIGUCHI, reviewed by Fujii Masao.
1 parent430b47f commit3f7b04d

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

‎src/backend/replication/syncrep.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545

4646
#include<unistd.h>
4747

48+
#include"access/transam.h"
4849
#include"access/xact.h"
4950
#include"miscadmin.h"
5051
#include"replication/syncrep.h"
@@ -382,7 +383,7 @@ SyncRepReleaseWaiters(void)
382383
*/
383384
if (MyWalSnd->sync_standby_priority==0||
384385
MyWalSnd->state<WALSNDSTATE_STREAMING||
385-
XLogRecPtrIsInvalid(MyWalSnd->flush))
386+
XLByteEQ(MyWalSnd->flush,InvalidXLogRecPtr))
386387
return;
387388

388389
/*
@@ -403,7 +404,7 @@ SyncRepReleaseWaiters(void)
403404
walsnd->sync_standby_priority>0&&
404405
(priority==0||
405406
priority>walsnd->sync_standby_priority)&&
406-
!XLogRecPtrIsInvalid(walsnd->flush))
407+
!XLByteEQ(walsnd->flush,InvalidXLogRecPtr))
407408
{
408409
priority=walsnd->sync_standby_priority;
409410
syncWalSnd=walsnd;

‎src/backend/replication/walsender.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1559,14 +1559,14 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
15591559
* which always returns an invalid flush location, as an
15601560
* asynchronous standby.
15611561
*/
1562-
sync_priority[i]=XLogRecPtrIsInvalid(walsnd->flush) ?
1562+
sync_priority[i]=XLByteEQ(walsnd->flush,InvalidXLogRecPtr) ?
15631563
0 :walsnd->sync_standby_priority;
15641564

15651565
if (walsnd->state==WALSNDSTATE_STREAMING&&
15661566
walsnd->sync_standby_priority>0&&
15671567
(priority==0||
15681568
priority>walsnd->sync_standby_priority)&&
1569-
!XLogRecPtrIsInvalid(walsnd->flush))
1569+
!XLByteEQ(walsnd->flush,InvalidXLogRecPtr))
15701570
{
15711571
priority=walsnd->sync_standby_priority;
15721572
sync_standby=i;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp