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: seconds
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. If the value is greater than 1, the parallel replay mode is used.
- This parameter takes effect only when both recovery_parse_workers and recovery_redo_workers are set to 1, that is, the ultimate RTO is disabled.
- This parameter does not take effect when recovery_parse_workers or recovery_redo_workers is greater than 1, that is, ultimate RTO is enabled.
Parameter type: integer.
Unit: none
Value range: 0 to 20
Default value:
- For the 8-core CPU/64 GB memory specification in hybrid deployment mode, the default value is 1.
- For all specifications in independent deployment mode and other specifications in hybrid deployment mode, the default value 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 2147483647
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.
enable_parallel_reader
Parameter description: Specifies whether to enable the new ultimate RTO framework.
- This parameter must be used together with recovery_readers, recovery_redo_workers, recovery_parse_workers and recovery_undo_workers.
- Before enabling the new ultimate RTO framework, ensure that the value of replication_type is 1.
- For details about how to enable the new ultimate RTO framework, see Table 1.
Table 1 Enabling the new ultimate RTO framework Parameter/Mode
Parallel Replay
Ultimate RTO
New Ultimate RTO Framework
1
recovery_parse_workers>1
Or,
recovery_redo_workers>1
recovery_parse_workers>1
Or,
recovery_redo_workers>1
1
off
NOTE:If enable_parallel_reader is set to on, the system automatically changes the value to off in the memory. In this case, this parameter does not take effect.
off
on
Parameter type: Boolean
Unit: none
Value range:
- on: The new ultimate RTO framework is enabled.
- off: The new ultimate RTO framework is disabled.
Default value: off
Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Setting suggestion: You are advised not to enable this function if the number of CPU cores is less than 256.
Risks and impacts of improper settings: If the number of CPU cores is less than 256, enabling the new ultimate RTO framework may cause the cluster to fail to start.
recovery_readers
- recovery_readers must be used together with enable_parallel_reader, recovery_redo_workers, recovery_parse_workers and recovery_undo_workers. If you do not want to enable the new ultimate RTO framework, set recovery_readers to 1.
- If enable_parallel_reader is set to on and the ultimate RTO is enabled, the value of recovery_readers must be greater than 1. If enable_parallel_reader is set to on, recovery_readers is set to 1, and the value of recovery_parse_workers or recovery_redo_workers is greater than 1, the system changes the value of enable_parallel_reader to false in the memory.
Parameter type: integer
Unit: none
Value range: 1 to 50
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_readers, recovery_undo_workers, recovery_parse_workers, and recovery_redo_workers in different CPU, memory, and deployment modes, see Table 3.
Risks and impacts of improper settings: The readpage thread has its own item for parsing Xlogs. Each time a readpage thread is added, the corresponding memory consumption increases. As services increase, if items are insufficient, item initialization will continuously happen, causing memory usage to increase. The number of items is limited. When the number of items reaches the upper limit, the memory usage does not increase significantly. However, due to operations such as ultra-large transactions may cause memory bloat of an item. Therefore, the memory usage may still increase after the number of items reaches the upper limit. Setting this parameter to a large value may cause high CPU and memory usage, which can reduce the replay speed or cause the replay to be suspended.
The new ultimate RTO framework has memory requirements. During startup, the system checks the configured values of max_process_memory and shared_buffer and calculates the maximum number of readers supported by this parameter. If the configured value of recovery_readers is greater than the calculated number of readers, the value of recovery_readers in the memory will be changed to the calculated number of readers.
parallel_max_item_count
Parameter description: Specifies the maximum number of redo items that can be used by a single readpage thread in the new ultimate RTO framework. This parameter takes effect only when the new ultimate RTO framework is used, that is, when enable_parallel_reader is set to on.
Parameter type: integer.
Unit: none
Value range: 40000 to 400000
Default value: 60000
Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Set this parameter by referring to Table 3.
Risks and impacts of improper settings: The readpage thread has its own item for parsing Xlogs. Each time a readpage thread is added, the corresponding memory consumption increases. As services increase, if items are insufficient, item initialization will continuously happen, causing memory usage to increase. The number of items is limited. When the number of items reaches the upper limit, the memory usage does not increase significantly. However, due to operations such as ultra-large transactions may cause memory bloat of an item. Therefore, the memory usage may still increase after the number of items reaches the upper limit. If the value is too large, CPU and memory resources will be insufficient, causing the replay performance to deteriorate. If the value is too small, the replay performance will be affected. You are advised not to set this parameter to a value less than 100000. If the replay performance is affected due to a small value, increase the value based on the actual machine configuration.
The new ultimate RTO framework has memory requirements. During startup, the system checks the configured values of max_process_memory and shared_buffer and calculates the maximum number of readers supported by this parameter. If the configured value of recovery_readers is greater than the calculated number of readers, the value of recovery_readers in the memory will be changed to the calculated number of readers.
recovery_undo_workers
Parameter description: Specifies the number of undo threads in the new ultimate RTO framework.
recovery_undo_workers must be used together with enable_parallel_reader, recovery_redo_workers, recovery_parse_workers and recovery_readers. If you do not want to enable the new ultimate RTO framework, set recovery_undo_workers to 1.
Parameter type: integer
Unit: none
Value range: 1 to 50
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_readers, recovery_undo_workers, recovery_parse_workers, and recovery_redo_workers in different CPU, memory, and deployment modes, see Table 3.
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_parse_workers
Parameter description: Specifies the number of ParseRedoRecord threads in the ultimate RTO feature.
- It must be used together with recovery_redo_workers. If the value of recovery_parse_workers or recovery_redo_workers is greater than 1, ultimate RTO is enabled. If you do not want to enable ultimate RTO, set recovery_parse_workers to 1.
- Ensure that the value of the parameter replication_type is set to 1 when ultimate RTO is enabled.
- If both ultimate RTO and parallel replay are enabled, the ultimate RTO feature takes effect but the parallel replay feature does not take effect.
Parameter type: integer.
Unit: none
Value range: 1 to 16
Default value:
- Independent deployment:
2 (128-core CPU/1024 GB memory, 60-core CPU/480 GB memory, 32-core CPU/256 GB memory, 16-core CPU/128 GB memory); 1 (8-core CPU/64 GB memory, 4-core CPU/32 GB memory, 4-core CPU/16 GB memory)
Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Set recovery_parse_workers and recovery_redo_workers based on the CPU, memory, and deployment mode by referring to Table 2.
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 × (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. In hybrid deployment scenarios, host performance may be affected.
- In the new ultimate RTO framework, the value of recovery_parse_workers ranges from 2 to 16. In this mode, if recovery_parse_workers is set to 1, the system automatically sets it to 2 in the memory.
recovery_redo_workers
Parameter description: Specifies the number of PageRedoWorker threads corresponding to each ParseRedoRecord thread in the ultimate RTO feature. 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:
- Ultimate RTO: 1 to 8
- New ultimate RTO framework: 1 to 50
In ultimate RTO mode, if the value is greater than 8, the value is automatically changed to 8 in the memory.
Default value:
- Independent deployment:
8 (128-core CPU/1024 GB memory, 60-core CPU/480 GB memory, 32-core CPU/256 GB memory); 3 (16-core CPU/128 GB memory, 8-core CPU/64 GB memory); 1 (4-core CPU/32 GB memory, 4-core CPU/16 GB memory)
Setting method: This is a POSTMASTER parameter. Set it based on instructions provided in Table 1.
Setting suggestion: Set recovery_parse_workers and recovery_redo_workers based on the CPU, memory, and deployment mode by referring to Table 2 and Table 3.
| 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 | Value of recovery_max_workers | Ultimate RTO is not recommended. |
| 2 | 8 | - | Yes | 1 | 1 | Value of recovery_max_workers | 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 | Systems with larger hardware specifications should also use this recommended value. |
| 10 | 96 | 768 | - | 2 | 8 | 25 | Systems with larger hardware specifications should also use this recommended value. |
| No. | Number of CPUs | Memory (GB) | Hybrid Deployment or Not | recovery_readers | recovery_undo_workers | recovery_parse_workers | recovery_redo_workers | parallel_max_item_count | Number of Replayer Threads | Remarks |
|---|---|---|---|---|---|---|---|---|---|---|
| 1 | <256 | - | - | - | - | - | - | - | - | The new ultimate RTO framework is not recommended. |
| 2 | 256 | 2048 | No | 40 | 30 | 3 | 50 | 400000 | 174 | - |
- When the new ultimate RTO framework is enabled, you are advised to set the following parameters:
- redo_bind_cpu_attr='cpuorderbind:0-255'
- standby_recycle_interval=1
- base_page_saved_interval=2000
- pagewriter_sleep=1000
- pagewriter_thread_num=6
- max_io_capacity=3GB
- In the new ultimate RTO framework, if the replay speed decreases, run the following command to check the buffer status:
select * from dbe_perf.global_candidate_status;
If the value in the candidate_slot column is small, there are few clean pages in the buffer. If the value in the get_buf_clock_sweep column is large, worker threads are evicting pages by themselves. In this case, you can increase the value of shared_buffer to increase the number of buffers or improve the disk performance to accelerate the replay speed.
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.
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.
promote_lsn_check
Parameter description: Specifies whether to verify the integrity of local log replay when the standby node is promoted to primary after replay.
Parameter type: Boolean.
Unit: none
Value range:
- on: The local log replay verification mechanism is enabled.
- off: The local log replay verification mechanism is disabled.
Default value: on
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 this parameter is disabled, promoting to primary in advance due to log faults may not be intercepted, causing data loss risks.
recovery_min_apply_delay
Parameter description: Specifies the replay delay of the standby node.
Parameter type: integer.
Unit: milliseconds
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.
- After a DDL operation (such as DROP or TRUNCATE) that holds an AccessExclusive lock is performed on an object on the primary node, if the object is queried on the standby node during the delayed replay of the record on the standby node, it will be returned only after the lock is released.
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
- "autobind": The log replayer thread is automatically bound to a NUMA group. By default, the log replayer thread is bound to the last NUMA group. This parameter is valid only for Arm servers. Cores are not bound for x86 servers and small-specification servers.
- "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: "autobind"
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.
- This parameter is used for core binding in the Arm environment. You are advised to bind all replayer threads to the same NUMA group for better performance. In hybrid deployment scenarios, you are advised to bind the replayer threads of different nodes on the same host to different NUMA groups. If the parameters related to NUMA core binding are used in a non-Arm environment, the cluster will fail to be started.
- The core binding range specified by this parameter must be different from the core binding range specified by the thread_pool_attr parameter.
enable_wal_page_header_crc
Parameter description: Specifies whether to perform CRC calculation, value assignment, and verification on the WAL page header.
Parameter type: Boolean.
Unit: none
Value range:
- on: CRC calculation, value assignment, and verification are enabled on the WAL page header.
- off: CRC calculation, value assignment, and verification are disabled on the WAL page header.
Default value: on
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 this parameter is disabled, the system may fail to check whether the WAL page header is correct. As a result, the standby node receives incorrect WALs and fails to replay and synchronize the WALs.
What is your overall rating for this page?
Thank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot