Thread: Wrong Assert in PageIndexMultiDelete?

Wrong Assert in PageIndexMultiDelete?

From
Anastasia Lubennikova
Date:
Hi, hackers!

I am trying to create new index access method.
And I found strange Assert in PageIndexMultiDelete function.


Is '<' sign is correct? I thougt it should be '<='.
Is it a bug or just my misunderstanding?

--
Best regards,
Lubennikova Anastasia

Re: Wrong Assert in PageIndexMultiDelete?

From
Tom Lane
Date:
Anastasia Lubennikova <lubennikovaav@gmail.com> writes:
> I am trying to create new index access method.
> And I found strange Assert in PageIndexMultiDelete
> <http://doxygen.postgresql.org/bufpage_8c_source.html#l00791> function.

> Assert
> <http://doxygen.postgresql.org/c_8h.html#a706ac5b1a53bd04067f81924b92cb9f6>(nitems
> < MaxIndexTuplesPerPage
> <http://doxygen.postgresql.org/itup_8h.html#adb7c94e95ce112eb47d71f7797604ddb>
> );

> Is '<' sign is correct? I thougt it should be '<='.
> Is it a bug or just my misunderstanding?

Hm, I think it's a bug.  It's probably not very significant because
MaxIndexTuplesPerPage is an overestimate (it doesn't account for index
special space), but it's wrong AFAICS.

That Assert hasn't been there very long, either --- seems to have been
added in 877b0887.  Heikki, did you have some specific reason for writing
it like that?
        regards, tom lane



Re: Wrong Assert in PageIndexMultiDelete?

From
Heikki Linnakangas
Date:
On 05/19/2015 07:15 PM, Tom Lane wrote:
> Anastasia Lubennikova <lubennikovaav@gmail.com> writes:
>> I am trying to create new index access method.
>> And I found strange Assert in PageIndexMultiDelete
>> <http://doxygen.postgresql.org/bufpage_8c_source.html#l00791> function.
>
>> Assert
>> <http://doxygen.postgresql.org/c_8h.html#a706ac5b1a53bd04067f81924b92cb9f6>(nitems
>> < MaxIndexTuplesPerPage
>> <http://doxygen.postgresql.org/itup_8h.html#adb7c94e95ce112eb47d71f7797604ddb>
>> );
>
>> Is '<' sign is correct? I thougt it should be '<='.
>> Is it a bug or just my misunderstanding?
>
> Hm, I think it's a bug.  It's probably not very significant because
> MaxIndexTuplesPerPage is an overestimate (it doesn't account for index
> special space), but it's wrong AFAICS.
>
> That Assert hasn't been there very long, either --- seems to have been
> added in 877b0887.  Heikki, did you have some specific reason for writing
> it like that?

No, it looks like a bug to me as well. Will fix...

- Heikki