diff options
Diffstat (limited to 'src/backend/utils/activity/pgstat_archiver.c')
-rw-r--r-- | src/backend/utils/activity/pgstat_archiver.c | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/src/backend/utils/activity/pgstat_archiver.c b/src/backend/utils/activity/pgstat_archiver.c new file mode 100644 index 00000000000..36788f7ab44 --- /dev/null +++ b/src/backend/utils/activity/pgstat_archiver.c @@ -0,0 +1,44 @@ +/* ------------------------------------------------------------------------- + * + * pgstat_archiver.c + * Implementation of archiver statistics. + * + * This file contains the implementation of archiver statistics. It is kept + * separate from pgstat.c to enforce the line between the statistics access / + * storage implementation and the details about individual types of + * statistics. + * + * Copyright (c) 2001-2022, PostgreSQL Global Development Group + * + * IDENTIFICATION + * src/backend/utils/activity/pgstat_archiver.c + * ------------------------------------------------------------------------- + */ + +#include "postgres.h" + +#include "utils/pgstat_internal.h" +#include "utils/timestamp.h" + + +/* ---------- + * pgstat_send_archiver() - + * + * Tell the collector about the WAL file that we successfully + * archived or failed to archive. + * ---------- + */ +void +pgstat_send_archiver(const char *xlog, bool failed) +{ + PgStat_MsgArchiver msg; + + /* + * Prepare and send the message + */ + pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_ARCHIVER); + msg.m_failed = failed; + strlcpy(msg.m_xlog, xlog, sizeof(msg.m_xlog)); + msg.m_timestamp = GetCurrentTimestamp(); + pgstat_send(&msg, sizeof(msg)); +} |