From 9e5165673714b929a76bf39792f04ea5e348f0a3 Mon Sep 17 00:00:00 2001 From: Masahiro Ikeda Date: Tue, 28 Apr 2020 01:39:25 +0000 Subject: [PATCH] Fix to report wait events about timeline history file. Even though a timeline history file is read or written, some wait events are not reported. This patch fixes those issues. --- src/backend/access/transam/timeline.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/backend/access/transam/timeline.c b/src/backend/access/transam/timeline.c index de57d69..7a652a8 100644 --- a/src/backend/access/transam/timeline.c +++ b/src/backend/access/transam/timeline.c @@ -123,6 +123,7 @@ readTimeLineHistory(TimeLineID targetTLI) * Parse the file... */ prevend = InvalidXLogRecPtr; + pgstat_report_wait_start(WAIT_EVENT_TIMELINE_HISTORY_READ); while (fgets(fline, sizeof(fline), fd) != NULL) { /* skip leading whitespace and check for # comment */ @@ -172,6 +173,7 @@ readTimeLineHistory(TimeLineID targetTLI) /* we ignore the remainder of each line */ } + pgstat_report_wait_end(); FreeFile(fd); @@ -393,6 +395,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, nbytes = strlen(buffer); errno = 0; + pgstat_report_wait_start(WAIT_EVENT_TIMELINE_HISTORY_WRITE); if ((int) write(fd, buffer, nbytes) != nbytes) { int save_errno = errno; @@ -408,6 +411,7 @@ writeTimeLineHistory(TimeLineID newTLI, TimeLineID parentTLI, (errcode_for_file_access(), errmsg("could not write to file \"%s\": %m", tmppath))); } + pgstat_report_wait_end(); pgstat_report_wait_start(WAIT_EVENT_TIMELINE_HISTORY_SYNC); if (pg_fsync(fd) != 0) -- 2.9.5