Re: May be BUG. Periodic burst growth of the checkpoint_req counter on replica.

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: "Anton A(dot) Melnikov" <a(dot)melnikov(at)postgrespro(dot)ru>, Alexander Korotkov <aekorotkov(at)gmail(dot)com>
Cc: Magnus Hagander <magnus(at)hagander(dot)net>, "Anton A(dot) Melnikov" <aamelnikov(at)inbox(dot)ru>, Andres Freund <andres(at)anarazel(dot)de>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: May be BUG. Periodic burst growth of the checkpoint_req counter on replica.
Date: 2024-09-18 18:04:28
Message-ID: 82f03b0b-00c6-42b4-95c7-f2eca7fed1ea@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2024/09/18 23:35, Anton A. Melnikov wrote:
> Fujii, Alexander thanks a lot!
>
> On 17.09.2024 05:47, Fujii Masao wrote:
>>
>> Regarding the patch:
>>                   if (do_restartpoint)
>>                       PendingCheckpointerStats.restartpoints_performed++;
>> +                else
>> +                    PendingCheckpointerStats.num_performed++;
>>
>> I expected the counter not to be incremented when a checkpoint is skipped,
>> but in this code, when a checkpoint is skipped, ckpt_performed is set to true,
>> triggering the counter increment. This seems wrong.
>
> Tried to fix it via returning bool value from the CreateCheckPoint()
> similarly to the CreateRestartPoint().
>
> And slightly adjusted the patch so that it could be applied after yours.

Thanks for updating the patch!

-void
+bool
CreateCheckPoint(int flags)

It would be helpful to explain the new return value in the comment
at the top of this function.

- CreateCheckPoint(flags);
- ckpt_performed = true;
+ ckpt_performed = CreateCheckPoint(flags);

This change could result in the next scheduled checkpoint being
triggered in 15 seconds if a checkpoint is skipped, which isn’t
the intended behavior.

-{ oid => '2769',
+{ oid => '6347',

I don't think that the existing functions need to be reassigned new OIDs.

Regards,

--
Fujii Masao
Advanced Computing Technology Center
Research and Development Headquarters
NTT DATA CORPORATION

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bertrand Drouvot 2024-09-18 18:47:07 Re: Add contrib/pg_logicalsnapinspect
Previous Message Fujii Masao 2024-09-18 17:21:40 Re: May be BUG. Periodic burst growth of the checkpoint_req counter on replica.