RE: Remove a redundant condition check

From: Ádám Balogh <adam(dot)balogh(at)ericsson(dot)com>
To: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: RE: Remove a redundant condition check
Date: 2020-06-26 10:43:48
Message-ID: VI1PR0702MB3663B1942DDB648995F067EB81930@VI1PR0702MB3663.eurprd07.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

-----Original Message-----
From: Amit Kapila <amit(dot)kapila16(at)gmail(dot)com>
Sent: 2020. június 26., péntek 11:09
To: Ádám Balogh <adam(dot)balogh(at)ericsson(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Remove a redundant condition check

>On Thu, Jun 25, 2020 at 11:23 PM Ádám Balogh <adam(dot)balogh(at)ericsson(dot)com> wrote:
>>
>>
>> A one line change to remove a duplicate check. This duplicate check was detected during testing my contribution to a static code analysis tool. There is no functional change, no new tests needed.
>
> Yeah, this duplicate check is added as part of commit b2a5545bd6. See below part of change.
>
> - /*
> - * If this record was a timeline switch, wake up any
> - * walsenders to notice that we are on a new timeline.
> - */
> - if (switchedTLI && AllowCascadeReplication())
> - WalSndWakeup();
> + /* Is this a timeline switch? */
> + if (switchedTLI)
> + {
> + /*
> + * Before we continue on the new timeline, clean up any
> + * (possibly bogus) future WAL segments on the old timeline.
> + */
> + RemoveNonParentXlogFiles(EndRecPtr, ThisTimeLineID);
> +
> + /*
> + * Wake up any walsenders to notice that we are on a new
> + * timeline.
> + */
> + if (switchedTLI && AllowCascadeReplication()) WalSndWakeup(); }
>
> It seems we forgot to remove the additional check for switchedTLI while adding a new check. I think we can remove this duplicate > > check in the HEAD code. I am not sure if it is worth to backpatch such a change.

Thank you for confirming it. I do not think it is worth to backpatch, it is just a readability issue.
Regards,

Ádám

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Ranier Vilela 2020-06-26 11:14:55 Re: Remove a redundant condition check
Previous Message Amul Sul 2020-06-26 10:39:47 Re: [Patch] ALTER SYSTEM READ ONLY