summaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorAmit Kapila2023-12-01 04:44:36 +0000
committerAmit Kapila2023-12-01 04:52:13 +0000
commitf66fcc5cd616da8d81a2d2f9b80a9f080796f4b6 (patch)
tree6a6b9dad90f38c9e1c979407b7dd44ac45c7e2f1 /src/test
parentaa11a9c14902b7bcb1d73533a0403dc50361112a (diff)
Fix an uninitialized access in hash_xlog_squeeze_page().
Commit 861f86beea changed hash_xlog_squeeze_page() to start reading the write buffer conditionally but forgot to initialize it leading to an uninitialized access. Reported-by: Alexander Lakhin Author: Hayato Kuroda Reviewed-by: Alexander Lakhin, Amit Kapila Discussion: http://postgr.es/m/62ed1a9f-746a-8e86-904b-51b9b806a1d9@gmail.com
Diffstat (limited to 'src/test')
-rw-r--r--src/test/regress/expected/hash_index.out14
-rw-r--r--src/test/regress/sql/hash_index.sql17
2 files changed, 31 insertions, 0 deletions
diff --git a/src/test/regress/expected/hash_index.out b/src/test/regress/expected/hash_index.out
index 0df348b5dd8..0d4bdb2adef 100644
--- a/src/test/regress/expected/hash_index.out
+++ b/src/test/regress/expected/hash_index.out
@@ -298,6 +298,20 @@ ROLLBACK;
INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i;
CHECKPOINT;
VACUUM hash_cleanup_heap;
+TRUNCATE hash_cleanup_heap;
+-- Insert tuples to both the primary bucket page and overflow pages.
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i;
+-- Fill overflow pages by "dead" tuples.
+BEGIN;
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1500) as i;
+ROLLBACK;
+-- And insert some tuples again. During squeeze operation, these will be moved
+-- to other overflow pages and also allow overflow pages filled by dead tuples
+-- to be freed. Note the main purpose of this test is to test the case where
+-- we don't need to move any tuple from the overflow page being freed.
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 50) as i;
+CHECKPOINT;
+VACUUM hash_cleanup_heap;
-- Clean up.
DROP TABLE hash_cleanup_heap;
-- Index on temp table.
diff --git a/src/test/regress/sql/hash_index.sql b/src/test/regress/sql/hash_index.sql
index 943bd0ecf17..219da829816 100644
--- a/src/test/regress/sql/hash_index.sql
+++ b/src/test/regress/sql/hash_index.sql
@@ -284,6 +284,23 @@ INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i;
CHECKPOINT;
VACUUM hash_cleanup_heap;
+TRUNCATE hash_cleanup_heap;
+
+-- Insert tuples to both the primary bucket page and overflow pages.
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 500) as i;
+-- Fill overflow pages by "dead" tuples.
+BEGIN;
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 1500) as i;
+ROLLBACK;
+-- And insert some tuples again. During squeeze operation, these will be moved
+-- to other overflow pages and also allow overflow pages filled by dead tuples
+-- to be freed. Note the main purpose of this test is to test the case where
+-- we don't need to move any tuple from the overflow page being freed.
+INSERT INTO hash_cleanup_heap SELECT 1 FROM generate_series(1, 50) as i;
+
+CHECKPOINT;
+VACUUM hash_cleanup_heap;
+
-- Clean up.
DROP TABLE hash_cleanup_heap;