postgresql/src/backend
Peter Geoghegan 3f58cc6dd8 Remove extra nbtree half-dead internal page check.
It's not safe for nbtree VACUUM to attempt to delete a target page whose
right sibling is already half-dead, since that would fail the
cross-check when VACUUM attempts to re-find a downlink to the right
sibling in the parent page.  Logic to prevent this from happening was
added by commit 8da3183780, which addressed a bug in the overhaul of
page deletion that went into PostgreSQL 9.4 (commit efada2b8e9).
VACUUM was made to check the right sibling page, and back off when it
happened to be half-dead already.

However, it is only truly necessary to do the right sibling check on the
leaf level, since that transitively determines if the deletion target's
parent's right sibling page is itself undergoing deletion.  Remove the
internal page level check, and add a comment explaining why the leaf
level check alone suffices.

The extra check is also unnecessary due to the fact that internal pages
that are marked half-dead are generally considered corrupt.  Commit
efada2b8e9 established the principle that there should never be
half-dead internal pages (internal pages pending deletion are possible,
but that status is never directly represented in the internal page).
VACUUM will complain about corruption when it encounters half-dead
internal pages, so VACUUM is bound to raise an error one way or another
when an nbtree index has a half-dead internal page (contrib/amcheck will
also report that the page is corrupt).

It's possible that a pg_upgrade'd 9.3 database will still have half-dead
internal pages, so it may seem like there is an argument for leaving the
check in place to reliably get a cleaner error message that advises the
user to REINDEX.  However, leaf pages are also deleted in the first
phase of deletion prior to PostgreSQL 9.4, so I believe we won't even
attempt to re-find the parent page anyway (we won't have the fully
deleted leaf page as the right sibling of our target page, so we won't
even try to find a downlink for it).

Discussion: https://postgr.es/m/CAH2-Wzm_ntmqJjWLRyKzimFmFvk+BnVAvUpaA4s1h9Ja58woaQ@mail.gmail.com
2019-05-16 15:11:58 -07:00
..
access Remove extra nbtree half-dead internal page check. 2019-05-16 15:11:58 -07:00
bootstrap In bootstrap mode, use default signal handling for SIGINT etc. 2019-05-14 10:22:28 -04:00
catalog Update SQL features/conformance information to SQL:2016 2019-05-14 15:44:37 +02:00
commands Improve and fix some error handling for REINDEX INDEX/TABLE CONCURRENTLY 2019-05-10 08:18:46 +09:00
executor Handle table_complete_speculative's succeeded argument as documented. 2019-05-14 12:19:32 -07:00
foreign Update copyright for 2019 2019-01-02 12:44:25 -05:00
jit Improve comment spelling and style in llvmjit_deform.c. 2019-04-30 16:20:07 -07:00
lib Fix example in comment. 2019-04-09 08:33:42 +03:00
libpq Clean up minor warnings from buildfarm. 2019-04-28 12:45:55 -04:00
main Replace @postgresql.org with @lists.postgresql.org for mailinglists 2019-01-19 19:06:35 +01:00
nodes Fix tablespace inheritance for partitioned rels 2019-04-25 10:31:32 -04:00
optimizer Repair issues with faulty generation of merge-append plans. 2019-05-09 16:53:05 -04:00
parser Fix tablespace inheritance for partitioned rels 2019-04-25 10:31:32 -04:00
partitioning Fix bogus logic for combining range-partitioned columns during pruning. 2019-05-16 16:25:43 -04:00
po Translation updates 2018-06-25 12:37:18 +02:00
port Cope with EINVAL and EIDRM shmat() failures in PGSharedMemoryAttach. 2019-05-10 14:56:41 -04:00
postmaster Rearrange pgstat_bestart() to avoid failures within its critical section. 2019-05-11 21:27:29 -04:00
regex Fix misoptimization of "{1,1}" quantifiers in regular expressions. 2019-05-12 18:53:38 -04:00
replication Fix duplicated words in comments 2019-05-14 09:37:35 +09:00
rewrite Perform RLS subquery checks as the right user when going via a view. 2019-04-02 08:13:59 +01:00
snowball Update copyright for 2019 2019-01-02 12:44:25 -05:00
statistics Fix mvdistinct and dependencies size calculations 2019-04-21 20:23:34 +02:00
storage Standardize ItemIdData terminology. 2019-05-13 15:53:39 -07:00
tcop Fix potential catalog corruption with temporary identity columns 2019-04-29 08:49:03 +02:00
tsearch Fix more strcmp() calls using boolean-like comparisons for result checks 2019-04-12 10:16:49 +09:00
utils Fix SQL-style substring() to have spec-compliant greediness behavior. 2019-05-14 11:27:31 -04:00
.gitignore Add .gitignore entries for AIX-specific intermediate build artifacts. 2015-07-08 20:44:22 -04:00
Makefile Get rid of jsonpath_gram.h and jsonpath_scanner.h 2019-03-20 11:13:34 +03:00
common.mk Remove PARTIAL_LINKING build mode. 2018-03-30 17:33:04 -07:00
nls.mk Translation updates 2018-06-25 12:37:18 +02:00