Tom Lane wrote:
> Heikki Linnakangas <heikki(at)enterprisedb(dot)com> writes:
>> To see what's going on, I added some logs to the split code to print out
>> the free space on both halves as calculated by findsplitloc, and the
>> actual free space on the pages after split. I'm seeing a discrepancy of
>> 4 bytes on the right half; actual space free on right page after split
>> is 4 bytes less than anticipated.
> Hm, mis-counting the positions of itempointers maybe?
/* Count up total space in data items without actually scanning 'em */
dataitemtotal = rightspace - (int) PageGetFreeSpace(page);
This is 4 bytes off, because PageGetFreeSpace subtracts
sizeof(ItemIdData) from the actual free space on page. We could do
dataitemtotal = rightspace - ((int) PageGetFreeSpace(page)
but that again would be 4 bytes off in the other direction if there's 0
bytes left on the page :(.
IMHO the right fix is to modify PageGetFreeSpace not to do the
subtraction, it's a hack anyway, but that means we have to go through
and fix every caller of it. Or we can add a new PageGetReallyFreeSpace
function and keep the old one for compatibility. What do we want?
In response to
pgsql-hackers by date
|Next:||From: Simon Riggs||Date: 2007-01-26 15:39:59|
|Subject: Re: Implied Functional index use (redux)|
|Previous:||From: Tom Lane||Date: 2007-01-26 15:31:08|
|Subject: Re: BUG #2917: spi_prepare doesn't accept typename aliases |