Re: [GENERAL] Pb importing data in v. 7.0.3

Поиск
Список
Период
Сортировка
Искать

Re: [GENERAL] Pb importing data in v. 7.0.3

От:
Tom Lane <tgl@sss.pgh.pa.us>
Дата:
I wrote:
> The equal-key logic has been entirely rewritten for 7.1, and I believe
> that it's not subject to this bug any longer.  I'm very hesitant to try
> to jury-rig a solution for 7.0, though

Actually, after thinking a little more, I think that the attached patch
might cure the problem in 7.0.3.  Give it a try, if you like.

			regards, tom lane


*** src/backend/access/nbtree/nbtsort.c.orig	Wed Apr 12 13:14:49 2000
--- src/backend/access/nbtree/nbtsort.c	Wed Jan  3 23:37:46 2001
***************
*** 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);
  	}
  
  	/*
FAQ