Assert in pageinspect with NULL pages
Daria Lepikhova <d.lepikhova@postgrespro.ru>
From: Daria Lepikhova <d.lepikhova@postgrespro.ru>
To: pgsql-hackers@postgresql.org
Date: 2022-02-17T08:46:40Z
Lists: pgsql-hackers
Attachments
- 0001-Add-checks-for-null-pages-to-pageinspect-functions.patch (text/x-patch) patch 0001
Hi, hackers! If we trying to call pageinspect functions for pages which are filled with nulls, we will get core dump. It happens with null pages for all indexes in pageinspect and for page_checksum. This problem was founded firstly by Anastasia Lubennikova, and now I continue this task. For example, next script leads to fail. CREATE TABLE test1 ( x bigserial, y bigint DEFAULT 0 ); INSERT INTO test1(y) SELECT 0 FROM generate_series(1,1E6) AS x; SELECT page_checksum(repeat(E'\\000', 8192)::bytea, 1); server closed the connection unexpectedly This probably means the server terminated abnormally before or while processing the request. fatal: connection to server was lost LOG: server process (PID 16465) was terminated by signal 6 DETAIL: Failed process was running: select page_checksum(repeat(E'\\000', 8192)::bytea, 1); LOG: terminating any other active server processes LOG: all server processes terminated; reinitializing LOG: database system was interrupted; last known up at 2022-02-16 14:03:16 +05 LOG: database system was not properly shut down; automatic recovery in progress LOG: redo starts at 0/14F1B20 LOG: invalid record length at 0/5D40CD8: wanted 24, got 0 LOG: redo done at 0/5D40BC0 system usage: CPU: user: 0.98 s, system: 0.02 s, elapsed: 1.01 s LOG: checkpoint starting: end-of-recovery immediate wait LOG: checkpoint complete: wrote 5500 buffers (33.6%); 0 WAL file(s) added, 0 removed, 4 recycled; write=0.064 s, sync=0.007 s, total=0.080 s; sync files=45, longest=0.004 s, average=0.001 s; distance=74044 kB, estimate=74044 kB LOG: database system is ready to accept connections Also it is possible to use select brin_metapage_info(repeat(E'\\000', 8192)::bytea); or select bt_page_items(repeat(E'\\000', 8192)::bytea); for getting fail. I tried to make some additional checks for null pages into pageinspect' functions. The attached patch also contains tests for this case. What do you think? -- Daria Lepikhova Postgres Professional
Commits
-
pageinspect: Fix handling of all-zero pages
- 12d32b7bc151 10.21 landed
- 79fed072ba5f 11.16 landed
- 5378d55cb2f3 12.11 landed
- 2275d044d084 13.7 landed
- df6bbe73b86c 14.3 landed
- cd4868a5700f 15.0 landed
-
pageinspect: Add more sanity checks to prevent out-of-bound reads
- ab80b0fbbbc4 10.21 landed
- 1a2fdf86aae8 11.16 landed
- 5ca2aa2f26ea 12.11 landed
- 3d4d6dee0777 13.7 landed
- 27d384441851 14.3 landed
- 291e517a4dc9 15.0 landed
-
pageinspect: Fix handling of page sizes and AM types
- c42b88932b9d 10.21 landed
- 2389ee8dd800 11.16 landed
- af8a8eb54245 12.11 landed
- d3a9b83c30b6 13.7 landed
- b61e6214cfac 14.3 landed
- 076f4d9539e9 15.0 landed
-
Teach pageinspect about nbtree deduplication.
- 93ee38eade1b 13.0 cited