34
34
* for the life of the backend. Also, we zero out the t_id fields of the
35
35
* contained PgStat_TableStatus structs whenever they are not actively in use.
36
36
* This allows relcache pgstat_info pointers to be treated as long-lived data,
37
- * avoiding repeated searches in pgstat_relation_init () when a relation is
37
+ * avoiding repeated searches in pgstat_init_relation () when a relation is
38
38
* repeatedly opened during a transaction.
39
39
*/
40
40
#define TABSTAT_QUANTUM 100 /* we alloc this many at a time */
@@ -78,8 +78,8 @@ static PgStat_TableStatus *get_tabstat_entry(Oid rel_id, bool isshared);
78
78
static void pgstat_send_tabstat (PgStat_MsgTabstat * tsmsg , TimestampTz now );
79
79
static void add_tabstat_xact_level (PgStat_TableStatus * pgstat_info , int nest_level );
80
80
static void ensure_tabstat_xact_level (PgStat_TableStatus * pgstat_info );
81
- static void pgstat_truncdrop_save_counters (PgStat_TableXactStatus * trans , bool is_drop );
82
- static void pgstat_truncdrop_restore_counters (PgStat_TableXactStatus * trans );
81
+ static void save_truncdrop_counters (PgStat_TableXactStatus * trans , bool is_drop );
82
+ static void restore_truncdrop_counters (PgStat_TableXactStatus * trans );
83
83
84
84
85
85
/*
@@ -109,7 +109,7 @@ pgstat_copy_relation_stats(Relation dst, Relation src)
109
109
if (!srcstats )
110
110
return ;
111
111
112
- if (pgstat_relation_should_count (dst ))
112
+ if (pgstat_should_count_relation (dst ))
113
113
{
114
114
/*
115
115
* XXX: temporarily this does not actually quite do what the name
@@ -137,7 +137,7 @@ pgstat_copy_relation_stats(Relation dst, Relation src)
137
137
* same relation is touched repeatedly within a transaction.
138
138
*/
139
139
void
140
- pgstat_relation_init (Relation rel )
140
+ pgstat_init_relation (Relation rel )
141
141
{
142
142
Oid rel_id = rel -> rd_id ;
143
143
char relkind = rel -> rd_rel -> relkind ;
@@ -242,7 +242,7 @@ pgstat_report_analyze(Relation rel,
242
242
*
243
243
* Waste no time on partitioned tables, though.
244
244
*/
245
- if (pgstat_relation_should_count (rel ) &&
245
+ if (pgstat_should_count_relation (rel ) &&
246
246
rel -> rd_rel -> relkind != RELKIND_PARTITIONED_TABLE )
247
247
{
248
248
PgStat_TableXactStatus * trans ;
@@ -276,7 +276,7 @@ pgstat_report_analyze(Relation rel,
276
276
void
277
277
pgstat_count_heap_insert (Relation rel , PgStat_Counter n )
278
278
{
279
- if (pgstat_relation_should_count (rel ))
279
+ if (pgstat_should_count_relation (rel ))
280
280
{
281
281
PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
282
282
@@ -291,7 +291,7 @@ pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
291
291
void
292
292
pgstat_count_heap_update (Relation rel , bool hot )
293
293
{
294
- if (pgstat_relation_should_count (rel ))
294
+ if (pgstat_should_count_relation (rel ))
295
295
{
296
296
PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
297
297
@@ -310,7 +310,7 @@ pgstat_count_heap_update(Relation rel, bool hot)
310
310
void
311
311
pgstat_count_heap_delete (Relation rel )
312
312
{
313
- if (pgstat_relation_should_count (rel ))
313
+ if (pgstat_should_count_relation (rel ))
314
314
{
315
315
PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
316
316
@@ -325,12 +325,12 @@ pgstat_count_heap_delete(Relation rel)
325
325
void
326
326
pgstat_count_truncate (Relation rel )
327
327
{
328
- if (pgstat_relation_should_count (rel ))
328
+ if (pgstat_should_count_relation (rel ))
329
329
{
330
330
PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
331
331
332
332
ensure_tabstat_xact_level (pgstat_info );
333
- pgstat_truncdrop_save_counters (pgstat_info -> trans , false);
333
+ save_truncdrop_counters (pgstat_info -> trans , false);
334
334
pgstat_info -> trans -> tuples_inserted = 0 ;
335
335
pgstat_info -> trans -> tuples_updated = 0 ;
336
336
pgstat_info -> trans -> tuples_deleted = 0 ;
@@ -348,7 +348,7 @@ pgstat_count_truncate(Relation rel)
348
348
void
349
349
pgstat_update_heap_dead_tuples (Relation rel , int delta )
350
350
{
351
- if (pgstat_relation_should_count (rel ))
351
+ if (pgstat_should_count_relation (rel ))
352
352
{
353
353
PgStat_TableStatus * pgstat_info = rel -> pgstat_info ;
354
354
@@ -405,7 +405,7 @@ AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
405
405
Assert (tabstat -> trans == trans );
406
406
/* restore pre-truncate/drop stats (if any) in case of aborted xact */
407
407
if (!isCommit )
408
- pgstat_truncdrop_restore_counters (trans );
408
+ restore_truncdrop_counters (trans );
409
409
/* count attempted actions regardless of commit/abort */
410
410
tabstat -> t_counts .t_tuples_inserted += trans -> tuples_inserted ;
411
411
tabstat -> t_counts .t_tuples_updated += trans -> tuples_updated ;
@@ -470,7 +470,7 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
470
470
if (trans -> truncdropped )
471
471
{
472
472
/* propagate the truncate/drop status one level up */
473
- pgstat_truncdrop_save_counters (trans -> upper , false);
473
+ save_truncdrop_counters (trans -> upper , false);
474
474
/* replace upper xact stats with ours */
475
475
trans -> upper -> tuples_inserted = trans -> tuples_inserted ;
476
476
trans -> upper -> tuples_updated = trans -> tuples_updated ;
@@ -497,7 +497,7 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
497
497
*/
498
498
PgStat_SubXactStatus * upper_xact_state ;
499
499
500
- upper_xact_state = pgstat_xact_stack_level_get (nestDepth - 1 );
500
+ upper_xact_state = pgstat_get_xact_stack_level (nestDepth - 1 );
501
501
trans -> next = upper_xact_state -> first ;
502
502
upper_xact_state -> first = trans ;
503
503
trans -> nest_level = nestDepth - 1 ;
@@ -511,7 +511,7 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
511
511
*/
512
512
513
513
/* first restore values obliterated by truncate/drop */
514
- pgstat_truncdrop_restore_counters (trans );
514
+ restore_truncdrop_counters (trans );
515
515
/* count attempted actions regardless of commit/abort */
516
516
tabstat -> t_counts .t_tuples_inserted += trans -> tuples_inserted ;
517
517
tabstat -> t_counts .t_tuples_updated += trans -> tuples_updated ;
@@ -860,7 +860,7 @@ add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
860
860
* If this is the first rel to be modified at the current nest level, we
861
861
* first have to push a transaction stack entry.
862
862
*/
863
- xact_state = pgstat_xact_stack_level_get (nest_level );
863
+ xact_state = pgstat_get_xact_stack_level (nest_level );
864
864
865
865
/* Now make a per-table stack entry */
866
866
trans = (PgStat_TableXactStatus * )
@@ -897,7 +897,7 @@ ensure_tabstat_xact_level(PgStat_TableStatus *pgstat_info)
897
897
* subxact level only.
898
898
*/
899
899
static void
900
- pgstat_truncdrop_save_counters (PgStat_TableXactStatus * trans , bool is_drop )
900
+ save_truncdrop_counters (PgStat_TableXactStatus * trans , bool is_drop )
901
901
{
902
902
if (!trans -> truncdropped || is_drop )
903
903
{
@@ -912,7 +912,7 @@ pgstat_truncdrop_save_counters(PgStat_TableXactStatus *trans, bool is_drop)
912
912
* restore counters when a truncate aborts
913
913
*/
914
914
static void
915
- pgstat_truncdrop_restore_counters (PgStat_TableXactStatus * trans )
915
+ restore_truncdrop_counters (PgStat_TableXactStatus * trans )
916
916
{
917
917
if (trans -> truncdropped )
918
918
{
0 commit comments