Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit? - Mailing list pgsql-hackers

From Bharath Rupireddy
Subject Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?
Date
Msg-id CALj2ACVywyvgRUV2Z0r+31haCU4b4LU4mxjHujtM8trjAL_45g@mail.gmail.com
Whole thread Raw
In response to Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?  (Mahendra Singh Thalor <mahi6run@gmail.com>)
Responses Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Wed, Apr 7, 2021 at 12:07 AM Mahendra Singh Thalor
<mahi6run@gmail.com> wrote:
> +++ b/src/backend/storage/page/bufpage.c
> @@ -51,7 +51,7 @@ PageInit(Page page, Size pageSize, Size specialSize)
>      /* Make sure all fields of page are zero, as well as unused space */
>      MemSet(p, 0, pageSize);
>
> -    p->pd_flags = 0;
> +    /* p->pd_flags = 0;        done by above MemSet */
>
> I think, for readability we can keep old code here or we can remove
> new added comment also.

Setting p->pd_flags = 0; is unnecessary and redundant after memsetting
the page to zeros. Also, see the existing code for pd_prune_xid,
similarly I've done that for pd_flags. I think it's okay with /*
p->pd_flags = 0;        done by above MemSet */.

> Apart from this, all other changes looks good to me.

Thanks for taking a look at the patch.

With Regards,
Bharath Rupireddy.
EnterpriseDB: http://www.enterprisedb.com



pgsql-hackers by date:

Previous
From: James Coleman
Date:
Subject: Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays
Next
From: Bharath Rupireddy
Date:
Subject: Re: TRUNCATE on foreign table