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

Commit18808f8

Browse files
committed
Add wait events for recovery conflicts.
This commit introduces new wait events RecoveryConflictSnapshot andRecoveryConflictTablespace. The former is reported while waiting forrecovery conflict resolution on a vacuum cleanup. The latter is reportedwhile waiting for recovery conflict resolution on dropping tablespace.Also this commit changes the code so that the wait event Lock is reportedwhile waiting in ResolveRecoveryConflictWithVirtualXIDs() for recoveryconflict resolution on a lock. Basically the wait event Lock is reportedduring that wait, but previously was not reported only when that waithappened in ResolveRecoveryConflictWithVirtualXIDs().Author: Masahiko SawadaReviewed-by: Fujii MasaoDiscussion:https://postgr.es/m/CA+fd4k4mXWTwfQLS3RPwGr4xnfAEs1ysFfgYHvmmoUgv6Zxvmg@mail.gmail.com
1 parent9d8ef98 commit18808f8

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

‎doc/src/sgml/monitoring.sgml

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1346,7 +1346,7 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
13461346
<entry>Waiting in an extension.</entry>
13471347
</row>
13481348
<row>
1349-
<entry morerows="38"><literal>IPC</literal></entry>
1349+
<entry morerows="40"><literal>IPC</literal></entry>
13501350
<entry><literal>BackupWaitWalArchive</literal></entry>
13511351
<entry>Waiting for WAL files required for the backup to be successfully archived.</entry>
13521352
</row>
@@ -1482,6 +1482,14 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
14821482
<entry><literal>Promote</literal></entry>
14831483
<entry>Waiting for standby promotion.</entry>
14841484
</row>
1485+
<row>
1486+
<entry><literal>RecoveryConflictSnapshot</literal></entry>
1487+
<entry>Waiting for recovery conflict resolution on a vacuum cleanup.</entry>
1488+
</row>
1489+
<row>
1490+
<entry><literal>RecoveryConflictTablespace</literal></entry>
1491+
<entry>Waiting for recovery conflict resolution on dropping tablespace.</entry>
1492+
</row>
14851493
<row>
14861494
<entry><literal>RecoveryPause</literal></entry>
14871495
<entry>Waiting for recovery to be resumed.</entry>

‎src/backend/postmaster/pgstat.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3852,6 +3852,12 @@ pgstat_get_wait_ipc(WaitEventIPC w)
38523852
caseWAIT_EVENT_PROMOTE:
38533853
event_name="Promote";
38543854
break;
3855+
caseWAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT:
3856+
event_name="RecoveryConflictSnapshot";
3857+
break;
3858+
caseWAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE:
3859+
event_name="RecoveryConflictTablespace";
3860+
break;
38553861
caseWAIT_EVENT_RECOVERY_PAUSE:
38563862
event_name="RecoveryPause";
38573863
break;

‎src/backend/storage/ipc/standby.c

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ intmax_standby_streaming_delay = 30 * 1000;
4343
staticHTAB*RecoveryLockLists;
4444

4545
staticvoidResolveRecoveryConflictWithVirtualXIDs(VirtualTransactionId*waitlist,
46-
ProcSignalReasonreason,boolreport_waiting);
46+
ProcSignalReasonreason,
47+
uint32wait_event_info,
48+
boolreport_waiting);
4749
staticvoidSendRecoveryConflictWithBufferPin(ProcSignalReasonreason);
4850
staticXLogRecPtrLogCurrentRunningXacts(RunningTransactionsCurrRunningXacts);
4951
staticvoidLogAccessExclusiveLocks(intnlocks,xl_standby_lock*locks);
@@ -184,7 +186,7 @@ static intstandbyWait_us = STANDBY_INITIAL_WAIT_US;
184186
* more then we return true, if we can wait some more return false.
185187
*/
186188
staticbool
187-
WaitExceedsMaxStandbyDelay(void)
189+
WaitExceedsMaxStandbyDelay(uint32wait_event_info)
188190
{
189191
TimestampTzltime;
190192

@@ -198,7 +200,9 @@ WaitExceedsMaxStandbyDelay(void)
198200
/*
199201
* Sleep a bit (this is essential to avoid busy-waiting).
200202
*/
203+
pgstat_report_wait_start(wait_event_info);
201204
pg_usleep(standbyWait_us);
205+
pgstat_report_wait_end();
202206

203207
/*
204208
* Progressively increase the sleep times, but not to more than 1s, since
@@ -223,7 +227,8 @@ WaitExceedsMaxStandbyDelay(void)
223227
*/
224228
staticvoid
225229
ResolveRecoveryConflictWithVirtualXIDs(VirtualTransactionId*waitlist,
226-
ProcSignalReasonreason,boolreport_waiting)
230+
ProcSignalReasonreason,uint32wait_event_info,
231+
boolreport_waiting)
227232
{
228233
TimestampTzwaitStart=0;
229234
char*new_status;
@@ -264,7 +269,7 @@ ResolveRecoveryConflictWithVirtualXIDs(VirtualTransactionId *waitlist,
264269
}
265270

266271
/* Is it time to kill it? */
267-
if (WaitExceedsMaxStandbyDelay())
272+
if (WaitExceedsMaxStandbyDelay(wait_event_info))
268273
{
269274
pid_tpid;
270275

@@ -317,6 +322,7 @@ ResolveRecoveryConflictWithSnapshot(TransactionId latestRemovedXid, RelFileNode
317322

318323
ResolveRecoveryConflictWithVirtualXIDs(backends,
319324
PROCSIG_RECOVERY_CONFLICT_SNAPSHOT,
325+
WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT,
320326
true);
321327
}
322328

@@ -346,6 +352,7 @@ ResolveRecoveryConflictWithTablespace(Oid tsid)
346352
InvalidOid);
347353
ResolveRecoveryConflictWithVirtualXIDs(temp_file_users,
348354
PROCSIG_RECOVERY_CONFLICT_TABLESPACE,
355+
WAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE,
349356
true);
350357
}
351358

@@ -417,6 +424,7 @@ ResolveRecoveryConflictWithLock(LOCKTAG locktag)
417424
*/
418425
ResolveRecoveryConflictWithVirtualXIDs(backends,
419426
PROCSIG_RECOVERY_CONFLICT_LOCK,
427+
PG_WAIT_LOCK |locktag.locktag_type,
420428
false);
421429
}
422430
else

‎src/include/pgstat.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -881,6 +881,8 @@ typedef enum
881881
WAIT_EVENT_PARALLEL_FINISH,
882882
WAIT_EVENT_PROCARRAY_GROUP_UPDATE,
883883
WAIT_EVENT_PROMOTE,
884+
WAIT_EVENT_RECOVERY_CONFLICT_SNAPSHOT,
885+
WAIT_EVENT_RECOVERY_CONFLICT_TABLESPACE,
884886
WAIT_EVENT_RECOVERY_PAUSE,
885887
WAIT_EVENT_REPLICATION_ORIGIN_DROP,
886888
WAIT_EVENT_REPLICATION_SLOT_DROP,

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp