From 892083abe4265c25764219eefd1d441dd697582b Mon Sep 17 00:00:00 2001 From: Aleksander Alekseev Date: Wed, 27 Jul 2022 15:51:07 +0300 Subject: [PATCH v3] Improve test coverage of gistbuild.c This patch ensures that gistInitBuffering() is called when tests are executed. Although this is arguably not an ideal test for gistInitBuffering(), this is better than doing nothing and hope for the best. Testing static procedures is generally a tricky task. At least we make sure that the procedure doesn't crash, doesn't throw errors and doesn't violate Asserts(). Author: Matheus Alcantara Reviewed-by: Aleksander Alekseev Discussion: https://postgr.es/m/3z8Fde-IHbW57a7bEZtaf19f4YOCWu67IZoWJoGW18rKD9R16ZHHchf4d7KFI3Yg7-0N4NonFuwKEgh98HjMCZYoVx7KOioPo6Wn2nZRpf4=@pm.me --- src/test/regress/expected/gist.out | 6 ++++++ src/test/regress/sql/gist.sql | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/test/regress/expected/gist.out b/src/test/regress/expected/gist.out index a36b4c9c56..b5edc44250 100644 --- a/src/test/regress/expected/gist.out +++ b/src/test/regress/expected/gist.out @@ -387,6 +387,12 @@ select p from gist_tbl order by circle(p,1) <-> point(0,0) limit 1; select p from gist_tbl order by circle(p,1) <-> point(0,0) limit 1; ERROR: lossy distance functions are not supported in index-only scans +-- Build an index using buffering caused by a index build that don't fit on cache. +set effective_cache_size = '1MB'; +create index gist_tbl_box_index_buffering on gist_tbl using gist (p, b, c); +reset effective_cache_size; +-- Force an index build using buffering. +create index gist_tbl_box_index_forcing_buffering on gist_tbl using gist (p) with (buffering=on); -- Clean up reset enable_seqscan; reset enable_bitmapscan; diff --git a/src/test/regress/sql/gist.sql b/src/test/regress/sql/gist.sql index 3360266370..214366c157 100644 --- a/src/test/regress/sql/gist.sql +++ b/src/test/regress/sql/gist.sql @@ -169,6 +169,15 @@ explain (verbose, costs off) select p from gist_tbl order by circle(p,1) <-> point(0,0) limit 1; select p from gist_tbl order by circle(p,1) <-> point(0,0) limit 1; + +-- Build an index using buffering caused by a index build that don't fit on cache. +set effective_cache_size = '1MB'; +create index gist_tbl_box_index_buffering on gist_tbl using gist (p, b, c); +reset effective_cache_size; + +-- Force an index build using buffering. +create index gist_tbl_box_index_forcing_buffering on gist_tbl using gist (p) with (buffering=on); + -- Clean up reset enable_seqscan; reset enable_bitmapscan; -- 2.37.1