May be BUG. Periodic burst growth of the checkpoint_req counter on replica.
Anton A. Melnikov <aamelnikov@inbox.ru>
From: "Anton A. Melnikov" <aamelnikov@inbox.ru>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-09-06T11:02:53Z
Lists: pgsql-hackers
Attachments
- insert_1E7_once.log (text/x-log)
- v1-0001-Fix-burst-checkpoint_req-growth.patch (text/x-patch) patch v1-0001
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 the checkpointer process to create restartpoint on the replica and checkpoint_req is incremented. With default settings, this limit is 42 segments. 3) Restartpoint creation fails because a new restartpoint can only be created if the replica has received new WAL records about 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_req stops. 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 send it 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
Commits
-
Improve descriptions of some pg_stat_checkpoints functions in pg_proc.dat.
- 1909835c28a1 18.0 landed
-
docs: Enhance the pg_stat_checkpointer view documentation.
- a19f83f87966 18.0 landed
-
Add num_done counter to the pg_stat_checkpointer view.
- 559efce1d684 18.0 landed
-
docs: Improve the description of num_timed column in pg_stat_checkpointer.
- fa3a022136fc 17.0 landed
- a7c39db5eb34 18.0 landed
-
Improve documentation for pg_stat_checkpointer fields
- e820db5b56b2 17.0 landed
-
Enhance checkpointer restartpoint statistics
- 12915a58eec9 17.0 landed
-
Introduce pg_stat_checkpointer
- 96f052613f35 17.0 cited