diff --git a/src/backend/storage/buffer/bufmgr.c b/src/backend/storage/buffer/bufmgr.c index 3fb38a25cfa..8075828e8a6 100644 --- 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 b2720df6eaa..8372acc383d 100644 --- 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 7e9dc17e68b..0fa5370bcd2 100644 --- 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 1730425de1e..2e20b93c202 100644 --- 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 6cddd74aa76..58bd1360b97 100644 --- 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 d3e965d744f..5e3326a3b91 100644 --- 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 08412d64048..12fd51f1ae3 100644 --- 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 */