Re: pageinspect: Hash index support

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pageinspect: Hash index support
Дата
Msg-id CAB7nPqTT3ZEm8QKsYYxfUnWL+P3p2mAbud7AFiZpK_JKx3eADA@mail.gmail.com
обсуждение исходный текст
Ответ на Re: pageinspect: Hash index support  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Ответы Re: pageinspect: Hash index support  (Jesper Pedersen <jesper.pedersen@redhat.com>)
Список pgsql-hackers
On Wed, Sep 21, 2016 at 9:21 PM, Jesper Pedersen
<jesper.pedersen@redhat.com> wrote:
> On 09/21/2016 07:24 AM, Ashutosh Sharma wrote:
> git apply w/ v4 works here, so you will have to investigate what happens on
> your side.

Works here as well.

>> I continued reviewing your v4 patch and here are some more comments:
>>
>> 1). Got below error if i pass meta page to hash_page_items(). Does
>> hash_page_items() accept only bucket or bitmap page as input?
>>
>> postgres=# SELECT * FROM hash_page_items(get_raw_page('hash_i4_index',
>> 0));
>> ERROR:  invalid memory alloc request size 18446744073709551593
>>
>
> page_stats / page_items should not be used on the metadata page.
>
> As these functions are marked as superuser only it is expected that people
> provides the correct input, especially since the raw page structure is used
> as the input.

btree functions use the block number to do some sanity checks. You
cannot do that here as only bytea functions are available, but you
could do it in verify_hash_page by looking at the opaque data and look
at LH_META_PAGE. Then add a boolean argument into verify_hash_page to
see if the caller expects a meta page or not and just issue an error.
Actually it would be a good idea to put in those safeguards, even if I
agree with you that calling those functions is at the risk of the
user... Could you update the patch in this sense?

I had fun doing the same tests, aka running the items and stats
functions on a meta page, and the meta function on a non-meta page,
but at my surprise I did not see a crash, so perhaps I was lucky and
perhaps that was because of OSX.
-- 
Michael



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Robert Haas
Дата:
Сообщение: Re: Hash Indexes
Следующее
От: Robert Haas
Дата:
Сообщение: Re: more parallel query documentation