Skip site navigation (1) Skip section navigation (2)

Re: Create index problem ( _bt_sort )

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Yasuo Ohgaki" <yasuo_ohgaki(at)hotmail(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org, "Loc TREGOUT" <loic(at)cri74(dot)org>, svanegmond(at)home(dot)com, pgsql-bugs(at)postgresql(dot)org
Subject: Re: Create index problem ( _bt_sort )
Date: 2001-02-08 23:17:50
Message-ID: 13480.981674270@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-adminpgsql-bugs
"Yasuo Ohgaki" <yasuo_ohgaki(at)hotmail(dot)com> writes:
> raslog=# create index user2000 on log2000(username);
> FATAL 1:  btree: failed to add item to the page in _bt_sort (2)

Stephen van Egmnond was kind enough to submit a self-contained example,
from which it turns out that this bug is one that was found and fixed
about a month ago (sheesh, my memory is going).  Attached is a patch
that fixes it in 7.0.*.

			regards, tom lane


*** src/backend/access/nbtree/nbtsort.c.orig	Wed Apr 12 13:14:49 2000
--- src/backend/access/nbtree/nbtsort.c	Thu Jan  4 16:51:49 2001
***************
*** 28,34 ****
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *	  $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.52 2000/04/12 17:14:49 momjian Exp $
   *
   *-------------------------------------------------------------------------
   */
--- 28,34 ----
   * Portions Copyright (c) 1994, Regents of the University of California
   *
   * IDENTIFICATION
!  *	  $Header: /home/projects/pgsql/cvsroot/pgsql/src/backend/access/nbtree/nbtsort.c,v 1.52.2.1 2001/01/04 21:51:49 tgl Exp $
   *
   *-------------------------------------------------------------------------
   */
***************
*** 321,327 ****
  			 btisz,
  			 (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
  
! 	if (pgspc < btisz)
  	{
  		Buffer		obuf = nbuf;
  		Page		opage = npage;
--- 321,327 ----
  			 btisz,
  			 (PageGetPageSize(npage) - sizeof(PageHeaderData) - MAXALIGN(sizeof(BTPageOpaqueData))) /3 - sizeof(ItemIdData));
  
! 	while (pgspc < btisz)
  	{
  		Buffer		obuf = nbuf;
  		Page		opage = npage;
***************
*** 436,441 ****
--- 436,448 ----
  		 * we aren't locking).
  		 */
  		_bt_wrtbuf(index, obuf);
+ 
+ 		/*
+ 		 * Recompute pgspc and loop back to check free space again.  If
+ 		 * we were forced to split at a bad split point, we might need
+ 		 * to split again.
+ 		 */
+ 		pgspc = PageGetFreeSpace(npage);
  	}
  
  	/*

In response to

pgsql-admin by date

Next:From: Stefan HuberDate: 2001-02-09 10:34:08
Subject: Re: Re: pgadmin
Previous:From: Leonid FurmanDate: 2001-02-08 20:59:13
Subject:

pgsql-bugs by date

Next:From: praveenkumar reddy mDate: 2001-02-09 12:53:03
Subject: please give me the answer
Previous:From: Stephen van EgmondDate: 2001-02-08 23:07:26
Subject: Re: Backend crash while indexing large strings

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group