diff options
| author | Tomas Vondra | 2024-04-19 13:47:48 +0000 |
|---|---|---|
| committer | Tomas Vondra | 2024-04-19 14:08:34 +0000 |
| commit | 41d2c6f952edc4841763d05296b65f3c0edad4f2 (patch) | |
| tree | b5f50488ec55160505bfed7ae64ea0abb74e17bd /src/test | |
| parent | 95d14b7ae26db5ed85d9945e29121bb0e9b59863 (diff) | |
Add missing index_insert_cleanup calls
The optimization for inserts into BRIN indexes added by c1ec02be1d79
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
Diffstat (limited to 'src/test')
| -rw-r--r-- | src/test/regress/expected/brin.out | 3 | ||||
| -rw-r--r-- | src/test/regress/sql/brin.sql | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/src/test/regress/expected/brin.out b/src/test/regress/expected/brin.out index 2662bb6ed43..d6779d8c7d2 100644 --- a/src/test/regress/expected/brin.out +++ b/src/test/regress/expected/brin.out @@ -575,6 +575,7 @@ DROP TABLE brintest_unlogged; -- test that the insert optimization works if no rows end up inserted CREATE TABLE brin_insert_optimization (a int); INSERT INTO brin_insert_optimization VALUES (1); -CREATE INDEX ON brin_insert_optimization USING brin (a); +CREATE INDEX brin_insert_optimization_idx ON brin_insert_optimization USING brin (a); UPDATE brin_insert_optimization SET a = a; +REINDEX INDEX CONCURRENTLY brin_insert_optimization_idx; DROP TABLE brin_insert_optimization; diff --git a/src/test/regress/sql/brin.sql b/src/test/regress/sql/brin.sql index 0d3beabb3d7..695cfad4bea 100644 --- a/src/test/regress/sql/brin.sql +++ b/src/test/regress/sql/brin.sql @@ -519,6 +519,7 @@ DROP TABLE brintest_unlogged; -- test that the insert optimization works if no rows end up inserted CREATE TABLE brin_insert_optimization (a int); INSERT INTO brin_insert_optimization VALUES (1); -CREATE INDEX ON brin_insert_optimization USING brin (a); +CREATE INDEX brin_insert_optimization_idx ON brin_insert_optimization USING brin (a); UPDATE brin_insert_optimization SET a = a; +REINDEX INDEX CONCURRENTLY brin_insert_optimization_idx; DROP TABLE brin_insert_optimization; |
