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

Commit9eacd42

Browse files
committed
Make sure walsender state is only read while holding the spinlock
Noted by Robert Haas.
1 parent712dd95 commit9eacd42

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

‎src/backend/replication/walsender.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1050,6 +1050,7 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
10501050
volatileWalSnd*walsnd=&WalSndCtl->walsnds[i];
10511051
charsent_location[MAXFNAMELEN];
10521052
XLogRecPtrsentPtr;
1053+
WalSndStatestate;
10531054
Datumvalues[PG_STAT_GET_WAL_SENDERS_COLS];
10541055
boolnulls[PG_STAT_GET_WAL_SENDERS_COLS];
10551056

@@ -1058,14 +1059,15 @@ pg_stat_get_wal_senders(PG_FUNCTION_ARGS)
10581059

10591060
SpinLockAcquire(&walsnd->mutex);
10601061
sentPtr=walsnd->sentPtr;
1062+
state=walsnd->state;
10611063
SpinLockRelease(&walsnd->mutex);
10621064

10631065
snprintf(sent_location,sizeof(sent_location),"%X/%X",
10641066
sentPtr.xlogid,sentPtr.xrecoff);
10651067

10661068
memset(nulls,0,sizeof(nulls));
10671069
values[0]=Int32GetDatum(walsnd->pid);
1068-
values[1]=CStringGetTextDatum(WalSndGetStateString(walsnd->state));
1070+
values[1]=CStringGetTextDatum(WalSndGetStateString(state));
10691071
values[2]=CStringGetTextDatum(sent_location);
10701072

10711073
tuplestore_putvalues(tupstore,tupdesc,values,nulls);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp