Allow to specify replication delay by time.
authorTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 28 Jan 2022 01:39:21 +0000 (10:39 +0900)
committerTatsuo Ishii <ishii@sraoss.co.jp>
Fri, 28 Jan 2022 01:39:21 +0000 (10:39 +0900)
commit832212b23df061bec3ce18df83f0a853bfaf6593
tree458a79ea6207bb824150caaff2b2f8069e515359
parent9c5ab9831158cd6a38271f8db3bee7a505cdcd0f
Allow to specify replication delay by time.

delay_threshold specifies replication delay upper limit in bytes. Add
similar parameter called delay_threshold_by_time so that the limit can
be specified by time (seconds). The new parameter is effective if it is
greater than 0 and track_commit_timestamp (available in >> PostgreSQL
9.5 or after) is enabled. In this case "show pool_ndoes" and
pcp_node_info display the replication delay in seconds. If the
parameter is set to 0 or track_commit_timestamp is not enabled,
delay_threshold_by_time is ignored and falls back to delay_threshold
mode.

For this purpose new member standby_delay_by_time is added to shared
memory data Backendinfo to distinguish whether replication delay is
measured in byte (standby_delay_by_time == false) or seconds
(standby_delay_by_time = true). If standby_delay_by_time is true,
standby_delay is measured in second * 1000000, so that the precision
is 6 digits after decimal point.

Discussion: https://www.pgpool.net/pipermail/pgpool-hackers/2021-December/004081.html
13 files changed:
doc.ja/src/sgml/ref/pcp_node_info.sgml
doc.ja/src/sgml/stream-check.sgml
doc/src/sgml/ref/pcp_node_info.sgml
doc/src/sgml/stream-check.sgml
src/config/pool_config_variables.c
src/include/pcp/libpcp_ext.h
src/include/pool_config.h
src/libs/pcp/pcp.c
src/pcp_con/pcp_worker.c
src/protocol/pool_pg_utils.c
src/streaming_replication/pool_worker_child.c
src/tools/pcp/pcp_frontend_client.c
src/utils/pool_process_reporting.c