pgstat: rename pgstat_initstats() to pgstat_relation_init().
authorAndres Freund <andres@anarazel.de>
Mon, 21 Mar 2022 02:12:09 +0000 (19:12 -0700)
committerAndres Freund <andres@anarazel.de>
Mon, 21 Mar 2022 02:12:09 +0000 (19:12 -0700)
The old name was overly generic. An upcoming commit moves relation stats
handling into its own file, making pgstat_initstats() look even more out of
place.

Author: Andres Freund <andres@anarazel.de>
Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de

src/backend/access/common/relation.c
src/backend/postmaster/pgstat.c
src/include/pgstat.h

index 1c02bf03a3441434677c23547e38872ab4ce555d..003663ab811f484815633b307f59427874ad7435 100644 (file)
@@ -73,7 +73,7 @@ relation_open(Oid relationId, LOCKMODE lockmode)
    if (RelationUsesLocalBuffers(r))
        MyXactFlags |= XACT_FLAGS_ACCESSEDTEMPNAMESPACE;
 
-   pgstat_initstats(r);
+   pgstat_relation_init(r);
 
    return r;
 }
@@ -123,7 +123,7 @@ try_relation_open(Oid relationId, LOCKMODE lockmode)
    if (RelationUsesLocalBuffers(r))
        MyXactFlags |= XACT_FLAGS_ACCESSEDTEMPNAMESPACE;
 
-   pgstat_initstats(r);
+   pgstat_relation_init(r);
 
    return r;
 }
index 62411313af0f015f65baedec413affe264c63017..e90b456006b02405b10afe95a7a22371566a4c7a 100644 (file)
@@ -188,7 +188,7 @@ static bool pgStatRunningInCollector = false;
  * for the life of the backend.  Also, we zero out the t_id fields of the
  * contained PgStat_TableStatus structs whenever they are not actively in use.
  * This allows relcache pgstat_info pointers to be treated as long-lived data,
- * avoiding repeated searches in pgstat_initstats() when a relation is
+ * avoiding repeated searches in pgstat_relation_init() when a relation is
  * repeatedly opened during a transaction.
  */
 #define TABSTAT_QUANTUM        100 /* we alloc this many at a time */
@@ -2147,7 +2147,7 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
 
 
 /* ----------
- * pgstat_initstats() -
+ * pgstat_relation_init() -
  *
  * Initialize a relcache entry to count access statistics.
  * Called whenever a relation is opened.
@@ -2159,7 +2159,7 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
  * ----------
  */
 void
-pgstat_initstats(Relation rel)
+pgstat_relation_init(Relation rel)
 {
    Oid         rel_id = rel->rd_id;
    char        relkind = rel->rd_rel->relkind;
index 3499c86dbfeedd408c11498e8a4fbfa8afc3cf67..cfb00ba65a5dfb2505b84c51662f0ea9cdd89176 100644 (file)
@@ -1102,7 +1102,7 @@ extern void pgstat_initialize(void);
 extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
 extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id);
 
-extern void pgstat_initstats(Relation rel);
+extern void pgstat_relation_init(Relation rel);
 
 #define pgstat_relation_should_count(rel)                           \
    (likely((rel)->pgstat_info != NULL))