Re: [GENERAL] Pb importing data in v. 7.0.3 - Mailing list pgsql-patches

From Tom Lane
Subject Re: [GENERAL] Pb importing data in v. 7.0.3
Date
Msg-id 19965.978583437@sss.pgh.pa.us
Whole thread Raw
List pgsql-patches
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);
      }

      /*

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: [patch] src/include/storage/s_lock.h
Next
From: Alex Perel
Date:
Subject: \du in psql patch