Skip to content

Commit c55de5e

Browse files
committed
Add wait event for fsync of WAL segments
This has been visibly a forgotten spot in the first implementation of wait events for I/O added by 249cf07, and what has been missing is a fsync call for WAL segments which is a wrapper reacting on the value of GUC wal_sync_method. Reported-by: Konstantin Knizhnik Author: Konstantin Knizhnik Reviewed-by: Craig Ringer, Michael Paquier Discussion: https://postgr.es/m/4a243897-0ad8-f471-aa40-242591f2476e@postgrespro.ru
1 parent c072e80 commit c55de5e

File tree

4 files changed

+10
-0
lines changed

4 files changed

+10
-0
lines changed

doc/src/sgml/monitoring.sgml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1674,6 +1674,10 @@ postgres 27093 0.0 0.0 30096 2752 ? Ss 11:34 0:00 postgres: ser
16741674
<entry><literal>WALSenderTimelineHistoryRead</literal></entry>
16751675
<entry>Waiting for a read from a timeline history file during walsender timeline command.</entry>
16761676
</row>
1677+
<row>
1678+
<entry><literal>WALSync</literal></entry>
1679+
<entry>Waiting for a WAL file to reach stable storage.</entry>
1680+
</row>
16771681
<row>
16781682
<entry><literal>WALSyncMethodAssign</literal></entry>
16791683
<entry>Waiting for data to reach stable storage while assigning WAL sync method.</entry>

src/backend/access/transam/xlog.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10156,6 +10156,7 @@ assign_xlog_sync_method(int new_sync_method, void *extra)
1015610156
void
1015710157
issue_xlog_fsync(int fd, XLogSegNo segno)
1015810158
{
10159+
pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC);
1015910160
switch (sync_method)
1016010161
{
1016110162
case SYNC_METHOD_FSYNC:
@@ -10191,6 +10192,7 @@ issue_xlog_fsync(int fd, XLogSegNo segno)
1019110192
elog(PANIC, "unrecognized wal_sync_method: %d", sync_method);
1019210193
break;
1019310194
}
10195+
pgstat_report_wait_end();
1019410196
}
1019510197

1019610198
/*

src/backend/postmaster/pgstat.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3925,6 +3925,9 @@ pgstat_get_wait_io(WaitEventIO w)
39253925
case WAIT_EVENT_WAL_READ:
39263926
event_name = "WALRead";
39273927
break;
3928+
case WAIT_EVENT_WAL_SYNC:
3929+
event_name = "WALSync";
3930+
break;
39283931
case WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN:
39293932
event_name = "WALSyncMethodAssign";
39303933
break;

src/include/pgstat.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -921,6 +921,7 @@ typedef enum
921921
WAIT_EVENT_WAL_INIT_SYNC,
922922
WAIT_EVENT_WAL_INIT_WRITE,
923923
WAIT_EVENT_WAL_READ,
924+
WAIT_EVENT_WAL_SYNC,
924925
WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN,
925926
WAIT_EVENT_WAL_WRITE
926927
} WaitEventIO;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy