Wrong Assert in PageIndexMultiDelete?

Started by Anastasia Lubennikovaover 10 years ago3 messages
#1Anastasia Lubennikova
lubennikovaav@gmail.com

Hi, hackers!

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&gt; function.

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

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

--
Best regards,
Lubennikova Anastasia

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Anastasia Lubennikova (#1)
Re: Wrong Assert in PageIndexMultiDelete?

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&gt; function.

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

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

#3Heikki Linnakangas
hlinnaka@iki.fi
In reply to: Tom Lane (#2)
Re: Wrong Assert in PageIndexMultiDelete?

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&gt; function.

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

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

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers