Skip to content

Commit bff258a

Browse files
committed
pgstat: rename pgstat_initstats() to pgstat_relation_init().
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
1 parent 8363102 commit bff258a

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

src/backend/access/common/relation.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ relation_open(Oid relationId, LOCKMODE lockmode)
7373
if (RelationUsesLocalBuffers(r))
7474
MyXactFlags |= XACT_FLAGS_ACCESSEDTEMPNAMESPACE;
7575

76-
pgstat_initstats(r);
76+
pgstat_relation_init(r);
7777

7878
return r;
7979
}
@@ -123,7 +123,7 @@ try_relation_open(Oid relationId, LOCKMODE lockmode)
123123
if (RelationUsesLocalBuffers(r))
124124
MyXactFlags |= XACT_FLAGS_ACCESSEDTEMPNAMESPACE;
125125

126-
pgstat_initstats(r);
126+
pgstat_relation_init(r);
127127

128128
return r;
129129
}

src/backend/postmaster/pgstat.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ static bool pgStatRunningInCollector = false;
188188
* for the life of the backend. Also, we zero out the t_id fields of the
189189
* contained PgStat_TableStatus structs whenever they are not actively in use.
190190
* This allows relcache pgstat_info pointers to be treated as long-lived data,
191-
* avoiding repeated searches in pgstat_initstats() when a relation is
191+
* avoiding repeated searches in pgstat_relation_init() when a relation is
192192
* repeatedly opened during a transaction.
193193
*/
194194
#define TABSTAT_QUANTUM 100 /* we alloc this many at a time */
@@ -2147,7 +2147,7 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
21472147

21482148

21492149
/* ----------
2150-
* pgstat_initstats() -
2150+
* pgstat_relation_init() -
21512151
*
21522152
* Initialize a relcache entry to count access statistics.
21532153
* Called whenever a relation is opened.
@@ -2159,7 +2159,7 @@ pgstat_end_function_usage(PgStat_FunctionCallUsage *fcu, bool finalize)
21592159
* ----------
21602160
*/
21612161
void
2162-
pgstat_initstats(Relation rel)
2162+
pgstat_relation_init(Relation rel)
21632163
{
21642164
Oid rel_id = rel->rd_id;
21652165
char relkind = rel->rd_rel->relkind;

src/include/pgstat.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -1102,7 +1102,7 @@ extern void pgstat_initialize(void);
11021102
extern PgStat_TableStatus *find_tabstat_entry(Oid rel_id);
11031103
extern PgStat_BackendFunctionEntry *find_funcstat_entry(Oid func_id);
11041104

1105-
extern void pgstat_initstats(Relation rel);
1105+
extern void pgstat_relation_init(Relation rel);
11061106

11071107
#define pgstat_relation_should_count(rel) \
11081108
(likely((rel)->pgstat_info != NULL))

0 commit comments

Comments
 (0)