Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitbe902e2

Browse files
committed
pgstat: normalize function naming.
Most of pgstat uses pgstat_<verb>_<subject>() or just <verb>_<subject>(). Butnot all (some introduced fairly recently by me). Rename ones that aren'tintentionally following a different scheme (e.g. AtEOXact_*).
1 parent79b716c commitbe902e2

File tree

10 files changed

+56
-57
lines changed

10 files changed

+56
-57
lines changed

‎src/backend/access/common/relation.c

Lines changed: 2 additions & 2 deletions
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_relation_init(r);
76+
pgstat_init_relation(r);
7777

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

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

128128
returnr;
129129
}

‎src/backend/access/transam/slru.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ SimpleLruInit(SlruCtl ctl, const char *name, int nslots, int nlsns,
215215

216216
/* shared->latest_page_number will be set later */
217217

218-
shared->slru_stats_idx=pgstat_slru_index(name);
218+
shared->slru_stats_idx=pgstat_get_slru_index(name);
219219

220220
ptr= (char*)shared;
221221
offset=MAXALIGN(sizeof(SlruSharedData));

‎src/backend/postmaster/pgstat.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ pgstat_initialize(void)
727727
{
728728
Assert(!pgstat_is_initialized);
729729

730-
pgstat_wal_initialize();
730+
pgstat_init_wal();
731731

732732
/* Set up a process-exit hook to clean up */
733733
before_shmem_exit(pgstat_shutdown_hook,0);
@@ -768,7 +768,7 @@ pgstat_report_stat(bool disconnect)
768768
*/
769769
if (!have_relation_stats&&
770770
pgStatXactCommit==0&&pgStatXactRollback==0&&
771-
!pgstat_wal_pending()&&
771+
!pgstat_have_pending_wal()&&
772772
!have_function_stats&& !disconnect)
773773
return;
774774

‎src/backend/utils/activity/pgstat_relation.c

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
* for the life of the backend. Also, we zero out the t_id fields of the
3535
* contained PgStat_TableStatus structs whenever they are not actively in use.
3636
* This allows relcache pgstat_info pointers to be treated as long-lived data,
37-
* avoiding repeated searches inpgstat_relation_init() when a relation is
37+
* avoiding repeated searches inpgstat_init_relation() when a relation is
3838
* repeatedly opened during a transaction.
3939
*/
4040
#defineTABSTAT_QUANTUM100/* we alloc this many at a time */
@@ -78,8 +78,8 @@ static PgStat_TableStatus *get_tabstat_entry(Oid rel_id, bool isshared);
7878
staticvoidpgstat_send_tabstat(PgStat_MsgTabstat*tsmsg,TimestampTznow);
7979
staticvoidadd_tabstat_xact_level(PgStat_TableStatus*pgstat_info,intnest_level);
8080
staticvoidensure_tabstat_xact_level(PgStat_TableStatus*pgstat_info);
81-
staticvoidpgstat_truncdrop_save_counters(PgStat_TableXactStatus*trans,boolis_drop);
82-
staticvoidpgstat_truncdrop_restore_counters(PgStat_TableXactStatus*trans);
81+
staticvoidsave_truncdrop_counters(PgStat_TableXactStatus*trans,boolis_drop);
82+
staticvoidrestore_truncdrop_counters(PgStat_TableXactStatus*trans);
8383

8484

8585
/*
@@ -109,7 +109,7 @@ pgstat_copy_relation_stats(Relation dst, Relation src)
109109
if (!srcstats)
110110
return;
111111

112-
if (pgstat_relation_should_count(dst))
112+
if (pgstat_should_count_relation(dst))
113113
{
114114
/*
115115
* XXX: temporarily this does not actually quite do what the name
@@ -137,7 +137,7 @@ pgstat_copy_relation_stats(Relation dst, Relation src)
137137
* same relation is touched repeatedly within a transaction.
138138
*/
139139
void
140-
pgstat_relation_init(Relationrel)
140+
pgstat_init_relation(Relationrel)
141141
{
142142
Oidrel_id=rel->rd_id;
143143
charrelkind=rel->rd_rel->relkind;
@@ -242,7 +242,7 @@ pgstat_report_analyze(Relation rel,
242242
*
243243
* Waste no time on partitioned tables, though.
244244
*/
245-
if (pgstat_relation_should_count(rel)&&
245+
if (pgstat_should_count_relation(rel)&&
246246
rel->rd_rel->relkind!=RELKIND_PARTITIONED_TABLE)
247247
{
248248
PgStat_TableXactStatus*trans;
@@ -276,7 +276,7 @@ pgstat_report_analyze(Relation rel,
276276
void
277277
pgstat_count_heap_insert(Relationrel,PgStat_Countern)
278278
{
279-
if (pgstat_relation_should_count(rel))
279+
if (pgstat_should_count_relation(rel))
280280
{
281281
PgStat_TableStatus*pgstat_info=rel->pgstat_info;
282282

@@ -291,7 +291,7 @@ pgstat_count_heap_insert(Relation rel, PgStat_Counter n)
291291
void
292292
pgstat_count_heap_update(Relationrel,boolhot)
293293
{
294-
if (pgstat_relation_should_count(rel))
294+
if (pgstat_should_count_relation(rel))
295295
{
296296
PgStat_TableStatus*pgstat_info=rel->pgstat_info;
297297

@@ -310,7 +310,7 @@ pgstat_count_heap_update(Relation rel, bool hot)
310310
void
311311
pgstat_count_heap_delete(Relationrel)
312312
{
313-
if (pgstat_relation_should_count(rel))
313+
if (pgstat_should_count_relation(rel))
314314
{
315315
PgStat_TableStatus*pgstat_info=rel->pgstat_info;
316316

@@ -325,12 +325,12 @@ pgstat_count_heap_delete(Relation rel)
325325
void
326326
pgstat_count_truncate(Relationrel)
327327
{
328-
if (pgstat_relation_should_count(rel))
328+
if (pgstat_should_count_relation(rel))
329329
{
330330
PgStat_TableStatus*pgstat_info=rel->pgstat_info;
331331

332332
ensure_tabstat_xact_level(pgstat_info);
333-
pgstat_truncdrop_save_counters(pgstat_info->trans, false);
333+
save_truncdrop_counters(pgstat_info->trans, false);
334334
pgstat_info->trans->tuples_inserted=0;
335335
pgstat_info->trans->tuples_updated=0;
336336
pgstat_info->trans->tuples_deleted=0;
@@ -348,7 +348,7 @@ pgstat_count_truncate(Relation rel)
348348
void
349349
pgstat_update_heap_dead_tuples(Relationrel,intdelta)
350350
{
351-
if (pgstat_relation_should_count(rel))
351+
if (pgstat_should_count_relation(rel))
352352
{
353353
PgStat_TableStatus*pgstat_info=rel->pgstat_info;
354354

@@ -405,7 +405,7 @@ AtEOXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit)
405405
Assert(tabstat->trans==trans);
406406
/* restore pre-truncate/drop stats (if any) in case of aborted xact */
407407
if (!isCommit)
408-
pgstat_truncdrop_restore_counters(trans);
408+
restore_truncdrop_counters(trans);
409409
/* count attempted actions regardless of commit/abort */
410410
tabstat->t_counts.t_tuples_inserted+=trans->tuples_inserted;
411411
tabstat->t_counts.t_tuples_updated+=trans->tuples_updated;
@@ -470,7 +470,7 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
470470
if (trans->truncdropped)
471471
{
472472
/* propagate the truncate/drop status one level up */
473-
pgstat_truncdrop_save_counters(trans->upper, false);
473+
save_truncdrop_counters(trans->upper, false);
474474
/* replace upper xact stats with ours */
475475
trans->upper->tuples_inserted=trans->tuples_inserted;
476476
trans->upper->tuples_updated=trans->tuples_updated;
@@ -497,7 +497,7 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
497497
*/
498498
PgStat_SubXactStatus*upper_xact_state;
499499

500-
upper_xact_state=pgstat_xact_stack_level_get(nestDepth-1);
500+
upper_xact_state=pgstat_get_xact_stack_level(nestDepth-1);
501501
trans->next=upper_xact_state->first;
502502
upper_xact_state->first=trans;
503503
trans->nest_level=nestDepth-1;
@@ -511,7 +511,7 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
511511
*/
512512

513513
/* first restore values obliterated by truncate/drop */
514-
pgstat_truncdrop_restore_counters(trans);
514+
restore_truncdrop_counters(trans);
515515
/* count attempted actions regardless of commit/abort */
516516
tabstat->t_counts.t_tuples_inserted+=trans->tuples_inserted;
517517
tabstat->t_counts.t_tuples_updated+=trans->tuples_updated;
@@ -860,7 +860,7 @@ add_tabstat_xact_level(PgStat_TableStatus *pgstat_info, int nest_level)
860860
* If this is the first rel to be modified at the current nest level, we
861861
* first have to push a transaction stack entry.
862862
*/
863-
xact_state=pgstat_xact_stack_level_get(nest_level);
863+
xact_state=pgstat_get_xact_stack_level(nest_level);
864864

865865
/* Now make a per-table stack entry */
866866
trans= (PgStat_TableXactStatus*)
@@ -897,7 +897,7 @@ ensure_tabstat_xact_level(PgStat_TableStatus *pgstat_info)
897897
* subxact level only.
898898
*/
899899
staticvoid
900-
pgstat_truncdrop_save_counters(PgStat_TableXactStatus*trans,boolis_drop)
900+
save_truncdrop_counters(PgStat_TableXactStatus*trans,boolis_drop)
901901
{
902902
if (!trans->truncdropped||is_drop)
903903
{
@@ -912,7 +912,7 @@ pgstat_truncdrop_save_counters(PgStat_TableXactStatus *trans, bool is_drop)
912912
* restore counters when a truncate aborts
913913
*/
914914
staticvoid
915-
pgstat_truncdrop_restore_counters(PgStat_TableXactStatus*trans)
915+
restore_truncdrop_counters(PgStat_TableXactStatus*trans)
916916
{
917917
if (trans->truncdropped)
918918
{

‎src/backend/utils/activity/pgstat_slru.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include"utils/pgstat_internal.h"
2121

2222

23-
staticinlinePgStat_MsgSLRU*slru_entry(intslru_idx);
23+
staticinlinePgStat_MsgSLRU*get_slru_entry(intslru_idx);
2424

2525

2626
/*
@@ -49,7 +49,7 @@ pgstat_reset_slru(const char *name)
4949
return;
5050

5151
pgstat_setheader(&msg.m_hdr,PGSTAT_MTYPE_RESETSLRUCOUNTER);
52-
msg.m_index=pgstat_slru_index(name);
52+
msg.m_index=pgstat_get_slru_index(name);
5353

5454
pgstat_send(&msg,sizeof(msg));
5555
}
@@ -61,43 +61,43 @@ pgstat_reset_slru(const char *name)
6161
void
6262
pgstat_count_slru_page_zeroed(intslru_idx)
6363
{
64-
slru_entry(slru_idx)->m_blocks_zeroed+=1;
64+
get_slru_entry(slru_idx)->m_blocks_zeroed+=1;
6565
}
6666

6767
void
6868
pgstat_count_slru_page_hit(intslru_idx)
6969
{
70-
slru_entry(slru_idx)->m_blocks_hit+=1;
70+
get_slru_entry(slru_idx)->m_blocks_hit+=1;
7171
}
7272

7373
void
7474
pgstat_count_slru_page_exists(intslru_idx)
7575
{
76-
slru_entry(slru_idx)->m_blocks_exists+=1;
76+
get_slru_entry(slru_idx)->m_blocks_exists+=1;
7777
}
7878

7979
void
8080
pgstat_count_slru_page_read(intslru_idx)
8181
{
82-
slru_entry(slru_idx)->m_blocks_read+=1;
82+
get_slru_entry(slru_idx)->m_blocks_read+=1;
8383
}
8484

8585
void
8686
pgstat_count_slru_page_written(intslru_idx)
8787
{
88-
slru_entry(slru_idx)->m_blocks_written+=1;
88+
get_slru_entry(slru_idx)->m_blocks_written+=1;
8989
}
9090

9191
void
9292
pgstat_count_slru_flush(intslru_idx)
9393
{
94-
slru_entry(slru_idx)->m_flush+=1;
94+
get_slru_entry(slru_idx)->m_flush+=1;
9595
}
9696

9797
void
9898
pgstat_count_slru_truncate(intslru_idx)
9999
{
100-
slru_entry(slru_idx)->m_truncate+=1;
100+
get_slru_entry(slru_idx)->m_truncate+=1;
101101
}
102102

103103
/*
@@ -106,7 +106,7 @@ pgstat_count_slru_truncate(int slru_idx)
106106
* know the number of entries in advance.
107107
*/
108108
constchar*
109-
pgstat_slru_name(intslru_idx)
109+
pgstat_get_slru_name(intslru_idx)
110110
{
111111
if (slru_idx<0||slru_idx >=SLRU_NUM_ELEMENTS)
112112
returnNULL;
@@ -120,7 +120,7 @@ pgstat_slru_name(int slru_idx)
120120
* external projects.
121121
*/
122122
int
123-
pgstat_slru_index(constchar*name)
123+
pgstat_get_slru_index(constchar*name)
124124
{
125125
inti;
126126

@@ -174,7 +174,7 @@ pgstat_send_slru(void)
174174
* stored in SlruCtl as lwlock tranche name).
175175
*/
176176
staticinlinePgStat_MsgSLRU*
177-
slru_entry(intslru_idx)
177+
get_slru_entry(intslru_idx)
178178
{
179179
pgstat_assert_is_up();
180180

‎src/backend/utils/activity/pgstat_wal.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pgstat_report_wal(bool force)
130130
}
131131

132132
void
133-
pgstat_wal_initialize(void)
133+
pgstat_init_wal(void)
134134
{
135135
/*
136136
* Initialize prevWalUsage with pgWalUsage so that pgstat_report_wal() can
@@ -148,7 +148,7 @@ pgstat_wal_initialize(void)
148148
* data pages.
149149
*/
150150
bool
151-
pgstat_wal_pending(void)
151+
pgstat_have_pending_wal(void)
152152
{
153153
returnpgWalUsage.wal_records!=prevWalUsage.wal_records||
154154
WalStats.m_wal_write!=0||

‎src/backend/utils/activity/pgstat_xact.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ AtEOSubXact_PgStat_DroppedStats(PgStat_SubXactStatus *xact_state,
139139
if (xact_state->pending_drops_count==0)
140140
return;
141141

142-
parent_xact_state=pgstat_xact_stack_level_get(nestDepth-1);
142+
parent_xact_state=pgstat_get_xact_stack_level(nestDepth-1);
143143

144144
dlist_foreach_modify(iter,&xact_state->pending_drops)
145145
{
@@ -228,7 +228,7 @@ PostPrepare_PgStat(void)
228228
* it if needed.
229229
*/
230230
PgStat_SubXactStatus*
231-
pgstat_xact_stack_level_get(intnest_level)
231+
pgstat_get_xact_stack_level(intnest_level)
232232
{
233233
PgStat_SubXactStatus*xact_state;
234234

@@ -324,7 +324,7 @@ create_drop_transactional_internal(PgStat_Kind kind, Oid dboid, Oid objoid, bool
324324
PgStat_PendingDroppedStatsItem*drop= (PgStat_PendingDroppedStatsItem*)
325325
MemoryContextAlloc(TopTransactionContext,sizeof(PgStat_PendingDroppedStatsItem));
326326

327-
xact_state=pgstat_xact_stack_level_get(nest_level);
327+
xact_state=pgstat_get_xact_stack_level(nest_level);
328328

329329
drop->is_create=is_create;
330330
drop->item.kind=kind;

‎src/backend/utils/adt/pgstatfuncs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1830,7 +1830,7 @@ pg_stat_get_slru(PG_FUNCTION_ARGS)
18301830
PgStat_SLRUStatsstat;
18311831
constchar*name;
18321832

1833-
name=pgstat_slru_name(i);
1833+
name=pgstat_get_slru_name(i);
18341834

18351835
if (!name)
18361836
break;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp