Re: pageinspect and hash indexes
От | Ashutosh Sharma |
---|---|
Тема | Re: pageinspect and hash indexes |
Дата | |
Msg-id | CAE9k0P=e=nT5Dscc93EnYbNmQNn-nJr1k43vm-xkQzOBKDzQjw@mail.gmail.com обсуждение исходный текст |
Ответ на | [HACKERS] pageinspect and hash indexes (Jeff Janes <jeff.janes@gmail.com>) |
Ответы |
Re: pageinspect and hash indexes
|
Список | pgsql-hackers |
>>>> Thanks for reviewing my patch. I have removed the extra white space. >>>> Attached are both the patches. >>> >>> Sorry, I have mistakenly attached wrong patch. Here are the correct >>> set of patches. >> >> The latest version of patches looks fine to me. > > I don't really like 0002. What about this, instead? > > --- a/contrib/pageinspect/hashfuncs.c > +++ b/contrib/pageinspect/hashfuncs.c > @@ -80,7 +80,8 @@ verify_hash_page(bytea *raw_page, int flags) > /* Check that page type is sane. */ > pagetype = pageopaque->hasho_flag & LH_PAGE_TYPE; > if (pagetype != LH_OVERFLOW_PAGE && pagetype != LH_BUCKET_PAGE && > - pagetype != LH_BITMAP_PAGE && pagetype != LH_META_PAGE) > + pagetype != LH_BITMAP_PAGE && pagetype != LH_META_PAGE && > + pagetype != LH_UNUSED_PAGE) > ereport(ERROR, > (errcode(ERRCODE_INVALID_PARAMETER_VALUE), > errmsg("invalid hash page type %08x", pagetype))); > > The advantage of that is (1) it won't get confused if in the future we > have an unused page that has some flag bit not in LH_PAGE_TYPE set, > and (2) if in the future we want to add any other checks to this > function which should apply to unused pages also, they won't get > bypassed by an early return statement. Agreed. Moreover, previous approach might even change the current behaviour of functions like hash_page_items() and hash_page_stats() basically when we pass UNUSED pages to these functions. Attached is the newer version of patch.
Вложения
В списке pgsql-hackers по дате отправления: