[PATCHES] patch for 6.5.X tree (fwd)
[PATCHES] patch for 6.5.X tree (fwd)
От:
Oleg Bartunov <oleg@sai.msu.su>
Дата:
This is a lost Vadim's patch for 6.5X tree
Oleg
_____________________________________________________________
Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
Sternberg Astronomical Institute, Moscow University (Russia)
Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(095)939-16-83, +007(095)939-23-83
---------- Forwarded message ----------
Date: Mon, 09 Aug 1999 09:43:29 +0800
From: Vadim Mikheev
To: patches@postgreSQL.org
Subject: [PATCHES] patch for 6.5.X tree
Sorry, I haven't 6.5.X tree on my host - could someone
apply patch below? TIA.
This is to re-use space on index pages freed by vacuum.
Vadim
*** nbtinsert.c.orig Fri Aug 6 22:04:40 1999
--- nbtinsert.c Fri Aug 6 22:10:40 1999
***************
*** 392,408 **** bool is_root = lpageop->btpo_flags & BTP_ROOT; /*
! * If we have to split leaf page in the chain of duplicates by new
! * duplicate then we try to look at our right sibling first. */ if ((lpageop->btpo_flags & BTP_CHAIN) && (lpageop->btpo_flags & BTP_LEAF) && keys_equal) {
- bool use_left = true;
- rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE); rpage = BufferGetPage(rbuf); rpageop = (BTPageOpaque) PageGetSpecialPointer(rpage); if (!P_RIGHTMOST(rpageop)) /* non-rightmost page */ { /* If we have the same hikey here then * it's yet another page in chain. */
--- 392,409 ---- bool is_root = lpageop->btpo_flags & BTP_ROOT; /*
! * Instead of splitting leaf page in the chain of duplicates
! * by new duplicate, insert it into some right page. */ if ((lpageop->btpo_flags & BTP_CHAIN) && (lpageop->btpo_flags & BTP_LEAF) && keys_equal) { rbuf = _bt_getbuf(rel, lpageop->btpo_next, BT_WRITE); rpage = BufferGetPage(rbuf); rpageop = (BTPageOpaque) PageGetSpecialPointer(rpage);
+ /*
+ * some checks
+ */ if (!P_RIGHTMOST(rpageop)) /* non-rightmost page */ { /* If we have the same hikey here then * it's yet another page in chain. */
***************
*** 418,449 **** BTGreaterStrategyNumber)) elog(FATAL, "btree: hikey is out of order"); else if (rpageop->btpo_flags & BTP_CHAIN)
- /* * If hikey > scankey then it's last page in chain and * BTP_CHAIN must be OFF */ elog(FATAL, "btree: lost last page in the chain of duplicates");
-
- /* if there is room here then we use this page. */
- if (PageGetFreeSpace(rpage) > itemsz)
- use_left = false; } else /* rightmost page */ { Assert(!(rpageop->btpo_flags & BTP_CHAIN));
- /* if there is room here then we use this page. */
- if (PageGetFreeSpace(rpage) > itemsz)
- use_left = false; }
! if (!use_left) /* insert on the right page */
! {
! _bt_relbuf(rel, buf, BT_WRITE);
! return (_bt_insertonpg(rel, rbuf, stack, keysz,
! scankey, btitem, afteritem));
! }
! _bt_relbuf(rel, rbuf, BT_WRITE); } /*
--- 419,438 ---- BTGreaterStrategyNumber)) elog(FATAL, "btree: hikey is out of order"); else if (rpageop->btpo_flags & BTP_CHAIN) /* * If hikey > scankey then it's last page in chain and * BTP_CHAIN must be OFF */ elog(FATAL, "btree: lost last page in the chain of duplicates"); } else /* rightmost page */ { Assert(!(rpageop->btpo_flags & BTP_CHAIN)); }
! _bt_relbuf(rel, buf, BT_WRITE);
! return (_bt_insertonpg(rel, rbuf, stack, keysz,
! scankey, btitem, afteritem)); } /*
Re: [PATCHES] patch for 6.5.X tree (fwd)
От:
The Hermit Hacker <scrappy@hub.org>
Дата:
Okay, I'm going by the fact that Vadim approved this, and am applying it
right now...
On Wed, 1 Sep 1999, Oleg Bartunov wrote:
> This is a lost Vadim's patch for 6.5X tree
>
> Oleg
> _____________________________________________________________
> Oleg Bartunov, sci.researcher, hostmaster of AstroNet,
> Sternberg Astronomical Institute, Moscow University (Russia)
> Internet: oleg@sai.msu.su, http://www.sai.msu.su/~megera/
> phone: +007(095)939-16-83, +007(095)939-23-83
>
> ---------- Forwarded message ----------
> Date: Mon, 09 Aug 1999 09:43:29 +0800
> From: Vadim Mikheev
> To: patches@postgreSQL.org
> Subject: [PATCHES] patch for 6.5.X tree
>
> Sorry, I haven't 6.5.X tree on my host - could someone
> apply patch below? TIA.
> This is to re-use space on index pages freed by vacuum.
>
> Vadim
>
Marc G. Fournier ICQ#7615664 IRC Nick: Scrappy
Systems Administrator @ hub.org
primary: scrappy@hub.org secondary: scrappy@{freebsd|postgresql}.org