diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-14 19:16:24 +0000 |
commit | 2a0f262beff32ba86bcb58f3273214e5d0517c09 (patch) | |
tree | 24c0ad10dab36bbd5c22743d3c88c4e0ccd5bc65 /src/backend/access | |
parent | Releasing progress-linux version 16.2-2~progress7.99u1. (diff) | |
download | postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.tar.xz postgresql-16-2a0f262beff32ba86bcb58f3273214e5d0517c09.zip |
Merging upstream version 16.3.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/backend/access')
-rw-r--r-- | src/backend/access/brin/brin_bloom.c | 5 | ||||
-rw-r--r-- | src/backend/access/brin/brin_minmax_multi.c | 2 | ||||
-rw-r--r-- | src/backend/access/heap/vacuumlazy.c | 28 | ||||
-rw-r--r-- | src/backend/access/index/genam.c | 6 | ||||
-rw-r--r-- | src/backend/access/index/indexam.c | 17 |
5 files changed, 31 insertions, 27 deletions
diff --git a/src/backend/access/brin/brin_bloom.c b/src/backend/access/brin/brin_bloom.c index 1ed0d8a..7acc6ea 100644 --- a/src/backend/access/brin/brin_bloom.c +++ b/src/backend/access/brin/brin_bloom.c @@ -660,6 +660,9 @@ brin_bloom_union(PG_FUNCTION_ARGS) for (i = 0; i < nbytes; i++) filter_a->data[i] |= filter_b->data[i]; + /* update the number of bits set in the filter */ + filter_a->nbits_set = pg_popcount((const char *) filter_a->data, nbytes); + PG_RETURN_VOID(); } @@ -766,7 +769,7 @@ brin_bloom_summary_out(PG_FUNCTION_ARGS) StringInfoData str; /* detoast the data to get value with a full 4B header */ - filter = (BloomFilter *) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(0)); + filter = (BloomFilter *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); initStringInfo(&str); appendStringInfoChar(&str, '{'); diff --git a/src/backend/access/brin/brin_minmax_multi.c b/src/backend/access/brin/brin_minmax_multi.c index c045691..3664a03 100644 --- a/src/backend/access/brin/brin_minmax_multi.c +++ b/src/backend/access/brin/brin_minmax_multi.c @@ -3015,7 +3015,7 @@ brin_minmax_multi_summary_out(PG_FUNCTION_ARGS) * Detoast to get value with full 4B header (can't be stored in a toast * table, but can use 1B header). */ - ranges = (SerializedRanges *) PG_DETOAST_DATUM_PACKED(PG_GETARG_DATUM(0)); + ranges = (SerializedRanges *) PG_DETOAST_DATUM(PG_GETARG_DATUM(0)); /* lookup output func for the type */ getTypeOutputInfo(ranges->typid, &outfunc, &isvarlena); diff --git a/src/backend/access/heap/vacuumlazy.c b/src/backend/access/heap/vacuumlazy.c index 4eb953f..c474b06 100644 --- a/src/backend/access/heap/vacuumlazy.c +++ b/src/backend/access/heap/vacuumlazy.c @@ -317,9 +317,7 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, PgStat_Counter startreadtime = 0, startwritetime = 0; WalUsage startwalusage = pgWalUsage; - int64 StartPageHit = VacuumPageHit, - StartPageMiss = VacuumPageMiss, - StartPageDirty = VacuumPageDirty; + BufferUsage startbufferusage = pgBufferUsage; ErrorContextCallback errcallback; char **indnames = NULL; @@ -611,18 +609,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, long secs_dur; int usecs_dur; WalUsage walusage; + BufferUsage bufferusage; StringInfoData buf; char *msgfmt; int32 diff; - int64 PageHitOp = VacuumPageHit - StartPageHit, - PageMissOp = VacuumPageMiss - StartPageMiss, - PageDirtyOp = VacuumPageDirty - StartPageDirty; double read_rate = 0, write_rate = 0; TimestampDifference(starttime, endtime, &secs_dur, &usecs_dur); memset(&walusage, 0, sizeof(WalUsage)); WalUsageAccumDiff(&walusage, &pgWalUsage, &startwalusage); + memset(&bufferusage, 0, sizeof(BufferUsage)); + BufferUsageAccumDiff(&bufferusage, &pgBufferUsage, &startbufferusage); initStringInfo(&buf); if (verbose) @@ -749,18 +747,18 @@ heap_vacuum_rel(Relation rel, VacuumParams *params, } if (secs_dur > 0 || usecs_dur > 0) { - read_rate = (double) BLCKSZ * PageMissOp / (1024 * 1024) / - (secs_dur + usecs_dur / 1000000.0); - write_rate = (double) BLCKSZ * PageDirtyOp / (1024 * 1024) / - (secs_dur + usecs_dur / 1000000.0); + read_rate = (double) BLCKSZ * (bufferusage.shared_blks_read + bufferusage.local_blks_read) / + (1024 * 1024) / (secs_dur + usecs_dur / 1000000.0); + write_rate = (double) BLCKSZ * (bufferusage.shared_blks_dirtied + bufferusage.local_blks_dirtied) / + (1024 * 1024) / (secs_dur + usecs_dur / 1000000.0); } appendStringInfo(&buf, _("avg read rate: %.3f MB/s, avg write rate: %.3f MB/s\n"), read_rate, write_rate); appendStringInfo(&buf, _("buffer usage: %lld hits, %lld misses, %lld dirtied\n"), - (long long) PageHitOp, - (long long) PageMissOp, - (long long) PageDirtyOp); + (long long) (bufferusage.shared_blks_hit + bufferusage.local_blks_hit), + (long long) (bufferusage.shared_blks_read + bufferusage.local_blks_read), + (long long) (bufferusage.shared_blks_dirtied + bufferusage.local_blks_dirtied)); appendStringInfo(&buf, _("WAL usage: %lld records, %lld full page images, %llu bytes\n"), (long long) walusage.wal_records, @@ -1330,11 +1328,7 @@ lazy_scan_skip(LVRelState *vacrel, Buffer *vmbuffer, BlockNumber next_block, /* DISABLE_PAGE_SKIPPING makes all skipping unsafe */ if (!vacrel->skipwithvm) - { - /* Caller shouldn't rely on all_visible_according_to_vm */ - *next_unskippable_allvis = false; break; - } /* * Aggressive VACUUM caller can't skip pages just because they are diff --git a/src/backend/access/index/genam.c b/src/backend/access/index/genam.c index 722927a..709b264 100644 --- a/src/backend/access/index/genam.c +++ b/src/backend/access/index/genam.c @@ -653,8 +653,10 @@ systable_beginscan_ordered(Relation heapRelation, /* REINDEX can probably be a hard error here ... */ if (ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) - elog(ERROR, "cannot do ordered scan on index \"%s\", because it is being reindexed", - RelationGetRelationName(indexRelation)); + ereport(ERROR, + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), + errmsg("cannot access index \"%s\" while it is being reindexed", + RelationGetRelationName(indexRelation)))); /* ... but we only throw a warning about violating IgnoreSystemIndexes */ if (IgnoreSystemIndexes) elog(WARNING, "using index \"%s\" despite IgnoreSystemIndexes", diff --git a/src/backend/access/index/indexam.c b/src/backend/access/index/indexam.c index 7735ed7..715e91e 100644 --- a/src/backend/access/index/indexam.c +++ b/src/backend/access/index/indexam.c @@ -70,18 +70,23 @@ * Note: the ReindexIsProcessingIndex() check in RELATION_CHECKS is there * to check that we don't try to scan or do retail insertions into an index * that is currently being rebuilt or pending rebuild. This helps to catch - * things that don't work when reindexing system catalogs. The assertion + * things that don't work when reindexing system catalogs, as well as prevent + * user errors like index expressions that access their own tables. The check * doesn't prevent the actual rebuild because we don't use RELATION_CHECKS * when calling the index AM's ambuild routine, and there is no reason for * ambuild to call its subsidiary routines through this file. * ---------------------------------------------------------------- */ #define RELATION_CHECKS \ -( \ - AssertMacro(RelationIsValid(indexRelation)), \ - AssertMacro(PointerIsValid(indexRelation->rd_indam)), \ - AssertMacro(!ReindexIsProcessingIndex(RelationGetRelid(indexRelation))) \ -) +do { \ + Assert(RelationIsValid(indexRelation)); \ + Assert(PointerIsValid(indexRelation->rd_indam)); \ + if (unlikely(ReindexIsProcessingIndex(RelationGetRelid(indexRelation)))) \ + ereport(ERROR, \ + (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), \ + errmsg("cannot access index \"%s\" while it is being reindexed", \ + RelationGetRelationName(indexRelation)))); \ +} while(0) #define SCAN_CHECKS \ ( \ |