Skip to content

Commit 52b164c

Browse files
Add LP_DEAD deletion of a posting list tuple test.
Make sure that we have test coverage of the posting list tuple path within _bt_xid_horizon(). Per off-list complaint from Andres Freund.
1 parent 6baa17f commit 52b164c

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

src/test/regress/expected/btree_index.out

+10-3
Original file line numberDiff line numberDiff line change
@@ -284,14 +284,21 @@ BEGIN
284284
INSERT INTO dedup_unique_test_table SELECT 1;
285285
END LOOP;
286286
END$$;
287+
-- Exercise the LP_DEAD-bit-set tuple deletion code with a posting list tuple.
288+
-- The implementation prefers deleting existing items to merging any duplicate
289+
-- tuples into a posting list, so we need an explicit test to make sure we get
290+
-- coverage (note that this test also assumes BLCKSZ is 8192 or less):
291+
DROP INDEX plain_unique;
292+
DELETE FROM dedup_unique_test_table WHERE a = 1;
293+
INSERT INTO dedup_unique_test_table SELECT i FROM generate_series(0,450) i;
287294
--
288295
-- Test B-tree fast path (cache rightmost leaf page) optimization.
289296
--
290297
-- First create a tree that's at least three levels deep (i.e. has one level
291298
-- between the root and leaf levels). The text inserted is long. It won't be
292-
-- compressed because we use plain storage in the table. Only a few index
293-
-- tuples fit on each internal page, allowing us to get a tall tree with few
294-
-- pages. (A tall tree is required to trigger caching.)
299+
-- TOAST compressed because we use plain storage in the table. Only a few
300+
-- index tuples fit on each internal page, allowing us to get a tall tree with
301+
-- few pages. (A tall tree is required to trigger caching.)
295302
--
296303
-- The text column must be the leading column in the index, since suffix
297304
-- truncation would otherwise truncate tuples on internal pages, leaving us

src/test/regress/sql/btree_index.sql

+11-3
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,23 @@ BEGIN
123123
END LOOP;
124124
END$$;
125125

126+
-- Exercise the LP_DEAD-bit-set tuple deletion code with a posting list tuple.
127+
-- The implementation prefers deleting existing items to merging any duplicate
128+
-- tuples into a posting list, so we need an explicit test to make sure we get
129+
-- coverage (note that this test also assumes BLCKSZ is 8192 or less):
130+
DROP INDEX plain_unique;
131+
DELETE FROM dedup_unique_test_table WHERE a = 1;
132+
INSERT INTO dedup_unique_test_table SELECT i FROM generate_series(0,450) i;
133+
126134
--
127135
-- Test B-tree fast path (cache rightmost leaf page) optimization.
128136
--
129137

130138
-- First create a tree that's at least three levels deep (i.e. has one level
131139
-- between the root and leaf levels). The text inserted is long. It won't be
132-
-- compressed because we use plain storage in the table. Only a few index
133-
-- tuples fit on each internal page, allowing us to get a tall tree with few
134-
-- pages. (A tall tree is required to trigger caching.)
140+
-- TOAST compressed because we use plain storage in the table. Only a few
141+
-- index tuples fit on each internal page, allowing us to get a tall tree with
142+
-- few pages. (A tall tree is required to trigger caching.)
135143
--
136144
-- The text column must be the leading column in the index, since suffix
137145
-- truncation would otherwise truncate tuples on internal pages, leaving us

0 commit comments

Comments
 (0)