Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/backend/utils/activity/wait_event_names.txt
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,9 @@ SLRU_WRITE "Waiting for a write of an SLRU page."
SNAPBUILD_READ "Waiting for a read of a serialized historical catalog snapshot."
SNAPBUILD_SYNC "Waiting for a serialized historical catalog snapshot to reach durable storage."
SNAPBUILD_WRITE "Waiting for a write of a serialized historical catalog snapshot."
STDERR_WRITE "Waiting for a write to the server's standard error stream."
SYSLOGGER_WRITE "Waiting for a write to the syslogger pipe."
SYSLOG_WRITE "Waiting for a write to the system logger (syslog)."
TIMELINE_HISTORY_FILE_SYNC "Waiting for a timeline history file received via streaming replication to reach durable storage."
TIMELINE_HISTORY_FILE_WRITE "Waiting for a write of a timeline history file received via streaming replication."
TIMELINE_HISTORY_READ "Waiting for a read of a timeline history file."
Expand Down
11 changes: 11 additions & 0 deletions src/backend/utils/error/elog.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
#include "utils/pg_locale.h"
#include "utils/ps_status.h"
#include "utils/varlena.h"
#include "utils/wait_event.h"


/* In this module, access gettext() via err_gettext() */
Expand Down Expand Up @@ -2890,10 +2891,12 @@ write_syslog(int level, const char *line)

chunk_nr++;

pgstat_report_wait_start(WAIT_EVENT_SYSLOG_WRITE);
if (syslog_sequence_numbers)
syslog(level, "[%lu-%d] %s", seq, chunk_nr, buf);
else
syslog(level, "[%d] %s", chunk_nr, buf);
pgstat_report_wait_end();

line += buflen;
len -= buflen;
Expand All @@ -2902,10 +2905,12 @@ write_syslog(int level, const char *line)
else
{
/* message short enough */
pgstat_report_wait_start(WAIT_EVENT_SYSLOG_WRITE);
if (syslog_sequence_numbers)
syslog(level, "[%lu] %s", seq, line);
else
syslog(level, "%s", line);
pgstat_report_wait_end();
}
}
#endif /* HAVE_SYSLOG */
Expand Down Expand Up @@ -3090,7 +3095,9 @@ write_console(const char *line, int len)
* We ignore any error from write() here. We have no useful way to report
* it ... certainly whining on stderr isn't likely to be productive.
*/
pgstat_report_wait_start(WAIT_EVENT_STDERR_WRITE);
rc = write(fileno(stderr), line, len);
pgstat_report_wait_end();
(void) rc;
}

Expand Down Expand Up @@ -3937,7 +3944,9 @@ write_pipe_chunks(char *data, int len, int dest)
/* no need to set PIPE_PROTO_IS_LAST yet */
p.proto.len = PIPE_MAX_PAYLOAD;
memcpy(p.proto.data, data, PIPE_MAX_PAYLOAD);
pgstat_report_wait_start(WAIT_EVENT_SYSLOGGER_WRITE);
rc = write(fd, &p, PIPE_HEADER_SIZE + PIPE_MAX_PAYLOAD);
pgstat_report_wait_end();
(void) rc;
data += PIPE_MAX_PAYLOAD;
len -= PIPE_MAX_PAYLOAD;
Expand All @@ -3947,7 +3956,9 @@ write_pipe_chunks(char *data, int len, int dest)
p.proto.flags |= PIPE_PROTO_IS_LAST;
p.proto.len = len;
memcpy(p.proto.data, data, len);
pgstat_report_wait_start(WAIT_EVENT_SYSLOGGER_WRITE);
rc = write(fd, &p, PIPE_HEADER_SIZE + len);
pgstat_report_wait_end();
(void) rc;
}

Expand Down