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

Primary Node

synchronous_standby_names

Parameter description: Specifies a comma-separated list of names of potential standby nodes that support synchronous replication.

Parameter type: string.

Unit: none

  • The current synchronous standby node is on the top of the list. If the current synchronous standby node is disconnected, it will be replaced immediately with the next-highest-priority standby node. Name of the next-highest-priority standby node is added to the list.
  • The standby node name can be specified by setting the environment variable PGAPPNAME.
Value range: If this parameter is set to *, the name of any standby node that provides synchronous replication is matched. The value can be configured in the following format:
  • ANY num_sync (standby_name [, ...])
  • [FIRST] num_sync (standby_name [, ...])
  • standby_name [, ...]
    • In the preceding command, num_sync indicates the number of standby nodes that need to wait for responses from the transaction, standby_name indicates the name of the standby node, and FIRST and ANY specify the policies for selecting standby nodes for synchronous replication from the listed servers.
    • ANY N (dn_instanceId1, dn_instanceId2,...) indicates that any N host names in the brackets are selected as the name list of standby nodes for synchronous replication. For example, ANY 1(dn_instanceId1, dn_instanceId2) indicates that either of dn_instanceId1 or dn_instanceId2 is used as the standby node for synchronous replication.
    • FIRST N (dn_instanceId1, dn_instanceId2, ...) indicates that the first N primary node names in the brackets are selected as the standby node name list for synchronous replication based on the priority. For example, FIRST 1 (dn_instanceId1, dn_instanceId2) indicates that dn_instanceId1 is selected as the standby node for synchronous replication.
    • The meanings of dn_instanceId1, dn_instanceId2, ... are the same as those of FIRST 1 (dn_instanceId1, dn_instanceId2, ...).

This parameter is maintained by the CM. If it is manually modified, data may be lost. For details, see "Unified Cluster Management Tool > Features > Automatic Copy Addition and Reduction by Shard > Remarks" in Tool Reference.

If you use the gs_guc tool to set this parameter, perform the following operations:

gs_guc reload -Z datanode -N @NODE_NAME@ -D @DN_PATH@ -c "synchronous_standby_names='ANY 1(dn_instanceId1, dn_instanceId2)'"

or

gs_guc reload -Z datanode -N @NODE_NAME@ -D @DN_PATH@ -c "synchronous_standby_names='ANY 1(AZ1, AZ2)'"

Default value: *

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 synchronization standby list is incorrect, the primary and standby synchronization majority protocol becomes invalid.

most_available_sync

Parameter description: Specifies whether to block the primary node when the primary-standby synchronization fails.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The primary node is not blocked when the synchronization fails.
  • off: The primary node is blocked when the synchronization fails.

Default value: off (In the two-copy scenario, that is, one primary node and one standby node, the default value of the DN is on.)

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

Setting suggestion: After this function is enabled, the primary node does not wait for the standby node to commit for verification. If the host is in the single-primary state, the committing is successful, not the majority write is successful.

Risks and impacts of improper settings: Customers need to exercise caution when enabling this function based on their application scenarios.

enable_stream_replication

Parameter description: Specifies whether data and logs are synchronized between the primary and standby nodes.

  • This parameter is used for testing performance with standby DNs and without standby DNs. If this parameter is set to off, tests on abnormal scenarios, such as switchover and faults, cannot be performed to prevent inconsistency between the primary and standby nodes.
  • This is a restricted parameter, and you are advised not to set it to off in normal service scenarios.

Parameter type: Boolean.

Unit: none

Value range:

  • on: Synchronization between the primary and standby nodes is enabled.
  • off: Synchronization between the primary and standby nodes 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, the multi-copy capability of the cluster will be unavailable, reducing availability and causing backup failures. Therefore, you are advised not to disable this parameter.

enable_mix_replication

Parameter description: Specifies how WAL files and data are replicated between the primary and standby nodes.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The WAL file and data page mixed replication mode is enabled.
  • off: The WAL file and data page mixed replication mode is disabled.

Default value: off

Setting method: This parameter is a POSTMASTER parameter. Its default value is off and cannot be modified.

Setting suggestion: Retain the default value. This parameter cannot be modified in normal service scenarios. That is, the WAL file and data page mixed replication mode is disabled by default.

Risks and impacts of improper settings: Change the parameter value after you fully understand the parameter meaning and test the parameter.

data_replicate_buffer_size

Parameter description: Specifies the amount of memory used by queues when the sender sends data pages to the receiver. The value of this parameter affects the buffer size used during the replication from the primary node to the standby node.

Parameter type: integer.

Unit: KB

Value range: 4096 to 1072693248

Default value: 128MB (that is, 131072 KB)

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

Setting suggestion: Retain the default value. Do not set this parameter to an excessively large or small value. The following condition must be met: data_replicate_buffer_size + segment_buffers + shared_buffers + wal_buffers + temp_buffers + maintenance_work_mem + work_mem + query_mem + wal_receiver_buffer_size (standby node) < max_process_memory < Memory size of the physical machine.

Risks and impacts of improper settings: If the value of the memory parameter is too large and exceeds the upper limit of the physical memory, the database cannot be started because it cannot apply for sufficient memory.

walsender_max_send_size

Parameter description: Specifies the size of the log or data sending buffer on the primary node.

Parameter type: integer.

Unit: KB

Value range: 8 to 2147483647

Default value: 8192 (8 MB)

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, too much memory is occupied. If the value is too small, the synchronization performance between the primary and standby nodes deteriorates.

enable_data_replicate

Parameter description: Specifies the data synchronization mode between the primary and standby nodes when a row-store table is imported.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The primary and standby nodes synchronize data using data pages when the data is imported to a row-store table. When replication_type is set to 1, this parameter cannot be set to on. If this parameter is set to on using the GUC tool, its value will be forcibly changed to off.
  • off: The primary and standby nodes synchronize data using Xlogs when the data is imported to a row-store table.

Default value: off

Setting method: This is a USERSET 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 you fully understand the parameter meaning and test the parameter.

ha_module_debug

Parameter description: Specifies the replication status log of a specific data block during data replication.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The status of each data block is recorded in logs during data replication.
  • off: The status of each data block is not recorded in logs during data replication.

Default value: off

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

Setting suggestion: Printing logs occupies unnecessary disk, CPU, and I/O bandwidth. Therefore, you are advised not to enable this function.

Risks and impacts of improper settings: Change the parameter value after you fully understand the parameter meaning and test the parameter.

catchup2normal_wait_time

Parameter description: Specifies the maximum duration that the primary node is blocked during the data catchup on the standby node in the case of a single synchronous standby node.

Parameter type: integer.

Unit: millisecond

Value range: –1 to 10000

  • The value –1 indicates that the primary node is blocked until the data catchup on the standby node is complete.
  • The value 0 indicates that the primary node is not blocked during the data catchup on the standby node.
  • A positive integer indicates the maximum duration that the primary node is blocked during the data catchup on the standby node. For example, if this parameter is set to 5000, the primary node is blocked until the data catchup on the standby node is complete in 5s.

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 you fully understand the parameter meaning and test the parameter.

sync_config_strategy

Parameter description: Specifies the policy for synchronizing configuration files between the primary node and standby node, and between the standby node and cascaded standby node.

If this parameter is configured after an upgrade from a version earlier than 503.0.0 to 503.0.0, this parameter cannot be identified after a rollback. Do not set this parameter during the upgrade to 503.0.0.

Parameter type: enumerated type.

Unit: none

Value range:

  • all_node: If this parameter is set to all_node for the primary node, the primary node is allowed to proactively synchronize configuration files to all standby nodes. If this parameter is set to all_node for a standby node, the standby node is allowed to send synchronization requests to its primary node, and the standby node is allowed to proactively synchronize configuration files to all cascaded standby nodes. If this parameter is set to all_node for a cascaded standby node, the current cascaded standby node is allowed to send synchronization requests to its standby node.
  • only_sync_node: If this parameter is set to only_sync_node for the primary node, the primary node is only allowed to proactively synchronize configuration files to all standby nodes. If this parameter is set to only_sync_node for a standby node, the standby node is allowed to send synchronization requests to its primary node, and the standby node is not allowed to proactively synchronize configuration files to all cascaded standby nodes. If this parameter is set to only_sync_node for a cascaded standby node, the current cascaded standby node is allowed to send synchronization requests to its standby node.
  • none_node: If this parameter is set to none_node for the primary node, the primary node is not allowed to proactively synchronize configuration files to all standby nodes. If this parameter is set to none_node for a standby node, the standby node is not allowed to send synchronization requests to its primary node, and the standby node is allowed to proactively synchronize configuration files to all cascaded standby nodes. If this parameter is set to none_node for a cascaded standby node, the current cascaded standby node is not allowed to send synchronization requests to its standby node.

Default value: all_node

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

Setting suggestion: After this function is disabled, the primary node stops synchronizing GUC parameters to the standby node. In this case, exercise caution when setting this parameter to a value other than all_node.

Risks and impacts of improper settings: If this parameter is set to none_node, GUC parameters will not be synchronized between the primary and standby nodes. In this case, exercise caution when setting this parameter.

hadr_recovery_time_target

Parameter description: Specifies whether the standby database instance completes log writing and replay in streaming DR mode.

Parameter type: integer.

Unit: second

Value range: 0 to 3600

  • 0 indicates that log flow control is disabled.
  • 1 to 3600 indicates that the standby node can write and replay logs within the time specified by hadr_recovery_time_target. This ensures that logs can be written and replayed within the time specified by hadr_recovery_time_target during the switchover between the primary and standby database instances. In this case, the standby database instance can be quickly switched to the primary database instance.

Default value: 60 (financial edition (data computing))

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1. The value cannot contain a unit.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is too small, frequent flow control will affect host performance. If the value is too large or the parameter is disabled, the RTO of the standby node will exceed the expectation if the standby node does not replay data in a timely manner. As a result, the RTO and RPO of HA will be decreased.

hadr_recovery_point_target

Parameter description: Specifies the RPO time allowed for the standby database instance to flush logs to disks in streaming DR mode.

Parameter type: integer.

Unit: second

Value range: 0 to 3600

  • 0 indicates that log flow control is disabled.
  • 1 to 3600 indicates that the standby node can flush logs to disks within the time specified by hadr_recovery_point_target. This ensures that logs can be replayed within the time specified by hadr_recovery_point_target during the switchover between the primary and standby database instances. In this case, the standby database instance is switched to primary.

Default value: 10 (financial edition (data computing))

Setting method: This is a SIGHUP parameter. Set it based on instructions provided in Table 1. The value cannot contain a unit.

Setting suggestion: Retain the default value.

Risks and impacts of improper settings: If the value is too small, frequent flow control will affect host performance. If the value is too large or the parameter is disabled, the RTO of the standby node will exceed the expectation if the standby node does not replay data in a timely manner. As a result, the RTO and RPO of HA will be decreased.

hadr_super_user_record_path

Parameter description: Specifies the path for storing encrypted files of the hadr_disaster user in the standby cluster in streaming DR mode.

Parameter type: string.

Unit: none

Value range: a string.

Default value: ""

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

Setting suggestion: The value is automatically set by the streaming DR password transfer tool and does not need to be manually added. You are advised not to change the value.

Risks and impacts of improper settings: If the settings are incorrect, the standby cluster status will be abnormal, and the primary cluster cannot be connected. As a result, data cannot be synchronized.

check_sync_standby

Parameter description: Specifies whether to check the standby node. After the synchronous_standby_names parameter is correctly configured in the primary and standby scenarios, if the synchronous standby node is faulty, the write service on the primary node reports a write failure.

  • This parameter cannot be synchronized in job work and autonomous transactions. Otherwise, the check may not take effect.
  • If the standby node check is not configured for a specified user or session and the standby node is faulty when the forcible synchronization commit mode is enabled, the write operation on a table causes the query on the same table by another user or in another session to hang. In this case, you need to recover the standby node or manually terminate the hung client.
  • The standby node check function cannot be enabled in scenarios (such as VACUUM ANALYZE and gs_clean) where non-write operations trigger log writing. If the standby node does not meet the requirements for synchronizing configurations to the standby node, services will be hung in this scenario. In this case, you need to manually terminate the services.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The standby node check is enabled.
  • off: The standby node check is disabled.

Default value: off

Setting method: This is a USERSET 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 you fully understand the parameter meaning and test the parameter.

enable_wal_sender_crc_check

Parameter description: Specifies whether to enable CRC for the WAL sender thread. CRC is performed before the primary node sends logs. If this parameter is enabled, the performance may deteriorate by less than 5%.

Parameter type: Boolean.

Unit: none

Value range:

  • on: The check function is enabled.
  • off: The check function is disabled.

Default value: on

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

Setting suggestion: This parameter ensures log validity. Determine whether to enable this function based on scenario requirements.

Risks and impacts of improper settings: Change the parameter value after you fully understand the parameter meaning and test the parameter.