Re: [HACKERS] Dead code in _bt_split?

2007-02-06 Thread Heikki Linnakangas

Bruce Momjian wrote:

Heikki Linnakangas wrote:

Bruce Momjian wrote:

Heikki, did this code cleanup get included in your recent btree split
fix?

No.


OK, would you please send a patch to remove the unused code.  Thanks.


Ok, here you are.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com
Index: src/backend/access/nbtree/nbtinsert.c
===
RCS file: /home/hlinnaka/pgcvsrepository/pgsql/src/backend/access/nbtree/nbtinsert.c,v
retrieving revision 1.148
diff -c -r1.148 nbtinsert.c
*** src/backend/access/nbtree/nbtinsert.c	27 Jan 2007 20:53:30 -	1.148
--- src/backend/access/nbtree/nbtinsert.c	6 Feb 2007 10:23:26 -
***
*** 855,876 
  	/* cope with possibility that newitem goes at the end */
  	if (i = newitemoff)
  	{
! 		if (newitemonleft)
! 		{
! 			_bt_pgaddtup(rel, leftpage, newitemsz, newitem, leftoff,
! 		 left sibling);
! 			itup_off = leftoff;
! 			itup_blkno = BufferGetBlockNumber(buf);
! 			leftoff = OffsetNumberNext(leftoff);
! 		}
! 		else
! 		{
! 			_bt_pgaddtup(rel, rightpage, newitemsz, newitem, rightoff,
! 		 right sibling);
! 			itup_off = rightoff;
! 			itup_blkno = BufferGetBlockNumber(rbuf);
! 			rightoff = OffsetNumberNext(rightoff);
! 		}
  	}
  
  	/*
--- 855,865 
  	/* cope with possibility that newitem goes at the end */
  	if (i = newitemoff)
  	{
! 		_bt_pgaddtup(rel, rightpage, newitemsz, newitem, rightoff,
! 	 right sibling);
! 		itup_off = rightoff;
! 		itup_blkno = BufferGetBlockNumber(rbuf);
! 		rightoff = OffsetNumberNext(rightoff);
  	}
  
  	/*

---(end of broadcast)---
TIP 6: explain analyze is your friend


Re: [HACKERS] Dead code in _bt_split?

2007-02-06 Thread Tom Lane
Heikki Linnakangas [EMAIL PROTECTED] writes:
 Bruce Momjian wrote:
 OK, would you please send a patch to remove the unused code.  Thanks.

 Ok, here you are.

Applied with an added comment and Assert.

While testing it I realized that there seems to be a nearby bug in
_bt_findsplitloc: it fails to consider the possibility of moving all the
extant items to the left side.  It will always return a firstright =
maxoff.  ISTM this would mean that it could choose a bad split if the
incoming item goes at the end and both it and the last extant item are
large: in this case they should be split apart, but they won't be.

Heikki, do you feel like looking at that, or shall I?

regards, tom lane

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] Dead code in _bt_split?

2007-02-06 Thread Heikki Linnakangas

Tom Lane wrote:

Heikki Linnakangas [EMAIL PROTECTED] writes:

Bruce Momjian wrote:

OK, would you please send a patch to remove the unused code.  Thanks.



Ok, here you are.


Applied with an added comment and Assert.

While testing it I realized that there seems to be a nearby bug in
_bt_findsplitloc: it fails to consider the possibility of moving all the
extant items to the left side.  It will always return a firstright =
maxoff.  ISTM this would mean that it could choose a bad split if the
incoming item goes at the end and both it and the last extant item are
large: in this case they should be split apart, but they won't be.

Heikki, do you feel like looking at that, or shall I?


I'll take a look at it.

--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
  subscribe-nomail command to [EMAIL PROTECTED] so that your
  message can get through to the mailing list cleanly


Re: [HACKERS] Dead code in _bt_split?

2007-02-05 Thread Bruce Momjian
Heikki Linnakangas wrote:
 Bruce Momjian wrote:
  Heikki, did this code cleanup get included in your recent btree split
  fix?
 
 No.

OK, would you please send a patch to remove the unused code.  Thanks.

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 4: Have you searched our list archives?

   http://archives.postgresql.org


Re: [HACKERS] Dead code in _bt_split?

2007-02-04 Thread Heikki Linnakangas

Bruce Momjian wrote:

Heikki, did this code cleanup get included in your recent btree split
fix?


No.


---

Tom Lane wrote:

Heikki Linnakangas [EMAIL PROTECTED] writes:

In that case, newitemleft would be false, right?
I'm saying the piece marked with X below is unreachable:

Oh, I see.  Hmm ... probably so, I think that chunk of code was just
copied and pasted from where it occurs within the loop.


--
  Heikki Linnakangas
  EnterpriseDB   http://www.enterprisedb.com

---(end of broadcast)---
TIP 7: You can help support the PostgreSQL project by donating at

   http://www.postgresql.org/about/donate


Re: [HACKERS] Dead code in _bt_split?

2007-02-03 Thread Bruce Momjian

Heikki, did this code cleanup get included in your recent btree split
fix?

---

Tom Lane wrote:
 Heikki Linnakangas [EMAIL PROTECTED] writes:
  In that case, newitemleft would be false, right?
  I'm saying the piece marked with X below is unreachable:
 
 Oh, I see.  Hmm ... probably so, I think that chunk of code was just
 copied and pasted from where it occurs within the loop.
 
   regards, tom lane
 
 ---(end of broadcast)---
 TIP 6: explain analyze is your friend

-- 
  Bruce Momjian   [EMAIL PROTECTED]
  EnterpriseDBhttp://www.enterprisedb.com

  + If your life is a hard drive, Christ can be your backup. +

---(end of broadcast)---
TIP 1: if posting/reading through Usenet, please send an appropriate
   subscribe-nomail command to [EMAIL PROTECTED] so that your
   message can get through to the mailing list cleanly