mirror of
https://github.com/postgres/postgres.git
synced 2025-07-27 12:41:57 +03:00
Fix issues with wide tuples being updated and REPLICA IDENTITY FULL.
When replica identity full is being used with a wide tuple (above 2^16 bytes after compression) it lead to errors and/or crashes during decoding because the length field used to store such tuples doesn't fit into the variable used to store the width in the WAL record. To fix, discontinue use of xl_heap_header_len.t_len when decoding the old tuple version, instead compute length of the old tuple by subtracting the new tuple's length from the record length. In newer version of postgres this issue is moot because the length is stored by the new WAL machinery, instead of a xl_heap_header_len struct. A separate commit will forward-patch the regression test. Reported-By: "anderson" Discussion: http://postgr.es/m/20170105144819.f6i5o64vfvy4bn5i@alap3.anarazel.de
This commit is contained in:
@ -298,7 +298,13 @@ ALTER TABLE toasted_several REPLICA IDENTITY FULL;
|
||||
ALTER TABLE toasted_several ALTER COLUMN toasted_key SET STORAGE EXTERNAL;
|
||||
ALTER TABLE toasted_several ALTER COLUMN toasted_col1 SET STORAGE EXTERNAL;
|
||||
ALTER TABLE toasted_several ALTER COLUMN toasted_col2 SET STORAGE EXTERNAL;
|
||||
INSERT INTO toasted_several(toasted_key) VALUES(repeat('9876543210', 2000));
|
||||
INSERT INTO toasted_several(toasted_key) VALUES(repeat('9876543210', 10000));
|
||||
SELECT pg_column_size(toasted_key) > 2^16 FROM toasted_several;
|
||||
?column?
|
||||
----------
|
||||
t
|
||||
(1 row)
|
||||
|
||||
SELECT regexp_replace(data, '^(.{100}).*(.{100})$', '\1..\2') FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
|
||||
regexp_replace
|
||||
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
@ -274,7 +274,8 @@ ALTER TABLE toasted_several ALTER COLUMN toasted_key SET STORAGE EXTERNAL;
|
||||
ALTER TABLE toasted_several ALTER COLUMN toasted_col1 SET STORAGE EXTERNAL;
|
||||
ALTER TABLE toasted_several ALTER COLUMN toasted_col2 SET STORAGE EXTERNAL;
|
||||
|
||||
INSERT INTO toasted_several(toasted_key) VALUES(repeat('9876543210', 2000));
|
||||
INSERT INTO toasted_several(toasted_key) VALUES(repeat('9876543210', 10000));
|
||||
SELECT pg_column_size(toasted_key) > 2^16 FROM toasted_several;
|
||||
|
||||
SELECT regexp_replace(data, '^(.{100}).*(.{100})$', '\1..\2') FROM pg_logical_slot_peek_changes('regression_slot', NULL, NULL, 'include-xids', '0', 'skip-empty-xacts', '1');
|
||||
|
||||
|
Reference in New Issue
Block a user