mirror of
https://github.com/postgres/postgres.git
synced 2025-08-08 06:02:22 +03:00
pageinspect: Fix hash_bitmap_info not to read the underlying page.
It did that to verify that the page was an overflow page rather than anything else, but that means that checking the status of all the overflow bits requires reading the entire index. So don't do that. The new code validates that the page is not a primary bucket page or bitmap page by looking at the metapage, so that using this on large numbers of pages can be reasonably efficient. Ashutosh Sharma, per a complaint from me, and with further modifications by me.
This commit is contained in:
@@ -30,23 +30,17 @@ hash_page_type | bitmap
|
||||
SELECT hash_page_type(get_raw_page('test_hash_a_idx', 6));
|
||||
ERROR: block number 6 is out of range for relation "test_hash_a_idx"
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 0);
|
||||
ERROR: page is not an overflow page
|
||||
DETAIL: Expected 00000001, got 00000008.
|
||||
ERROR: invalid overflow block number 0
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 1);
|
||||
ERROR: page is not an overflow page
|
||||
DETAIL: Expected 00000001, got 00000002.
|
||||
ERROR: invalid overflow block number 1
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 2);
|
||||
ERROR: page is not an overflow page
|
||||
DETAIL: Expected 00000001, got 00000002.
|
||||
ERROR: invalid overflow block number 2
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 3);
|
||||
ERROR: page is not an overflow page
|
||||
DETAIL: Expected 00000001, got 00000002.
|
||||
ERROR: invalid overflow block number 3
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 4);
|
||||
ERROR: page is not an overflow page
|
||||
DETAIL: Expected 00000001, got 00000002.
|
||||
ERROR: invalid overflow block number 4
|
||||
SELECT * FROM hash_bitmap_info('test_hash_a_idx', 5);
|
||||
ERROR: page is not an overflow page
|
||||
DETAIL: Expected 00000001, got 00000004.
|
||||
ERROR: invalid overflow block number 5
|
||||
SELECT magic, version, ntuples, bsize, bmsize, bmshift, maxbucket, highmask,
|
||||
lowmask, ovflpoint, firstfree, nmaps, procid, spares, mapp FROM
|
||||
hash_metapage_info(get_raw_page('test_hash_a_idx', 0));
|
||||
|
Reference in New Issue
Block a user