From: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
---|---|
To: | Robert Haas <robertmhaas(at)gmail(dot)com> |
Cc: | Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>, Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: Cache Hash Index meta page. |
Date: | 2016-12-22 06:47:05 |
Message-ID: | CAA4eK1K2bMpS+pmZp5_TvVtftNPPdzTtw53FMANrky4K5Kn-5Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Wed, Dec 21, 2016 at 9:26 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
> On Tue, Dec 20, 2016 at 2:25 PM, Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com> wrote:
>> -- I think if it is okay, I can document same for each member of HashMetaPageData whether to read from cached from meta page or directly from current meta page. Below briefly I have commented for each member. If you suggest I can go with that approach, I will produce a neat patch for same.
>
> Plain text emails are preferred on this list.
>
> I don't have any confidence in this approach. I'm not sure exactly
> what needs to be changed here, but what you're doing right now is just
> too error-prone. There's a cached metapage available, and you've got
> code accessing directly, and that's OK except when it's not, and maybe
> we can add some comments to explain, but I don't think that's going to
> be good enough to really make it clear and maintainable. We need some
> kind of more substantive safeguard to prevent the cached metapage data
> from being used in unsafe ways -- and while we're at it, we should try
> to use it in as many of the places where it *is* safe as possible. My
> suggestion for a separate structure was one idea; another might be
> providing some kind of API that's always used to access the metapage
> cache. Or maybe there's a third option.
>
This metapage cache can be validated only when we have a bucket in
which we have stored the maxbucket value. I think what we can do to
localize the use of metapage cache is to write a new API which will
return a bucket page locked in specified mode based on hashkey.
Something like Buffer _hash_get_buc_buffer_from_hashkey(hashkey,
lockmode). I think this will make metpage cache access somewhat
similar to what we have in btree where we use cache to access
rootpage. Will something like that address your concern?
--
With Regards,
Amit Kapila.
EnterpriseDB: http://www.enterprisedb.com
From | Date | Subject | |
---|---|---|---|
Next Message | Kyotaro HORIGUCHI | 2016-12-22 07:02:23 | Re: BUG: pg_stat_statements query normalization issues with combined queries |
Previous Message | Craig Ringer | 2016-12-22 06:21:45 | Re: Logical decoding on standby |