This repository has been archived by the owner on Dec 1, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add amcheck verification of indexes against heap
Add a new, optional capability to bt_index_check() and bt_index_parent_check(): callers can check that each heap tuple that ought to have an index entry does in fact have one. This happens at the end of the existing verification checks. This is implemented by using a Bloom filter data structure. The implementation performs set membership tests within a callback (the same type of callback that each index AM registers for CREATE INDEX). The Bloom filter is populated during the initial index verification scan.
- Loading branch information
1 parent
2fb2ace
commit 1fca5e9
Showing
11 changed files
with
798 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/* amcheck_next--1--2.sql */ | ||
|
||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION | ||
\echo Use "ALTER EXTENSION amcheck_next UPDATE TO '2'" to load this file. \quit | ||
|
||
-- | ||
-- bt_index_check() | ||
-- | ||
DROP FUNCTION bt_index_check(regclass); | ||
CREATE FUNCTION bt_index_check(index regclass, | ||
heapallindexed boolean DEFAULT false) | ||
RETURNS VOID | ||
AS 'MODULE_PATHNAME', 'bt_index_check_next' | ||
LANGUAGE C STRICT; | ||
|
||
-- | ||
-- bt_index_parent_check() | ||
-- | ||
DROP FUNCTION bt_index_parent_check(regclass); | ||
CREATE FUNCTION bt_index_parent_check(index regclass, | ||
heapallindexed boolean DEFAULT false) | ||
RETURNS VOID | ||
AS 'MODULE_PATHNAME', 'bt_index_parent_check_next' | ||
LANGUAGE C STRICT; | ||
|
||
-- Don't want these to be available to public | ||
REVOKE ALL ON FUNCTION bt_index_check(regclass, boolean) FROM PUBLIC; | ||
REVOKE ALL ON FUNCTION bt_index_parent_check(regclass, boolean) FROM PUBLIC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* amcheck_next--2.sql */ | ||
|
||
-- complain if script is sourced in psql, rather than via CREATE EXTENSION | ||
\echo Use "CREATE EXTENSION amcheck_next" to load this file. \quit | ||
|
||
-- | ||
-- bt_index_check() | ||
-- | ||
CREATE FUNCTION bt_index_check(index regclass, | ||
heapallindexed boolean DEFAULT false) | ||
RETURNS VOID | ||
AS 'MODULE_PATHNAME', 'bt_index_check_next' | ||
LANGUAGE C STRICT; | ||
|
||
-- | ||
-- bt_index_parent_check() | ||
-- | ||
CREATE FUNCTION bt_index_parent_check(index regclass, | ||
heapallindexed boolean DEFAULT false) | ||
RETURNS VOID | ||
AS 'MODULE_PATHNAME', 'bt_index_parent_check_next' | ||
LANGUAGE C STRICT; | ||
|
||
-- Don't want these to be available to public | ||
REVOKE ALL ON FUNCTION bt_index_check(regclass, boolean) FROM PUBLIC; | ||
REVOKE ALL ON FUNCTION bt_index_parent_check(regclass, boolean) FROM PUBLIC; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
# amcheck_next extension | ||
comment = 'functions for verifying relation integrity' | ||
default_version = '1' | ||
default_version = '2' | ||
module_pathname = '$libdir/amcheck_next' | ||
relocatable = true |
Oops, something went wrong.