Re: Cache Hash Index meta page.

From: Jesper Pedersen <jesper(dot)pedersen(at)redhat(dot)com>
To: Mithun Cy <mithun(dot)cy(at)enterprisedb(dot)com>
Cc: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>, Jeff Janes <jeff(dot)janes(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Subject: Re: Cache Hash Index meta page.
Date: 2016-09-08 17:51:28
Message-ID: 9bea3f00-2d3d-96a7-70db-e198c85caa37@redhat.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 09/05/2016 02:50 PM, Mithun Cy wrote:
> On Sep 2, 2016 7:38 PM, "Jesper Pedersen" <jesper(dot)pedersen(at)redhat(dot)com>
> wrote:
>> Could you provide a rebased patch based on Amit's v5 ?
>
> Please find the the patch, based on Amit's V5.
>
> I have fixed following things
>
> 1. now in "_hash_first" we check if (opaque->hasho_prevblkno ==
> InvalidBlockNumber) to see if bucket is from older version hashindex and
> has been upgraded. Since as of now InvalidBlockNumber is one value greater
> than maximum value the variable "metap->hashm_maxbucket" can be set (see
> _hash_expandtable). We can distinguish it from rest. I tested the upgrade
> issue reported by amit. It is fixed now.
>
> 2. One case which buckets hasho_prevblkno is used is where we do backward
> scan. So now before testing for previous block number I test whether
> current page is bucket page if so we end the bucket scan (see changes in
> _hash_readprev). On other places where hasho_prevblkno is used it is not
> for bucket page, so I have not put any extra check to verify if is a bucket
> page.
>

I think that the

+ pageopaque->hasho_prevblkno = metap->hashm_maxbucket;

trick should be documented in the README, as hashm_maxbucket is defined
as uint32 where as hasho_prevblkno is a BlockNumber.

(All bucket variables should probably use the Bucket definition instead
of uint32).

For the archives, this patch conflicts with the WAL patch [1].

[1]
https://www.postgresql.org/message-id/CAA4eK1JS%2BSiRSQBzEFpnsSmxZKingrRH7WNyWULJeEJSj1-%3D0w%40mail.gmail.com

Best regards,
Jesper

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2016-09-08 18:01:18 Re: Default make target in test modules
Previous Message Tom Lane 2016-09-08 17:44:50 Re: Default make target in test modules