Updated on 2025-05-29 GMT+08:00

Log Replay

recovery_time_target

Parameter description: Specifies the flow control threshold for the standby node to complete log writing and replay. If the expected replay completion time of the standby node is greater than the value of this parameter, the primary node triggers log flow control and reduces the rate at which the primary node sends logs to the standby node.

Parameter type: Integer

Unit: second

Value range: 0 to 3600

  • 0: Log flow control is disabled.
  • 1 to 3600: The standby node can write and replay logs within the period specified by the value, so that the standby node can quickly assume the primary role.

Default value: 60

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is too small, the performance of the primary node will be affected. For example, if this parameter is set to 10, there is a delay in replaying logs on the standby node compared with receiving logs on the standby node and the maximum delay is 10s. If the delay exceeds 10s, the primary node cannot send logs to the standby node, which affects the performance of the primary node. In primary and standby scenarios, transactions on the primary node can be committed only after logs on the standby node are flushed to disks. In this case, transaction execution on the primary node is restricted, affecting performance. If the value is too large, the flow control does not take effect. After flow control is disabled, the RTO/RPO may increase.

recovery_max_workers

Parameter description: Specifies the maximum number of parallel replayer threads. This parameter takes effect only when both recovery_parse_workers and recovery_redo_workers are set to 1.

Parameter type: Integer

Unit: None

Value range: 0 to 20

Default value: 4 (For better performance, the default value in tool installation is 4.)

Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If this parameter is set to a large value, the CPU and memory resources will be insufficient, reducing the replay speed.

recovery_parallelism

Parameter description: Queries the actual number of parallel replayer threads.

Parameter type: Integer

Unit: None

Value range: 1 to 165

Default value: 4

Setting method: This is a POSTMASTER parameter and cannot be modified. If any of the recovery_max_workers, recovery_parse_workers, and recovery_redo_workers parameters is modified, recover_parallelism is recalculated.

Setting suggestion: This parameter is read-only and cannot be modified.

Risks and impacts of improper settings: none

queue_item_size

Parameter description: Specifies the maximum length of the task queue of each redo replayer thread.

Parameter type: Integer

Unit: None

Value range: 1 to 65535

Default value: 560

Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is too large, a large number of system resources will be occupied.

recovery_parse_workers

Parameter description: Specifies the number of ParseRedoRecord threads for the ultimate RTO feature.

  1. In addition, it must be used together with recovery_redo_workers. If recovery_parse_workers or recovery_redo_workers is greater than 1, ultimate RTO is enabled. If you do not want to enable ultimate RTO, retain the default value 1 of recovery_parse_workers.
  2. Ensure that the value of this parameter replication_type is set to 1 when ultimate RTO is enabled.
  3. If both the ultimate RTO and parallel replay are enabled at the same time, the ultimate RTO feature takes effect but the parallel replay feature does not take effect.
  4. Ultimate RTO does not support flow control. Flow control is determined by the parameter recovery_time_target.

Parameter type: Integer

Unit: None

Value range: 1 to 16

Default value: 1

Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Setting suggestion: For details about the values of recovery_parse_workers and recovery_redo_workers for different CPUs, memories, and deployment modes, see Table 1 Parameter settings for different CPUs, memory sizes, and deployment modes.

Risks and impacts of improper settings: If this parameter is set to a large value, the CPU and memory resources will be insufficient, reducing the replay speed.

After ultimate RTO is enabled, the total number of extra replayer threads started by the standby node = recovery_parse_workers x (recovery_redo_workers + 2) + 5. More replayer threads occupy more CPU, memory, and I/O resources. Set parameters based on the actual hardware configuration. If the parameter value is too large, the CPU and memory usage may be too high, causing system startup exceptions.

recovery_redo_workers

Parameter description: Specifies the number of PageRedoWorker threads corresponding to each ParseRedoRecord thread when the ultimate RTO feature is enabled. recovery_redo_workers must be used together with recovery_parse_workers. If recovery_parse_workers or recovery_redo_workers is greater than 1, ultimate RTO is enabled. If you do not want to enable ultimate RTO, retain the default value 1 of recovery_redo_workers.

Parameter type: Integer

Unit: None

Value range: 1 to 8

Default value: 1

Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Setting suggestion: For details about the values of recovery_parse_workers and recovery_redo_workers for different CPUs, memories, and deployment modes, see Table 1 Parameter settings for different CPUs, memory sizes, and deployment modes.

Risks and impacts of improper settings: If this parameter is set to a large value, the CPU and memory resources will be insufficient, reducing the replay speed.

Table 1 Parameter settings for different CPUs, memory sizes, and deployment modes

No.

Number of CPUs

Memory (GB)

Hybrid Deployment or Not

recovery_parse_workers

recovery_redo_workers

Number of Replayer Threads

Remarks

1

4

-

-

1

1

-

Ultimate RTO is not recommended.

2

8

-

Yes

1

1

-

Ultimate RTO is not recommended.

3

8

64

No

1

3

10

-

4

16

128

Yes

1

2

9

-

5

16

128

No

2

3

15

-

6

32

256

Yes

2

2

13

-

7

32

256

No

2

8

25

-

8

64

512

Yes

2

4

17

-

9

64

512

No

2

8

25

Set the parameter to the recommended value for larger hardware specifications.

10

96

768

-

2

8

25

Set the parameter to the recommended value for larger hardware specifications.

enable_page_lsn_check

Parameter description: Specifies whether to enable the data page LSN check. During replay, the current LSN of the data page is checked to see if it is the expected one.

Parameter type: Boolean

Unit: None

Value range:

  • on: The data page LSN check function is enabled.
  • off: The data page LSN check function is disabled.

Default value: on

Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If this parameter is disabled, data page errors may not be quickly detected, resulting in unexpected errors.

recovery_min_apply_delay

Parameter description: Specifies the replay delay of the standby node.

Parameter type: Integer

Unit: millisecond

Value range: 0 to 2147483647

Default value: 0 (no delay added)

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: See the notice below.

Risks and impacts of improper settings: See the notice below.

  • This parameter does not take effect on the primary node. It must be set on the standby node that requires a delay. You are advised to set this parameter on the asynchronous standby node. If the delay is set on the asynchronous standby node, the RTO will take a long time after the node is promoted to primary.
  • The delay time is calculated based on the transaction commit timestamp on the primary node and the current time on the standby node. Therefore, ensure that the clocks of the primary and standby nodes are synchronized.
  • If the delay time is too long, the disk where the Xlog file is located on the standby node may be full. Therefore, you need to set the delay time based on the disk size.
  • Operations without transactions are not delayed.
  • After the primary/standby switchover, if the original primary node needs to be delayed, you need to manually set this parameter.
  • When synchronous_commit is set to remote_apply, synchronous replication is affected by the delay. Each commit message is returned only after the replay on the standby node is complete.
  • hot_standby_feedback will be delayed due to using this feature, which may cause the primary node to expand. Therefore, you need to balance the risk when using both parameters.
  • If a DDL operation (such as DROP or TRUNCATE) that holds an AccessExclusive lock is performed on the primary node, the query operation on the operation object on the standby node will be returned only after the lock is released during the delayed replay of the record on the standby node.

dcf_truncate_dump_info_level

Parameter description: Specifies whether to print the LSN truncated by the DCF and the subsequent LSNs.

Parameter type: Integer

Unit: None

Value range: 0 to 2

  • 0: disabled.
  • 1: prints all LSNs truncated by the DCF (Xlogs whose LSN is greater than or equal to the truncated LSN).
  • 2: prints all LSNs truncated by the DCF and prints warning-level logs when the LSNs flushed to disks are greater than the truncated LSNs.

Default value: 1

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: Change the parameter value after fully understanding the parameter meaning and verifying it through testing.

redo_bind_cpu_attr

Parameter description: Specifies the core binding operation of the replayer thread. Only the SYSADMIN user can access this parameter.

Parameter type: String

Unit: None

Value range: a string of more than 0 characters. The value is case-insensitive.
  • 'nobind': The thread is not bound to a core.
  • 'nodebind: 1, 2': Use the CPU cores in NUMA groups 1 and 2 to bind threads.
  • 'cpubind: 0-30': Use the CPU cores 0 to 30 to bind threads.
  • 'cpuorderbind: 16-32': One thread is bound to one CPU core starting from core 16. If the number of cores in the range is insufficient, the remaining threads are not bound. You are advised to set the interval to a value greater than or equal to the value of recovery_parallelism plus 1.

Default value: 'nobind'

Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.

Setting suggestion: See the note below.

Risks and impacts of improper settings: The database node cannot be started.