May be BUG. Periodic burst growth of the checkpoint_req counter on replica. - Mailing list pgsql-hackers

From Anton A. Melnikov
Subject May be BUG. Periodic burst growth of the checkpoint_req counter on replica.
Date
Msg-id 99b2ccd1-a77a-962a-0837-191cdf56c2b9@inbox.ru
Whole thread Raw
Responses Re: May be BUG. Periodic burst growth of the checkpoint_req counter on replica.
List pgsql-hackers
Hello!

Found a periodic spike growth of the checkpoint_req counter on replica by 20-30 units
after large insert (~350Mb) on master.
Reproduction on master and replica with default conf:
1) execute the command "insert into test values (generate_series(1,1E7));".
This leads to the table's growth by about 350Mb during about 15 secs (on my pc).
2)The wal records start coming to the replica, and when their number exceeds a certain limit, a request is emitted to
thecheckpointer process to create restartpoint on the replica and checkpoint_req is incremented. With default settings,
thislimit is 42 segments.
 
3) Restartpoint creation fails because a new restartpoint can only be created if the replica has received new WAL
recordsabout the checkpoint from the moment of the previous restartpoint. But there were no such records.
 
4) When the next WAL segment is received by replica, the next request is generated to create a restartpoint on the
replica,and so on.
 
5) Finally, a WAL record about the checkpoint arrives on the replica, restartpoint is created and the growth of
checkpoint_reqstops.
 
The described process can be observed in the log with additional debugging. See insert_1E7_once.log attached. This
log is for v13 but master has the same behavior.

Can we treat such behavior as a bug?
If so it seems possible to check if a creating of restartpoint is obviously impossible before sending request and don't
sendit at all if so.
 

The patch applied tries to fix it.

With best regards.
-- 
Anton A. Melnikov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company
Attachment

pgsql-hackers by date:

Previous
From: Himanshu Upadhyaya
Date:
Subject: Re: HOT chain validation in verify_heapam()
Next
From: Amit Kapila
Date:
Subject: Re: [PATCH] Use indexes on the subscriber when REPLICA IDENTITY is full on the publisher