Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Mahendra Singh Thalor <mahi6run(at)gmail(dot)com>
Cc: Michael Paquier <michael(at)paquier(dot)xyz>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Can we remove extra memset in BloomInitPage, GinInitPage and SpGistInitPage when we have it in PageInit?
Date: 2021-04-07 01:01:19
Message-ID: CALj2ACVywyvgRUV2Z0r+31haCU4b4LU4mxjHujtM8trjAL_45g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Apr 7, 2021 at 12:07 AM Mahendra Singh Thalor
<mahi6run(at)gmail(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2021-04-07 01:15:39 Re: TRUNCATE on foreign table
Previous Message James Coleman 2021-04-07 00:39:57 Re: Binary search in ScalarArrayOpExpr for OR'd constant arrays