pgstat: move pgstat_report_autovac() to pgstat_database.c.
authorAndres Freund <andres@anarazel.de>
Wed, 6 Apr 2022 19:41:29 +0000 (12:41 -0700)
committerAndres Freund <andres@anarazel.de>
Wed, 6 Apr 2022 19:41:29 +0000 (12:41 -0700)
I got the location wrong in 13619598f10. The name did make it sound like it
belonged in pgstat_relation.c...

src/backend/utils/activity/pgstat_database.c
src/backend/utils/activity/pgstat_relation.c
src/include/pgstat.h

index b4fba80835ac7d84c3da890ebac866209140e60c..6c38fe86a42833046c8b19c18128e74d15d3ac8f 100644 (file)
@@ -54,6 +54,26 @@ pgstat_drop_database(Oid databaseid)
        pgstat_send(&msg, sizeof(msg));
 }
 
+/*
+ * Called from autovacuum.c to report startup of an autovacuum process.
+ * We are called before InitPostgres is done, so can't rely on MyDatabaseId;
+ * the db OID must be passed in, instead.
+ */
+void
+pgstat_report_autovac(Oid dboid)
+{
+       PgStat_MsgAutovacStart msg;
+
+       if (pgStatSock == PGINVALID_SOCKET)
+               return;
+
+       pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_AUTOVAC_START);
+       msg.m_databaseid = dboid;
+       msg.m_start_time = GetCurrentTimestamp();
+
+       pgstat_send(&msg, sizeof(msg));
+}
+
 /*
  * Tell the collector about a Hot Standby recovery conflict.
  */
index 74b62c39c0d29d7279060b0114c2a31fb5a5350f..957f5b858a5b672f5d08f706bb61a9d56acbf495 100644 (file)
@@ -167,26 +167,6 @@ pgstat_drop_relation(Oid relid)
 }
 #endif                                                 /* NOT_USED */
 
-/*
- * Called from autovacuum.c to report startup of an autovacuum process.
- * We are called before InitPostgres is done, so can't rely on MyDatabaseId;
- * the db OID must be passed in, instead.
- */
-void
-pgstat_report_autovac(Oid dboid)
-{
-       PgStat_MsgAutovacStart msg;
-
-       if (pgStatSock == PGINVALID_SOCKET)
-               return;
-
-       pgstat_setheader(&msg.m_hdr, PGSTAT_MTYPE_AUTOVAC_START);
-       msg.m_databaseid = dboid;
-       msg.m_start_time = GetCurrentTimestamp();
-
-       pgstat_send(&msg, sizeof(msg));
-}
-
 /*
  * Tell the collector about the table we just vacuumed.
  */
index 3584078f6eaf61b7418b56e1d22fcf50fb92e0cd..41fdf5f5a39e94a5c2aa0b6e9b1abc3977a2b0b9 100644 (file)
@@ -1025,6 +1025,7 @@ extern void pgstat_send_checkpointer(void);
  */
 
 extern void pgstat_drop_database(Oid databaseid);
+extern void pgstat_report_autovac(Oid dboid);
 extern void pgstat_report_recovery_conflict(int reason);
 extern void pgstat_report_deadlock(void);
 extern void pgstat_report_checksum_failures_in_db(Oid dboid, int failurecount);
@@ -1060,7 +1061,6 @@ extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id);
 
 extern void pgstat_relation_init(Relation rel);
 
-extern void pgstat_report_autovac(Oid dboid);
 extern void pgstat_report_vacuum(Oid tableoid, bool shared,
                                                                 PgStat_Counter livetuples, PgStat_Counter deadtuples);
 extern void pgstat_report_analyze(Relation rel,