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
WALSenderTimelineHistoryRead
Waiting for a read from a timeline history file during walsender timeline command.
+ |
+ WALSync
+ Waiting for a WAL file to reach stable storage.
+
|
WALSyncMethodAssign
Waiting for data to reach stable storage while assigning WAL sync method.
void
issue_xlog_fsync(int fd, XLogSegNo segno)
{
+ pgstat_report_wait_start(WAIT_EVENT_WAL_SYNC);
switch (sync_method)
{
case SYNC_METHOD_FSYNC:
elog(PANIC, "unrecognized wal_sync_method: %d", sync_method);
break;
}
+ pgstat_report_wait_end();
}
/*
case WAIT_EVENT_WAL_READ:
event_name = "WALRead";
break;
+ case WAIT_EVENT_WAL_SYNC:
+ event_name = "WALSync";
+ break;
case WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN:
event_name = "WALSyncMethodAssign";
break;
WAIT_EVENT_WAL_INIT_SYNC,
WAIT_EVENT_WAL_INIT_WRITE,
WAIT_EVENT_WAL_READ,
+ WAIT_EVENT_WAL_SYNC,
WAIT_EVENT_WAL_SYNC_METHOD_ASSIGN,
WAIT_EVENT_WAL_WRITE
} WaitEventIO;