Updated on 2024-08-20 GMT+08:00

Settings

wal_level

Parameter description: Specifies the level of information to be written to the WAL. The value cannot be empty or commented out.

  • To enable WAL archiving and data streaming replication between the primary and standby nodes, set this parameter to archive, hot_standby, or logical.
  • If this parameter is set to archive or minimal, hot_standby must be set to off. In a distributed system, hot_standby cannot be set to off, because this setting can affect other features of the HA system. Therefore, you are advised not to set this parameter to archive or minimal. Otherwise, the database cannot be started.

Value type: enumerated type.

Value range:

  • minimal

    Advantages: Certain bulk operations (including creating tables and indexes, executing cluster operations, and copying tables) are safely skipped in logging, which can make those operations much faster.

    Disadvantages: WALs contain only basic information required for recovery from a database server crash or an emergency shutdown. Data cannot be restored from archived WALs.

  • archive

    Adds logging required for WAL archiving, supporting the database restoration from archives.

  • hot_standby
    • Further adds information required to run SQL queries on a standby node and takes effect after the database restarts.
    • To enable read-only queries on a standby node, the wal_level parameter must be set to hot_standby on the primary node and the same value must be set on the standby node. There are few measurable differences in performance between using hot_standby and archive levels. However, feedback is welcome if any differences in their impacts on product performance are noticeable.
  • logical

    Only when this parameter is set to logical, logical logs can be parsed and the primary key information is recorded in Xlogs.

Default value: hot_standby

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

Setting suggestion: Set this parameter to logical when the logical replication function is enabled. In other scenarios, set this parameter to hot_standby.

fsync

Parameter description: Specifies whether the GaussDB server uses the fsync() function (see wal_sync_method) to ensure that updates can be written to disks in a timely manner.

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

  • Using the fsync() function ensures that the data can be recovered to a known state when the OS or hardware crashes.
  • Setting this parameter to off may result in unrecoverable data corruption in a system crash.

Value range: Boolean

  • on indicates that the fsync() function is used.
  • off indicates that the fsync() function is not used.

Default value: on

synchronous_commit

Parameter description: Specifies the synchronization mode of the current transaction.

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

Generally, logs generated by a transaction are synchronized in the following sequence:
  1. The primary node writes logs to the local memory.
  2. The primary node writes the logs in the local memory to the local file system.
  3. The primary node flushes the logs in the local file system to disks.
  4. The primary node sends the logs to the standby node.
  5. The standby node receives the logs and saves them to the local memory.
  6. The standby node writes the logs in the local memory to the local file system.
  7. The standby node flushes the logs in the local file system to disks.
  8. The standby node replays the logs to complete the incremental update of data files.

Value range: enumerated values

  • on (true, yes, 1): The primary node waits for the standby node to flush logs to disks before committing a transaction.
  • off (false, no, 0): The primary node commits a transaction without waiting for the primary node to flush logs to disks. This mode is also called asynchronous commit.
  • local: The primary node waits for the primary node to flush logs to disks before committing a transaction. This mode is also called local commit.
  • remote_write: The primary node waits for the standby node to write logs to the file system before committing a transaction. (The logs do not need to be flushed to disks.)
  • remote_receive: The primary node waits for the standby node to receive logs before committing a transaction. (The logs do not need to be written to the file system.)
  • remote_apply: The primary node waits for the standby node to complete log replay before committing a transaction.
  • true: same as on.
  • false: same as off.
  • yes: same as on.
  • no: same as off.
  • 1: same as on.
  • 0: same as off.
  • 2: same as remote_apply.

Default value: on

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.

wal_sync_method

Parameter description: Specifies the method used for forcing WAL updates out to disks.

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

If fsync is set to off, the setting of this parameter does not take effect because WAL updates will not be forcibly written to disks.

Value range: enumerated values.

  • open_datasync indicates that WAL files are opened with the O_DSYNC option.
  • fdatasync indicates that fdatasync() is called at each commit (SUSE 10 and SUSE 11 are supported).
  • fsync_writethrough indicates that fsync() is called at each commit to force data in the buffer to be written to disks.

    wal_sync_method can be set to fsync_writethrough on a Windows platform, but this setting has the same effect as setting the parameter to fsync on the Windows platform.

  • fsync indicates that fsync() is called at each commit (SUSE 10 and SUSE 11 are supported).
  • open_sync indicates that open() with the O_SYNC option is used to write WAL files (SUSE 10 and SUSE 11 are supported).

    Not all platforms support the preceding parameters.

Default value: fdatasync

full_page_writes

Parameter description: Specifies whether the GaussDB server writes the entire content of each disk page to WALs during the first modification of that page after a checkpoint.

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

  • This parameter is needed because a page write that is in process during an OS crash might be only partially completed, leading to an on-disk page that contains a mix of old and new data. The row-level change data normally stored in WALs will not be enough to completely restore such a page during post-crash recovery. Storing the full page image guarantees that the page can be correctly restored, but at the price of increasing the amount of data that must be written to WALs.
  • Disabling this parameter might lead to unrecoverable data corruption after a system failure. It might be safe to set this parameter to off if you have hardware (such as a battery-backed disk controller) or file-system software (such as ReiserFS 4) that reduces the risk of partial page writes to an acceptably low level.

Value range: Boolean.

  • on indicates that this feature is enabled.
  • off indicates that this feature is disabled.

Default value: on

wal_log_hints

Parameter description: Specifies whether to write an entire page to WALs during the first modification of that page after a checkpoint, even for non-critical modifications of so-called hint bits. You are advised not to modify the setting.

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

Value range: Boolean

  • on indicates that the entire page is written to WALs.
  • off indicates that the entire page is not written to WALs.

Default value: on

wal_buffers

Parameter description: Specifies the size of shared memory for storing WALs, in multiples of XLOG_BLCKSZ or the actual size. XLOG_BLCKSZ indicates the size of an Xlog block, typically 8 KB.

Parameter type: integer.

Unit: 8 KB (XLOG_BLCKSZ)

Value range: –1, or 4 to 218. The minimum value is –1 and the maximum value is 262144 (number of XLOG_BLCKSZ).

  • If this parameter is set to –1, the wal_buffers size is dependent on the value of shared_buffers. The default value of wal_buffers is 1/32 of shared_buffers. The minimum value is XLOG_BLCKSZ multiplied by 8 and the maximum value is XLOG_BLCKSZ multiplied by 2048. If the automatically adjusted value is less than the minimum value, the value is forcibly set to the minimum value. If the value is greater than the maximum value, the value is forcibly set to the maximum value.
  • If this parameter is set to a value smaller than 4 (that is, 0, 1, 2, or 3), the value 4 is forcibly used.
  • Independent deployment: 1GB (60-core CPU/480 GB memory and 32-core CPU/256 GB memory); 512MB (16-core CPU/128 GB memory); 256MB (8-core CPU/64 GB memory); 128MB (4-core CPU/32 GB memory); 64MB (4-core CPU/16 GB memory)
  • Finance edition (standard):

    CN: 512MB (196-core CPU/1536 GB memory, 128-core CPU/1024 GB memory, 104-core CPU/1024 GB memory, 96-core CPU/1024 GB memory, 96-core CPU/768 GB memory, and 80-core CPU/640 GB memory); 256MB (72-core CPU/576 GB memory, 64-core CPU/512 GB memory, and 60-core CPU/480 GB memory); 128MB (32-core CPU/256 GB memory and 16-core CPU/128 GB memory); 64MB (8-core CPU/64 GB memory)

    DN: 2GB (196-core CPU/1536 GB memory, 128-core CPU/1024 GB memory, 104-core CPU/1024 GB memory, 96-core CPU/1024 GB memory, and 96-core CPU/768 GB memory); 1GB (80-core CPU/640 GB memory, 72-core CPU/576 GB memory, 64-core CPU/512 GB memory, 60-core CPU/480 GB memory, and 32-core CPU/256 GB memory); 512MB (16-core CPU/128 GB memory); 256MB (8-core CPU/64 GB memory)

  • Enterprise edition:

    CN: 512MB (196-core CPU/1536 GB memory, 128-core CPU/1024 GB memory, 104-core CPU/1024 GB memory, 96-core CPU/1024 GB memory, 96-core CPU/768 GB memory, 80-core CPU/640 GB memory, and 80-core CPU/512 GB memory); 256MB (72-core CPU/576 GB memory, 64-core CPU/512 GB memory, and 60-core CPU/480 GB memory); 128MB (32-core CPU/256 GB memory and 16-core CPU/128 GB memory); 64MB (8-core CPU/64 GB memory)

    DN: 1GB (196-core CPU/1536 GB memory, 128-core CPU/1024 GB memory, 104-core CPU/1024 GB memory, 96-core CPU/1024 GB memory, 96-core CPU/768 GB memory, 80-core CPU/640 GB memory, 80-core CPU/512 GB memory, 72-core CPU/576 GB memory, 64-core CPU/512 GB memory, 60-core CPU/480 GB memory, and 32-core CPU/256 GB memory); 512MB (16-core CPU/128 GB memory); 256MB (8-core CPU/64 GB memory)

  • Finance edition (data computing):

    CN: 256MB (196-core CPU/1536 GB memory, 128-core CPU/1024 GB memory, and 96-core CPU/768 GB memory); 125MB (72-core CPU/576 GB memory, 64-core CPU/512 GB memory); 64MB (32-core CPU/256 GB memory)

    DN: 1GB (196-core CPU/1536 GB memory, 128-core CPU/1024 GB memory, 96-core CPU/768 GB memory, 72-core CPU/576 GB memory, and 64-core CPU/512 GB memory); 512MB (32-core CPU/256 GB memory)

Setting method: This is a POSTMASTER parameter. Set it based on instructions in Table 1. For example, if wal_buffers is set to 2048, the size of shared memory for storing WALs is 2048 multiplied by 8 KB; if wal_buffers is set to 20480KB, the size of shared memory for storing WALs is 20480KB. If the value contains a unit, the value must be KB, MB, or GB and must be an integer multiple of 8 KB.

Setting suggestion: The content of the WAL buffer is written to disks at every transaction commit. Therefore, setting an extremely large value is unlikely to bring a significant increase in system performance. However, setting this parameter to a few megabytes can improve the disk write performance on a server where a large number of transactions are immediately committed. According to experience, the default value can meet the requirements of most cases. For different specifications, use the default values in the corresponding suggestions. You are advised to retain the default value. Do not set wal_buffers to an excessively large or small value, and the following condition must be true: data_replicate_buffer_size + segment_buffers + shared_buffers + wal_buffers + temp_buffers + maintenance_work_mem + work_mem + query_mem + (Standby node) wal_receiver_buffer_size < max_process_memory < Memory size of the physical machine. If the value of the memory parameter is too large and exceeds the upper limit of the physical memory, the database fails to be started because no sufficient memory can be allocated.

wal_writer_delay

Parameter description: Specifies the delay between activity rounds for the WAL writer.

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

A longer delay might lead to insufficient WAL buffer and a shorter delay leads to continuously writing of the WALs, thereby increasing the load of disk I/O.

Value range: an integer ranging from 1 to 10000. The unit is millisecond.

Default value: 200ms

commit_delay

Parameter description: Specifies the duration for committed data to be stored in the WAL buffer.

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

  • When this parameter is set to a non-zero value, the committed transaction is stored in the WAL buffer instead of being written to the WAL immediately. Then the WAL writer flushes the buffer to disks periodically.
  • If system load is high, other transactions are probably ready to be committed within the delay. If no other transactions are ready to be committed, the delay is a waste of time.

Value range: an integer ranging from 0 to 100000. The unit is μs. 0 indicates no delay.

Default value: 0

commit_siblings

Parameter description: Specifies a threshold on the number of concurrent open transactions. If the number of concurrent open transactions is greater than the value of this parameter, a transaction that initiates a commit request will wait for a period of time specified by commit_delay. Otherwise, this transaction is written into WALs immediately.

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

Value range: an integer ranging from 0 to 1000.

Default value: 5

wal_block_size

Parameter description: Specifies the size of a WAL disk block.

This is a fixed INTERNAL parameter. It can be viewed but cannot be modified.

Value range: an integer. The unit is byte.

Default value: 8192

wal_segment_size

Parameter description: Specifies the size of a WAL segment file.

This is a fixed INTERNAL parameter. It can be viewed but cannot be modified.

Value range: An integer. The unit is 8 KB.

Default value: 16MB (2048 x 8 KB)

force_promote

Parameter description: Specifies whether to enable the forcible switchover function on the standby node.

When a cluster is faulty, the forcible switchover enables the cluster to recover services as soon as possible at the cost of losing some data. This is an escape method used when the cluster is unavailable. You are advised not to trigger this method frequently. You are advised not to use this function if you are not clear about the impact of data loss on services.

To use this function, you need to enable it on the DN and CM Server and restart the cluster for the setting to take effect. For details about how to enable the forcible switchover function on the standby node, see "Emergency Handling > Performing a Forcible Primary/Standby Switchover" in Troubleshooting.

Value range: an integer. The value can be 0 (disabled) or 1 (enabled).

Default value: 0

wal_file_init_num

Parameter description: Specifies the number of Xlog segment files created at a time when the WAL writer thread is started.

Parameter type: integer.

Unit: none.

Value range: 0 to 1000000.

Default value: 10

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

Setting suggestion: Retain the default value.

wal_file_preinit_bounds

Parameter description: Specifies the maximum number of WAL segment files that can be pre-expanded by the WAL writer auxiliary thread per second during service running. The WAL segment file size is 16 MB. If this parameter is set to 0, there is no restriction.

Parameter type: integer.

Unit: none

Value range: [0,1024]

Default value: 0

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

Setting suggestion: Retain the default value. Set this parameter to a valid value based on the disk I/O capability. For details, see the value of max_io_capacity.

  • If max_io_capacity is set to 500MB, set this parameter to 25.
  • If max_io_capacity is set to 1GB, set this parameter to 50.

wal_debug

Parameter description: Specifies whether to output WAL-related debugging information. This parameter is available only when WAL_DEBUG is enabled during compilation.

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

Value range: Boolean.

Default value: false

walwriter_sleep_threshold

Parameter description: Specifies the number of times that the idle Xlog is refreshed before the Xlog refresher enters sleep.

Parameter type: integer.

Unit: none.

Value range: 1 to 50000.

Default value: 500.

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

Setting suggestion: Retain the default value.

wal_flush_timeout

Parameter description: Specifies the timeout interval for traversing WalInsertStatusEntryTbl. It is the maximum wait time for the adaptive Xlog disk flushing I/O to traverse WalInsertStatusEntryTbl.

This is a SIGHUP parameter. Set it based on instructions in Table 2.

If the timeout interval is too long, the Xlog flushing frequency may decrease, reducing the Xlog processing performance.

Value range: an integer ranging from 0 to 90000000 (μs).

Default value: 2us

wal_flush_delay

Parameter description: Specifies the wait interval when an entry in the WAL_NOT_COPIED state is encountered during WalInsertStatusEntryTbl traversal.

This is a SIGHUP parameter. Set it based on instructions in Table 2.

Value range: an integer ranging from 0 to 90000000 (μs).

Default value: 1us

xlog_file_path

Parameter description: Specifies the path of the Xlog shared disk in dual-cluster shared storage scenarios. This parameter is configured by the OM during database system initialization. You are advised not to modify the configuration.

This is a POSTMASTER parameter. Set it based on instructions in Table 2.

Value range: a string.

Default value: NULL

xlog_file_size

Parameter description: Specifies the size of the Xlog shared disk in dual-cluster shared storage scenarios. This parameter is configured by the OM during database system initialization. You are advised not to modify the configuration.

This is a POSTMASTER parameter. Set it based on instructions in Table 2.

Value range: a long integer ranging from 5053733504 to 576460752303423487. The unit is byte.

Default value: 549755813888

xlog_lock_file_path

Parameter description: Specifies the path of the lock file preempted by the Xlog shared disk in dual-cluster shared storage scenarios. This parameter is configured by the OM during database system initialization. You are advised not to modify the configuration.

This is a POSTMASTER parameter. Set it based on instructions in Table 2.

Value range: a string.

Default value: NULL

max_size_for_shared_storage_xlog_write

Parameter description: Specifies the maximum amount of data that can be written to a shared disk at a time.

Parameter type: integer.

Unit: KB

Value range: 8–131072.

Default value: 1024

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

Setting suggestion: none.