diff options
author | Teodor Sigaev <teodor@sigaev.ru> | 2018-04-25 22:05:53 +0300 |
---|---|---|
committer | Teodor Sigaev <teodor@sigaev.ru> | 2018-04-25 22:05:53 +0300 |
commit | f35f30f74b6abb0a2f47c91c20df606cf166e8ff (patch) | |
tree | b06a13cdccbb55b8be2447d861b34eba0b59210e /contrib/amcheck/verify_nbtree.c | |
parent | f04d4ac919b9ae9b57e977523e4b40979aa8b951 (diff) | |
download | postgresql-f35f30f74b6abb0a2f47c91c20df606cf166e8ff.tar.gz postgresql-f35f30f74b6abb0a2f47c91c20df606cf166e8ff.zip |
Add amcheck missing downlink tests.
Also use palloc0() for main amcheck state, and adjust a few comments.
Somehow I pushed old version of patch in commit
4eaf7eaccb291f5d32d9f05284bfca9c5744de9a, so commit the difference.
Peter Geoghegan
Diffstat (limited to 'contrib/amcheck/verify_nbtree.c')
-rw-r--r-- | contrib/amcheck/verify_nbtree.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/contrib/amcheck/verify_nbtree.c b/contrib/amcheck/verify_nbtree.c index 94495293824..a3a52877482 100644 --- a/contrib/amcheck/verify_nbtree.c +++ b/contrib/amcheck/verify_nbtree.c @@ -340,7 +340,7 @@ bt_check_every_level(Relation rel, Relation heaprel, bool readonly, /* * Initialize state for entire verification operation */ - state = palloc(sizeof(BtreeCheckState)); + state = palloc0(sizeof(BtreeCheckState)); state->rel = rel; state->heaprel = heaprel; state->readonly = readonly; @@ -772,13 +772,15 @@ nextpage: * - That tuples report that they have the expected number of attributes. * INCLUDE index pivot tuples should not contain non-key attributes. * - * Furthermore, when state passed shows ShareLock held, and target page is - * internal page, function also checks: + * Furthermore, when state passed shows ShareLock held, function also checks: * * - That all child pages respect downlinks lower bound. * + * - That downlink to block was encountered in parent where that's expected. + * (Limited to heapallindexed readonly callers.) + * * This is also where heapallindexed callers use their Bloom filter to - * fingerprint IndexTuples. + * fingerprint IndexTuples for later IndexBuildHeapScan() verification. * * Note: Memory allocated in this routine is expected to be released by caller * resetting state->targetcontext. @@ -1074,7 +1076,7 @@ bt_target_page_check(BtreeCheckState *state) /* * * Check if page has a downlink in parent * * - * This can only be checked in readonly + heapallindexed case. + * This can only be checked in heapallindexed + readonly case. */ if (state->heapallindexed && state->readonly) bt_downlink_missing_check(state); @@ -1561,7 +1563,7 @@ bt_downlink_missing_check(BtreeCheckState *state) * infinity items. Besides, bt_downlink_check() is unwilling to descend * multiple levels. (The similar bt_downlink_check() P_ISDELETED() check * within bt_check_level_from_leftmost() won't reach the page either, since - * the leaf's live siblings should have their sibling links updating to + * the leaf's live siblings should have their sibling links updated to * bypass the deletion target page when it is marked fully dead.) * * If this error is raised, it might be due to a previous multi-level page |