Re: Remove extra includes of "access/xloginsert.h" when "access/xlog.h" is included

From: Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com>
To: Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove extra includes of "access/xloginsert.h" when "access/xlog.h" is included
Date: 2022-01-29 13:42:13
Message-ID: CALj2ACVcNy7=d3ReAY3koDoLJqRnyV4u2tP5vZUNPGKB87XaYA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 28, 2022 at 9:25 PM Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org> wrote:
>
> On 2022-Jan-28, Bharath Rupireddy wrote:
>
> > Hi,
> >
> > It seems like there are some instances where xloginsert.h is included
> > right after xlog.h but xlog.h has already included xloginsert.h.
> > Unless I'm missing something badly, we can safely remove including
> > xloginsert.h after xlog.h. Attempting to post a patch to remove the
> > extra xloginsert.h includes.
>
> Why isn't it better to remove the line that includes xloginsert.h in
> xlog.h instead? When xloginsert.h was introduced (commit 2076db2aea76),
> XLogRecData was put there so xloginsert.h was necessary for xlog.h; but
> now we have a forward declaration (per commit 2c03216d8311) so it
> doesn't seem needed anymore.

Removing the xloginsert.h in xlog.h would need us to add xloginsert.h
in more areas. And also, it might break any non-core extensions that
includes just xlog.h and gets xloginsert.h. Instead I prefer removing
xloginsert.h if there's xlog.h included.

Attaching v2 patch removing xloginsert.h in a few more places.

Regards,
Bharath Rupireddy.

Attachment Content-Type Size
v2-0001-remove-extra-includes-of-xloginsert.h-when-xlog.h.patch application/x-patch 6.2 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bharath Rupireddy 2022-01-29 14:30:53 Replace pg_controldata output fields with macros for better code manageability
Previous Message Michael Banck 2022-01-29 11:10:26 Re: [PATCH] New default role allowing to change per-role/database settings