Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-16 Thread Peter Geoghegan
On Thu, May 16, 2019 at 1:05 PM Peter Geoghegan wrote: > Actually, now that I look back at how page deletion worked 5+ years > ago, I realize that I have this slightly wrong: the leaf level check > is not sufficient to figure out if the parent's right sibling is > pending deletion (which is repres

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-16 Thread Peter Geoghegan
On Mon, May 13, 2019 at 9:09 PM Peter Geoghegan wrote: > Even when that happens, the index is already considered corrupt by > VACUUM, so the same VACUUM process that could in theory be adversely > affected by removing the half-dead internal page check will complain > about the page when it gets to

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-13 Thread Peter Geoghegan
On Mon, May 13, 2019 at 8:30 PM Tom Lane wrote: > Peter Geoghegan writes: > > To be fair, I suppose that the code made more sense when it first went > > in, because at the time there was a chance that there could be > > leftover half-dead internal pages. But, that was a long time ago now. > > Is

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-13 Thread Tom Lane
Peter Geoghegan writes: > To be fair, I suppose that the code made more sense when it first went > in, because at the time there was a chance that there could be > leftover half-dead internal pages. But, that was a long time ago now. Is there a good reason to assume there are none left anywhere?

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-13 Thread Peter Geoghegan
On Tue, May 7, 2019 at 9:59 AM Peter Geoghegan wrote: > On Tue, May 7, 2019 at 12:27 AM Heikki Linnakangas wrote: > > I don't understand that reasoning. Yes, _bt_pagedel() will complain if > > it finds a half-dead internal page. But how does that mean that > > _bt_lock_branch_parent() can't encou

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-07 Thread Peter Geoghegan
On Tue, May 7, 2019 at 12:27 AM Heikki Linnakangas wrote: > I don't understand that reasoning. Yes, _bt_pagedel() will complain if > it finds a half-dead internal page. But how does that mean that > _bt_lock_branch_parent() can't encounter one? I suppose that in theory it could, but only if you a

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-07 Thread Heikki Linnakangas
On 05/05/2019 01:38, Peter Geoghegan wrote: On Fri, Mar 1, 2019 at 3:59 PM Peter Geoghegan wrote: /* * Perform the same check on this internal level that * _bt_mark_page_halfdead performed on the leaf level. */ if (_bt_is_page_

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-05-04 Thread Peter Geoghegan
On Fri, Mar 1, 2019 at 3:59 PM Peter Geoghegan wrote: > /* > * Perform the same check on this internal level that > * _bt_mark_page_halfdead performed on the leaf level. > */ > if (_bt_is_page_halfdead(rel, *rightsib)) > I thought tha

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-03-01 Thread Peter Geoghegan
On Fri, Mar 1, 2019 at 5:00 PM Peter Geoghegan wrote: > I favor keeping the test, but having it throw a > ERRCODE_INDEX_CORRUPTED error, just like _bt_pagedel() does already. A > comment could point out that the test is historical/defensive, and > probably isn't actually necessary. What do you thi

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-03-01 Thread Peter Geoghegan
On Fri, Mar 1, 2019 at 4:41 PM Tom Lane wrote: > > FWIW, I notice that the logic that appears after the > > _bt_lock_branch_parent() call to _bt_getstackbuf() anticipates that it > > must defend against interrupted splits in at least the > > grandparent-of-leaf page, and maybe even the parent, so

Re: VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-03-01 Thread Tom Lane
Peter Geoghegan writes: > _bt_lock_branch_parent() is used by VACUUM during page deletion, and > calls _bt_getstackbuf(), which always finishes incomplete page splits > for the parent page that it exclusive locks and returns. ISTM that > this may be problematic, since it contradicts the general ru

VACUUM can finish an interrupted nbtree page split -- is that okay?

2019-03-01 Thread Peter Geoghegan
_bt_lock_branch_parent() is used by VACUUM during page deletion, and calls _bt_getstackbuf(), which always finishes incomplete page splits for the parent page that it exclusive locks and returns. ISTM that this may be problematic, since it contradicts the general rule that VACUUM isn't supposed to