diff options
| author | Tomas Vondra | 2022-06-16 13:02:48 +0000 |
|---|---|---|
| committer | Tomas Vondra | 2022-06-16 13:02:49 +0000 |
| commit | e3fcca0d0d2414f3a50d6fd40eddf48b7df81475 (patch) | |
| tree | 6c1793031fd174af93149a23450e3e3b5299bdb4 /src/include | |
| parent | 664da2a389e5d1d4ebf0f98c82997739cd496e8e (diff) | |
Revert changes in HOT handling of BRIN indexes
This reverts commits 5753d4ee32 and fe60b67250 that modified HOT to
ignore BRIN indexes. The commit message for 5753d4ee32 claims that:
When determining whether an index update may be skipped by using
HOT, we can ignore attributes indexed only by BRIN indexes. There
are no index pointers to individual tuples in BRIN, and the page
range summary will be updated anyway as it relies on visibility
info.
This is partially incorrect - it's true BRIN indexes don't point to
individual tuples, so HOT chains are not an issue, but the visibitlity
info is not sufficient to keep the index up to date. This can easily
result in corrupted indexes, as demonstrated in the hackers thread.
This does not mean relaxing the HOT restrictions for BRIN is a lost
cause, but it needs to handle the two aspects (allowing HOT chains and
updating the page range summaries) as separate. But that requires a
major changes, and it's too late for that in the current dev cycle.
Reported-by: Tomas Vondra
Discussion: https://postgr.es/m/05ebcb44-f383-86e3-4f31-0a97a55634cf@enterprisedb.com
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/access/amapi.h | 2 | ||||
| -rw-r--r-- | src/include/utils/rel.h | 3 | ||||
| -rw-r--r-- | src/include/utils/relcache.h | 4 |
3 files changed, 3 insertions, 6 deletions
diff --git a/src/include/access/amapi.h b/src/include/access/amapi.h index 0b89f399f0..1dc674d230 100644 --- a/src/include/access/amapi.h +++ b/src/include/access/amapi.h @@ -244,8 +244,6 @@ typedef struct IndexAmRoutine bool amcaninclude; /* does AM use maintenance_work_mem? */ bool amusemaintenanceworkmem; - /* does AM block HOT update? */ - bool amhotblocking; /* OR of parallel vacuum flags. See vacuum.h for flags. */ uint8 amparallelvacuumoptions; /* type of data stored in index, or InvalidOid if variable */ diff --git a/src/include/utils/rel.h b/src/include/utils/rel.h index 90b3c49bc1..1896a9a06d 100644 --- a/src/include/utils/rel.h +++ b/src/include/utils/rel.h @@ -155,11 +155,10 @@ typedef struct RelationData List *rd_statlist; /* list of OIDs of extended stats */ /* data managed by RelationGetIndexAttrBitmap: */ - bool rd_attrsvalid; /* are bitmaps of attrs valid? */ + Bitmapset *rd_indexattr; /* identifies columns used in indexes */ Bitmapset *rd_keyattr; /* cols that can be ref'd by foreign keys */ Bitmapset *rd_pkattr; /* cols included in primary key */ Bitmapset *rd_idattr; /* included in replica identity index */ - Bitmapset *rd_hotblockingattr; /* cols blocking HOT update */ PublicationDesc *rd_pubdesc; /* publication descriptor, or NULL */ diff --git a/src/include/utils/relcache.h b/src/include/utils/relcache.h index 86dddbd975..c93d8654bb 100644 --- a/src/include/utils/relcache.h +++ b/src/include/utils/relcache.h @@ -55,10 +55,10 @@ extern bytea **RelationGetIndexAttOptions(Relation relation, bool copy); typedef enum IndexAttrBitmapKind { + INDEX_ATTR_BITMAP_ALL, INDEX_ATTR_BITMAP_KEY, INDEX_ATTR_BITMAP_PRIMARY_KEY, - INDEX_ATTR_BITMAP_IDENTITY_KEY, - INDEX_ATTR_BITMAP_HOT_BLOCKING + INDEX_ATTR_BITMAP_IDENTITY_KEY } IndexAttrBitmapKind; extern Bitmapset *RelationGetIndexAttrBitmap(Relation relation, |
