Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc79aed4

Browse files
Restore lost amcheck TOAST test coverage.
Commiteba7753 fixed an amcheck false positive bug involvinginconsistencies in TOAST input state between table and index. A testcase was added that verified that such an inconsistency didn't result ina spurious corruption related error.Test coverage from the test was accidentally lost by commit501e41d,which propagated ALTER TABLE ... SET STORAGE attstorage state toindexes. This broke the test because the test specifically relied onattstorage not being propagated. This artificially forced there to beindex tuples whose datums were equivalent to the datums in the heapwithout the datums actually being bitwise equal.Fix this by updating pg_attribute directly instead. Commit501e41dmade similar changes to a test_decoding TOAST-related test case whichmade the same assumption, but overlooked the amcheck test case.Backpatch: 11-, just like commiteba7753 (and commit501e41d).
1 parent3d2376d commitc79aed4

File tree

2 files changed

+22
-8
lines changed

2 files changed

+22
-8
lines changed

‎contrib/amcheck/expected/check_btree.out

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,19 @@ SELECT bt_index_parent_check('delete_test_table_pkey', true);
155155
-- tuple. Bloom filter must fingerprint normalized index tuple representation.
156156
--
157157
CREATE TABLE toast_bug(buggy text);
158-
ALTER TABLE toast_bug ALTER COLUMN buggy SET STORAGE plain;
159-
-- pg_attribute entry for toasty.buggy will have plain storage:
160-
CREATE INDEX toasty ON toast_bug(buggy);
161-
-- Whereas pg_attribute entry for toast_bug.buggy now has extended storage:
162158
ALTER TABLE toast_bug ALTER COLUMN buggy SET STORAGE extended;
159+
CREATE INDEX toasty ON toast_bug(buggy);
160+
-- pg_attribute entry for toasty.buggy (the index) will have plain storage:
161+
UPDATE pg_attribute SET attstorage = 'p'
162+
WHERE attrelid = 'toasty'::regclass AND attname = 'buggy';
163+
-- Whereas pg_attribute entry for toast_bug.buggy (the table) still has extended storage:
164+
SELECT attstorage FROM pg_attribute
165+
WHERE attrelid = 'toast_bug'::regclass AND attname = 'buggy';
166+
attstorage
167+
------------
168+
x
169+
(1 row)
170+
163171
-- Insert compressible heap tuple (comfortably exceeds TOAST_TUPLE_THRESHOLD):
164172
INSERT INTO toast_bug SELECT repeat('a', 2200);
165173
-- Should not get false positive report of corruption:

‎contrib/amcheck/sql/check_btree.sql

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,11 +99,17 @@ SELECT bt_index_parent_check('delete_test_table_pkey', true);
9999
-- tuple. Bloom filter must fingerprint normalized index tuple representation.
100100
--
101101
CREATETABLEtoast_bug(buggytext);
102-
ALTERTABLE toast_bug ALTER COLUMN buggySET STORAGE plain;
103-
-- pg_attribute entry for toasty.buggy will have plain storage:
104-
CREATEINDEXtoastyON toast_bug(buggy);
105-
-- Whereas pg_attribute entry for toast_bug.buggy now has extended storage:
106102
ALTERTABLE toast_bug ALTER COLUMN buggySET STORAGE extended;
103+
CREATEINDEXtoastyON toast_bug(buggy);
104+
105+
-- pg_attribute entry for toasty.buggy (the index) will have plain storage:
106+
UPDATE pg_attributeSET attstorage='p'
107+
WHERE attrelid='toasty'::regclassAND attname='buggy';
108+
109+
-- Whereas pg_attribute entry for toast_bug.buggy (the table) still has extended storage:
110+
SELECT attstorageFROM pg_attribute
111+
WHERE attrelid='toast_bug'::regclassAND attname='buggy';
112+
107113
-- Insert compressible heap tuple (comfortably exceeds TOAST_TUPLE_THRESHOLD):
108114
INSERT INTO toast_bugSELECT repeat('a',2200);
109115
-- Should not get false positive report of corruption:

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp