git.postgresql.org Git - postgresql.git/commitdiff

git projects / postgresql.git / commitdiff
? search:
summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d46a979)
Manual cleanup and pgindent of pgstat and bufmgr related code
2023年1月13日 23:23:09 +0000 (15:23 -0800)
2023年1月13日 23:23:17 +0000 (15:23 -0800)
This is in preparation for commiting a larger patch series in the area.

Discussion: https://postgr.es/m/CAAKRu_bHwGEbzNxxy+MQDkrsgog6aO6iUvajJ4d6PD98gFU7+w@mail.gmail.com


diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c
index 3fb38a25cfa9181bdbd1b0a1c2d7ad7e40e9feee..8075828e8a68d0a45053c94a459152ae977a96f0 100644 (file)
--- a/src/backend/storage/buffer/bufmgr.c
+++ b/src/backend/storage/buffer/bufmgr.c
@@ -516,7 +516,7 @@ PrefetchSharedBuffer(SMgrRelation smgr_reln,
/* create a tag so we can lookup the buffer */
InitBufferTag(&newTag, &smgr_reln->smgr_rlocator.locator,
- forkNum, blockNum);
+ forkNum, blockNum);
/* determine its hash code and partition lock ID */
newHash = BufTableHashCode(&newTag);
@@ -3297,8 +3297,8 @@ DropRelationsAllBuffers(SMgrRelation *smgr_reln, int nlocators)
uint32 buf_state;
/*
- * As in DropRelationBuffers, an unlocked precheck should be
- * safe and saves some cycles.
+ * As in DropRelationBuffers, an unlocked precheck should be safe and
+ * saves some cycles.
*/
if (!use_bsearch)
@@ -3425,8 +3425,8 @@ DropDatabaseBuffers(Oid dbid)
uint32 buf_state;
/*
- * As in DropRelationBuffers, an unlocked precheck should be
- * safe and saves some cycles.
+ * As in DropRelationBuffers, an unlocked precheck should be safe and
+ * saves some cycles.
*/
if (bufHdr->tag.dbOid != dbid)
continue;
@@ -3572,8 +3572,8 @@ FlushRelationBuffers(Relation rel)
bufHdr = GetBufferDescriptor(i);
/*
- * As in DropRelationBuffers, an unlocked precheck should be
- * safe and saves some cycles.
+ * As in DropRelationBuffers, an unlocked precheck should be safe and
+ * saves some cycles.
*/
if (!BufTagMatchesRelFileLocator(&bufHdr->tag, &rel->rd_locator))
continue;
@@ -3645,8 +3645,8 @@ FlushRelationsAllBuffers(SMgrRelation *smgrs, int nrels)
uint32 buf_state;
/*
- * As in DropRelationBuffers, an unlocked precheck should be
- * safe and saves some cycles.
+ * As in DropRelationBuffers, an unlocked precheck should be safe and
+ * saves some cycles.
*/
if (!use_bsearch)
@@ -3880,8 +3880,8 @@ FlushDatabaseBuffers(Oid dbid)
bufHdr = GetBufferDescriptor(i);
/*
- * As in DropRelationBuffers, an unlocked precheck should be
- * safe and saves some cycles.
+ * As in DropRelationBuffers, an unlocked precheck should be safe and
+ * saves some cycles.
*/
if (bufHdr->tag.dbOid != dbid)
continue;
diff --git a/src/backend/storage/buffer/localbuf.c b/src/backend/storage/buffer/localbuf.c
index b2720df6eaaae23ed2aad7e58a24e2f93b394add..8372acc383d75496251e946e91e8b7298a5dfb93 100644 (file)
--- a/src/backend/storage/buffer/localbuf.c
+++ b/src/backend/storage/buffer/localbuf.c
@@ -610,8 +610,8 @@ AtProcExit_LocalBuffers(void)
{
/*
* We shouldn't be holding any remaining pins; if we are, and assertions
- * aren't enabled, we'll fail later in DropRelationBuffers while
- * trying to drop the temp rels.
+ * aren't enabled, we'll fail later in DropRelationBuffers while trying to
+ * drop the temp rels.
*/
CheckForLocalBufferLeaks();
}
diff --git a/src/backend/utils/activity/pgstat.c b/src/backend/utils/activity/pgstat.c
index 7e9dc17e68bf2ecb3da300ff1a8889f821607b49..0fa5370bcd267908f1b5c63d930314f479186ab4 100644 (file)
--- a/src/backend/utils/activity/pgstat.c
+++ b/src/backend/utils/activity/pgstat.c
@@ -426,7 +426,7 @@ pgstat_discard_stats(void)
ereport(DEBUG2,
(errcode_for_file_access(),
errmsg_internal("unlinked permanent statistics file \"%s\"",
- PGSTAT_STAT_PERMANENT_FILENAME)));
+ PGSTAT_STAT_PERMANENT_FILENAME)));
}
/*
@@ -986,6 +986,7 @@ pgstat_build_snapshot(void)
entry->data = MemoryContextAlloc(pgStatLocal.snapshot.context,
kind_info->shared_size);
+
/*
* Acquire the LWLock directly instead of using
* pg_stat_lock_entry_shared() which requires a reference.
diff --git a/src/backend/utils/activity/pgstat_relation.c b/src/backend/utils/activity/pgstat_relation.c
index 1730425de1ef0384ceed932e58d03c9b23e07e04..2e20b93c2024b189932bd4a37ef6ea46e99fc889 100644 (file)
--- a/src/backend/utils/activity/pgstat_relation.c
+++ b/src/backend/utils/activity/pgstat_relation.c
@@ -783,6 +783,7 @@ pgstat_relation_flush_cb(PgStat_EntryRef *entry_ref, bool nowait)
if (lstats->t_counts.t_numscans)
{
TimestampTz t = GetCurrentTransactionStopTimestamp();
+
if (t > tabentry->lastscan)
tabentry->lastscan = t;
}
diff --git a/src/backend/utils/adt/pgstatfuncs.c b/src/backend/utils/adt/pgstatfuncs.c
index 6cddd74aa7649fcc316bad28cb63e5648fa82bfe..58bd1360b976e2dd4a3f26404895b633c3398448 100644 (file)
--- a/src/backend/utils/adt/pgstatfuncs.c
+++ b/src/backend/utils/adt/pgstatfuncs.c
@@ -906,7 +906,7 @@ pg_stat_get_backend_client_addr(PG_FUNCTION_ARGS)
clean_ipv6_addr(beentry->st_clientaddr.addr.ss_family, remote_host);
PG_RETURN_DATUM(DirectFunctionCall1(inet_in,
- CStringGetDatum(remote_host)));
+ CStringGetDatum(remote_host)));
}
Datum
diff --git a/src/include/pgstat.h b/src/include/pgstat.h
index d3e965d744f4b41243ccde53b3a8afaed7223338..5e3326a3b91adc61158a61c4ac978b12ac5065e7 100644 (file)
--- a/src/include/pgstat.h
+++ b/src/include/pgstat.h
@@ -476,6 +476,7 @@ extern void pgstat_report_connect(Oid dboid);
extern PgStat_StatDBEntry *pgstat_fetch_stat_dbentry(Oid dboid);
+
/*
* Functions in pgstat_function.c
*/
diff --git a/src/include/utils/pgstat_internal.h b/src/include/utils/pgstat_internal.h
index 08412d640487ecaf53ba951c79c664af42af3032..12fd51f1ae32c008bcbfe2905bc3d4289f63f6a8 100644 (file)
--- a/src/include/utils/pgstat_internal.h
+++ b/src/include/utils/pgstat_internal.h
@@ -626,6 +626,7 @@ extern void pgstat_wal_snapshot_cb(void);
extern bool pgstat_subscription_flush_cb(PgStat_EntryRef *entry_ref, bool nowait);
extern void pgstat_subscription_reset_timestamp_cb(PgStatShared_Common *header, TimestampTz ts);
+
/*
* Functions in pgstat_xact.c
*/
This is the main PostgreSQL git repository.
RSS Atom

AltStyle によって変換されたページ (->オリジナル) /