Node management interfaces v5
You can add and remove nodes dynamically using the SQL interfaces.
bdr.alter_node_group_option
Modify a PGD node group configuration.
Synopsis
Parameters
node_group_name
— Name of the group to be changed.config_key
— Key of the option in the node group to be changed.config_value
— New value to be set for the given key.
config_value
will be parsed into the data type appropriate for the option.
Some parameters can be applied only to the top-level node group. For these parameters, the Groups column contains Top. Some parameters can be applied to the top-level node group and subgroups. For these parameters, the Groups column contains All. When a parameter can be applied only to subgroups, the Groups column contains Sub.
The table shows the group options that can be changed using this function.
Name | Type | Groups | Description |
---|---|---|---|
apply_delay | interval | All | How long nodes wait to apply incoming changes. This option is useful mainly to set up a special subgroup with delayed subscriber-only nodes. Don't set this on groups that contain data nodes or on the top-level group. Default is 0s . |
check_constraints | boolean | Top | Whether the apply process checks the constraints when writing replicated data. We recommend keeping the default value or you risk data loss. Valid values are on or off . Default is on . |
default_commit_scope | text | All | The commit scope to use by default, initially the local commit scope. This option applies only to the top-level node group. You can use individual rules for different origin groups of the same commit scope. See Origin groups for more details. |
enable_proxy_routing | boolean | All | Where pgd-proxy through the group leader is enabled for given group. Valid values are on or off . Default is off . |
enable_raft | boolean | Sub | Whether group has its own Raft consensus. This option is necessary for setting enable_proxy_routing to on . This option is always on for the top-level group. Valid values are on or off . Default is off for subgroups. |
enable_wal_decoder | boolean | Top | Enables/disables the decoding worker process. You can't enable the decoding worker process if streaming_mode is already enabled. Valid values are on or off . Default is off . |
location | text | All | Information about group location. This option is purely metadata for monitoring. Default is '' (empty string). |
num_writers | integer | Top | Number of parallel writers for the subscription backing this node group. Valid values are -1 or a positive integer. -1 means the value specified by the GUC bdr.writers_per_subscription is used. -1 is the default. |
route_reader_max_lag | integer | All | Maximum lag in bytes for a node to be considered a viable read-only node. Currently reserved for future use. |
route_writer_max_lag | integer | All | Maximum lag in bytes of the new write candidate to be selected as write leader. If no candidate passes this, no writer is selected automatically. Default is -1 . |
route_writer_wait_flush | boolean | All | Whether to switch if PGD needs to wait for the flush. Currently reserved for future use. |
streaming_mode | text | Top | Enables/disables streaming of large transactions. When set to off , streaming is disabled. When set to any other value, large transactions are decoded while they're still in progress, and the changes are sent to the downstream. If the value is set to file , then the incoming changes of streaming transactions are stored in a file and applied only after the transaction is committed on upstream. If the value is set to writer , then the incoming changes are directly sent to one of the writers, if available.If parallel apply is disabled or no writer is free to handle streaming transactions, then the changes are written to a file and applied after the transaction is committed. If the value is set to auto , PGD tries to intelligently pick between file and writer , depending on the transaction property and available resources. You can't enable streaming_mode if the WAL decoder is already enabled. Default is auto .For more details, see Transaction streaming. |
Return value
bdr.alter_node_group_option()
returns VOID
on success.
An ERROR
is raised if any of the provided parameters is invalid.
Notes
You can examine the current state of node group options by way of the view
bdr.node_group_summary
.
This function passes a request to the group consensus mechanism to change the defaults. The changes made are replicated globally using the consensus mechanism.
The function isn't transactional. The request is processed in the background, so you can't roll back the function call. Also, the changes might not be immediately visible to the current transaction.
This function doesn't hold any locks.
bdr.alter_node_interface
This function changes the connection string (DSN
) of a specified node.
Synopsis
Parameters
node_name
— Name of an existing node to alter.interface_dsn