mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Add missing index_insert_cleanup calls
The optimization for inserts into BRIN indexes added by c1ec02be1d
relies on a cache that needs to be explicitly released after calling
index_insert(). The commit however failed to invoke the cleanup in
validate_index(), which calls index_insert() indirectly through
table_index_validate_scan().
After inspecting index_insert() callers, it seems unique_key_recheck()
is missing the call too.
Fixed by adding the two missing index_insert_cleanup() calls.
The commit does two additional improvements. The aminsertcleanup()
signature is modified to have the index as the first argument, to make
it more like the other AM callbacks. And the aminsertcleanup() callback
is invoked even if the ii_AmCache is NULL, so that it can decide if the
cleanup is necessary.
Author: Alvaro Herrera, Tomas Vondra
Reported-by: Alexander Lakhin
Discussion: https://postgr.es/m/202401091043.e3nrqiad6gb7@alvherre.pgsql
This commit is contained in:
@ -114,7 +114,8 @@ typedef bool (*aminsert_function) (Relation indexRelation,
|
||||
struct IndexInfo *indexInfo);
|
||||
|
||||
/* cleanup after insert */
|
||||
typedef void (*aminsertcleanup_function) (struct IndexInfo *indexInfo);
|
||||
typedef void (*aminsertcleanup_function) (Relation indexRelation,
|
||||
struct IndexInfo *indexInfo);
|
||||
|
||||
/* bulk delete */
|
||||
typedef IndexBulkDeleteResult *(*ambulkdelete_function) (IndexVacuumInfo *info,
|
||||
|
@ -96,7 +96,7 @@ extern bool brininsert(Relation idxRel, Datum *values, bool *nulls,
|
||||
IndexUniqueCheck checkUnique,
|
||||
bool indexUnchanged,
|
||||
struct IndexInfo *indexInfo);
|
||||
extern void brininsertcleanup(struct IndexInfo *indexInfo);
|
||||
extern void brininsertcleanup(Relation index, struct IndexInfo *indexInfo);
|
||||
extern IndexScanDesc brinbeginscan(Relation r, int nkeys, int norderbys);
|
||||
extern int64 bringetbitmap(IndexScanDesc scan, TIDBitmap *tbm);
|
||||
extern void brinrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
|
||||
|
Reference in New Issue
Block a user