Heikki Linnakangas <heikki@enterprisedb.com> writes:
> 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?
It'd probably be a good idea to take a look at each caller and see
whether it has a problem with that. I believe PageGetFreeSpace's
behavior is actually the right thing for many of 'em. The idea is that
subtracting the 4 bytes is often necessary and always safe/conservative
(but is that true in this case? We're overestimating dataitemtotal,
can that hurt us?). Is it worth changing each caller to try to account
exactly for those 4 bytes?
In short, I'm inclined to leave the function alone unless changing it
can be shown to be a win for most callers. Add a new function
(perhaps PageGetExactFreeSpace would be a better name).
Keep in mind also that we need a minimal-change version for
back-patching. If this is cleanup rather than bug fix, please
submit it separately.
regards, tom lane