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
This commit is contained in:
parent
8363102009
commit
bff258a273
@ -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;
|
||||
}
|
||||
|
@ -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;
|
||||
|
@ -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))
|
||||
|
Loading…
x
Reference in New Issue
Block a user