pgsql: btree source code cleanups: I refactored findsplitloc and

From: momjian(at)postgresql(dot)org (Bruce Momjian)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: btree source code cleanups: I refactored findsplitloc and
Date: 2007-02-21 20:02:18
Message-ID: 20070221200218.1E3059FBDC4@postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
btree source code cleanups:

I refactored findsplitloc and checksplitloc so that the division of
labor is more clear IMO. I pushed all the space calculation inside the
loop to checksplitloc.

I also fixed the off by 4 in free space calculation caused by
PageGetFreeSpace subtracting sizeof(ItemIdData), even though it was
harmless, because it was distracting and I felt it might come back to
bite us in the future if we change the page layout or alignments.
There's now a new function PageGetExactFreeSpace that doesn't do the
subtraction.

findsplitloc now tries the "just the new item to right page" split as
well. If people don't like the refactoring, I can write a patch to just
add that.

Heikki Linnakangas

Modified Files:
--------------
pgsql/src/backend/access/nbtree:
nbtinsert.c (r1.151 -> r1.152)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/access/nbtree/nbtinsert.c.diff?r1=1.151&r2=1.152)
pgsql/src/backend/storage/page:
bufpage.c (r1.70 -> r1.71)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/storage/page/bufpage.c.diff?r1=1.70&r2=1.71)
pgsql/src/include/storage:
bufpage.h (r1.70 -> r1.71)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/storage/bufpage.h.diff?r1=1.70&r2=1.71)

Browse pgsql-committers by date

  From Date Subject
Next Message Bruce Momjian 2007-02-21 22:15:21 pgsql: Move increase FSM warning to after lazy_truncate_heap() because
Previous Message Bruce Momjian 2007-02-21 19:48:02 pgsql: Update FAQ about minor updates.