Skip to content

Commit a3a75b9

Browse files
committed
pgstat: run pgindent on pgstat.c/h.
Upcoming commits will touch a lot of the pgstats code. Reindenting separately makes it easier to keep the code in a well-formatted shape each step. Author: Andres Freund <andres@anarazel.de> Discussion: https://postgr.es/m/20220303021600.hs34ghqcw6zcokdh@alap3.anarazel.de
1 parent 50b1e8c commit a3a75b9

File tree

3 files changed

+21
-14
lines changed

3 files changed

+21
-14
lines changed

src/backend/postmaster/pgstat.c

+16-12
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ typedef struct TwoPhasePgStatRecord
265265
PgStat_Counter deleted_pre_truncdrop;
266266
Oid t_id; /* table's OID */
267267
bool t_shared; /* is it a shared catalog? */
268-
bool t_truncdropped; /* was the relation truncated/dropped? */
268+
bool t_truncdropped; /* was the relation truncated/dropped? */
269269
} TwoPhasePgStatRecord;
270270

271271
/*
@@ -2622,11 +2622,11 @@ AtEOSubXact_PgStat_Relations(PgStat_SubXactStatus *xact_state, bool isCommit, in
26222622
{
26232623
/*
26242624
* When there isn't an immediate parent state, we can just
2625-
* reuse the record instead of going through a
2626-
* palloc/pfree pushup (this works since it's all in
2627-
* TopTransactionContext anyway). We have to re-link it
2628-
* into the parent level, though, and that might mean
2629-
* pushing a new entry into the pgStatXactStack.
2625+
* reuse the record instead of going through a palloc/pfree
2626+
* pushup (this works since it's all in TopTransactionContext
2627+
* anyway). We have to re-link it into the parent level,
2628+
* though, and that might mean pushing a new entry into the
2629+
* pgStatXactStack.
26302630
*/
26312631
PgStat_SubXactStatus *upper_xact_state;
26322632

@@ -3352,9 +3352,9 @@ pgstat_send_wal(bool force)
33523352
WalUsage walusage;
33533353

33543354
/*
3355-
* Calculate how much WAL usage counters were increased by
3356-
* subtracting the previous counters from the current ones. Fill the
3357-
* results in WAL stats message.
3355+
* Calculate how much WAL usage counters were increased by subtracting
3356+
* the previous counters from the current ones. Fill the results in
3357+
* WAL stats message.
33583358
*/
33593359
MemSet(&walusage, 0, sizeof(WalUsage));
33603360
WalUsageAccumDiff(&walusage, &pgWalUsage, &prevWalUsage);
@@ -4211,7 +4211,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
42114211
bool found;
42124212
const char *statfile = permanent ? PGSTAT_STAT_PERMANENT_FILENAME : pgstat_stat_filename;
42134213
int i;
4214-
TimestampTz ts;
4214+
TimestampTz ts;
42154215

42164216
/*
42174217
* The tables will live in pgStatLocalContext.
@@ -4473,7 +4473,7 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep)
44734473
PgStat_StatSubEntry *subentry;
44744474

44754475
if (fread(&subbuf, 1, sizeof(PgStat_StatSubEntry), fpin)
4476-
!= sizeof(PgStat_StatSubEntry))
4476+
!= sizeof(PgStat_StatSubEntry))
44774477
{
44784478
ereport(pgStatRunningInCollector ? LOG : WARNING,
44794479
(errmsg("corrupted statistics file \"%s\"",
@@ -5250,6 +5250,7 @@ pgstat_recv_tabstat(PgStat_MsgTabstat *msg, int len)
52505250
tabentry->tuples_updated += tabmsg->t_counts.t_tuples_updated;
52515251
tabentry->tuples_deleted += tabmsg->t_counts.t_tuples_deleted;
52525252
tabentry->tuples_hot_updated += tabmsg->t_counts.t_tuples_hot_updated;
5253+
52535254
/*
52545255
* If table was truncated/dropped, first reset the live/dead
52555256
* counters.
@@ -5412,7 +5413,10 @@ pgstat_recv_resetsharedcounter(PgStat_MsgResetsharedcounter *msg, int len)
54125413
{
54135414
if (msg->m_resettarget == RESET_BGWRITER)
54145415
{
5415-
/* Reset the global, bgwriter and checkpointer statistics for the cluster. */
5416+
/*
5417+
* Reset the global, bgwriter and checkpointer statistics for the
5418+
* cluster.
5419+
*/
54165420
memset(&globalStats, 0, sizeof(globalStats));
54175421
globalStats.bgwriter.stat_reset_timestamp = GetCurrentTimestamp();
54185422
}

src/include/pgstat.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -190,8 +190,8 @@ typedef struct PgStat_TableXactStatus
190190
PgStat_Counter tuples_inserted; /* tuples inserted in (sub)xact */
191191
PgStat_Counter tuples_updated; /* tuples updated in (sub)xact */
192192
PgStat_Counter tuples_deleted; /* tuples deleted in (sub)xact */
193-
bool truncdropped; /* relation truncated/dropped in this
194-
* (sub)xact */
193+
bool truncdropped; /* relation truncated/dropped in this
194+
* (sub)xact */
195195
/* tuples i/u/d prior to truncate/drop */
196196
PgStat_Counter inserted_pre_truncdrop;
197197
PgStat_Counter updated_pre_truncdrop;

src/tools/pgindent/typedefs.list

+3
Original file line numberDiff line numberDiff line change
@@ -1917,6 +1917,8 @@ PgFdwScanState
19171917
PgIfAddrCallback
19181918
PgStat_ArchiverStats
19191919
PgStat_BackendFunctionEntry
1920+
PgStat_BgWriterStats
1921+
PgStat_CheckpointerStats
19201922
PgStat_Counter
19211923
PgStat_FunctionCallUsage
19221924
PgStat_FunctionCounts
@@ -1928,6 +1930,7 @@ PgStat_MsgAnlAncestors
19281930
PgStat_MsgArchiver
19291931
PgStat_MsgAutovacStart
19301932
PgStat_MsgBgWriter
1933+
PgStat_MsgCheckpointer
19311934
PgStat_MsgChecksumFailure
19321935
PgStat_MsgConnect
19331936
PgStat_MsgDeadlock

0 commit comments

Comments
 (0)