Help Center/ GaussDB/ Developer Guide(Distributed_8.x)/ Configuring GUC Parameters/ GUC Parameters/ Read Parameters of the Standby Node in a Distributed System
Updated on 2024-06-03 GMT+08:00

Read Parameters of the Standby Node in a Distributed System

enable_standby_read

Parameter description: Specifies whether to enable the read function of the standby node for a session. This is a USERSET parameter. Set it based on instructions provided in Table 1.

Value range: Boolean

  • on indicates that the read function of the standby node in a distributed system is enabled for the session.
  • off indicates that the read function of the standby node in a distributed system is disabled for the session.

Default value: off

  • This function can be enabled only in GTM-free mode, non-transaction block, and hot-standby mode.
  • This parameter can be set only at the session level and cannot be set using gs_guc.
  • If this parameter is set at a non-session level (for example, manually enabling this parameter in the configuration file), the cluster cannot be started when a parameter conflict occurs. If no parameter conflict occurs, the read function of the standby node in a distributed system is also enabled for background threads such as autovacuum and WorkloadMonitor. As a result, DDL and DML operations are affected and errors are reported.
  • This parameter can be set only at the session level and cannot be set using gs_guc set\reload. If this parameter is enabled in the configuration file, the restart fails.

enable_direct_standby_datanodes

Parameter description: Specifies whether to enable the EXECUTE DIRECT ON extension capability for a session. After this parameter is set, the EXECUTE DIRECT ON statement can be used to connect to any standby DN or all standby DNs in a shard for query. For details, see the EXECUTE DIRECT ON syntax parameters. This parameter is used to control whether to enable EXECUTE DIRECT ON to perform the connection behavior in the distributed standby node read scenario. This function is mainly used for WDR, database test, and O&M. You are advised not to enable this function in other scenarios.

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

Value range: Boolean

  • on/true indicates that EXECUTE DIRECT ON is enabled for the session to support distributed standby node query.
  • off/false indicates that EXECUTE DIRECT ON is disabled for the session to support distributed standby node query.

Default value: off

  • This function can be enabled only in GTM-free mode, non-transaction block, and hot-standby mode.
  • This parameter can be set only at the session level and cannot be set using gs_guc set\reload. If this parameter is enabled in the configuration file, the restart fails.
  • In the same session, an error is reported if set enable_direct_standby_datanodes = on is set after set enable_standby_read = on is set. An error is also reported if set enable_standby_read = on is set after set enable_direct_standby_datanodes = on is set.
  • After this parameter is enabled, the current session is read-only, and DDL and DML jobs are affected and errors are reported.
  • After this parameter is enabled, you can use EXECUTE DIRECT ON to query only system DFX information such as system views, system functions, and system catalogs. Common user tables cannot be queried.
  • After the enable_direct_standby_datanodes parameter is enabled, EXECUTE DIRECT ON supports distributed standby node query. Before using this function during the upgrade, ensure that the CN and DN instance processes have been replaced with the latest binary files. Otherwise, packet verification fails and an error is reported.

standby_read_delay

Parameter description: Specifies the maximum difference between the primary and standby nodes when data is read from the standby node. If the difference exceeds the value of this parameter, data cannot be read from the standby node. This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from –1 to INT_MAX. The unit is ms. –1 indicates that the difference between the primary and standby nodes does not need to be verified when data is read from the standby node. 0 indicates that data is read from the standby node only when there is no difference between the primary and standby nodes.

Default value: 10000000

standby_read_rto

Parameter description: Specifies the maximum RTO of the system when data is read from the standby node. If the RTO exceeds the value of this parameter, data cannot be read from the standby node. This is a SIGHUP parameter. Set it based on instructions provided in Table 1.

Value range: an integer ranging from –1 to INT_MAX. The unit is ms. The value –1 indicates that the system RTO verification is not required when data is read from the standby node. The value 0 indicates that data is read from the standby node only when the RTO of at least one standby node is 0.

Default value: 60000.