Re: A spot of redundant initialization of brin memtuple

From: Richard Guo <guofenglinux(at)gmail(dot)com>
To: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: A spot of redundant initialization of brin memtuple
Date: 2021-11-22 03:23:42
Message-ID: CAMbWs49PbWJg3NbRbJ7ZA8epWeKphLUK21kje_vtOXspnLGq6Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Nov 20, 2021 at 12:23 AM Bharath Rupireddy <
bharath(dot)rupireddyforpostgres(at)gmail(dot)com> wrote:

> On Fri, Nov 19, 2021 at 1:13 PM Richard Guo <guofenglinux(at)gmail(dot)com>
> wrote:
> >
> > Happened to notice this when reading around the codes. The BrinMemTuple
> > would be initialized in brin_new_memtuple(), right after being created.
> > So we don't need to initialize it again outside.
> >
> > diff --git a/src/backend/access/brin/brin.c
> b/src/backend/access/brin/brin.c
> > index ccc9fa0959..67a277e1f9 100644
> > --- a/src/backend/access/brin/brin.c
> > +++ b/src/backend/access/brin/brin.c
> > @@ -1261,8 +1261,6 @@ initialize_brin_buildstate(Relation idxRel,
> BrinRevmap *revmap,
> > state->bs_bdesc = brin_build_desc(idxRel);
> > state->bs_dtuple = brin_new_memtuple(state->bs_bdesc);
> >
> > - brin_memtuple_initialize(state->bs_dtuple, state->bs_bdesc);
> > -
> > return state;
> > }
>
> Good catch. +1 for the change. Please submit a patch.
>

Thanks for the review. Attached is the patch.

Thanks
Richard

Attachment Content-Type Size
v1-0001-Remove-redundant-initialization-of-brin-memtuple.patch application/octet-stream 773 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message vignesh C 2021-11-22 04:28:59 Re: Failed transaction statistics to measure the logical replication progress
Previous Message Fujii Masao 2021-11-22 02:55:25 Re: Shouldn't postgres_fdw report warning when it gives up getting result from foreign server?