↑↓ 选择↵ 打开⌫ 切换范围完整搜索

PG.CENTER 连接 PostgreSQL 文档、百科与生态知识。由 Pigsty 维护。

Wiki / 配置参数

wal_sender_shutdown_timeout

指定服务器在关闭期间等待所有 WAL 数据复制到接收端的最长时间。如果此值未指定单位,则按毫秒计。值 -1(默认值)会禁用超时机制,允许 WAL 发送进程根据需要一直等待接收端追赶。值 0 会使 WAL 发送进程不等待接收端追赶便终止。 使用复制时,发送服务器通常会等待直到所有 WAL 数据都已传输到接收端,才完成关闭。这有助于在关闭后保持发送端和接收端同步,这对于物理复制切换尤其重要,但也可能延迟关闭。 如果此参数设置为零或正值,则超时到达时服务器会停止等待并完成关闭。这可以缩短关闭时间,例如在高延迟网络上复制较慢,或者逻辑复制应用工作进程因等待锁而阻塞时。不过在这种情况下,关闭后发送端和接收端可能不同步。应谨慎选择足够大的值,以便在正常情况下让所有 WAL 数据都能复制到接收端。 该参数可以在 primary_conninfo 中以及 CREATE SUBSCRIPTION 的 CONNECTION 子句中设置(例如在连接串中包含 options=-cwal_sender_shutdown_timeout=10s),从而为不同的复制连接设置不同的超时时间。例如,同时使用物理复制和逻辑复制时,可以对物理复制禁用该超时(例如用于切换),而对逻辑复制启用它以限制关闭时间。

英文手册覆盖始于 PostgreSQL 7.4. 来源历史与运行验证各自保留独立版本边界。

当前阅读 PG 19·选择有来源记录的版本

boot val
-1
category
Replication / Sending Servers
context
user
doc same as
未知
documented
true
enumvals
未知
extra desc
-1 means wait indefinitely. 0 means do not wait.
lang
en
max val
2147483647
metadata version
19beta4
min val
-1
name
wal_sender_shutdown_timeout
short desc
Sets the maximum time the server waits during shutdown for all WAL data to be replicated to the receiver.
source
pg-settings-source-snapshot
unit
ms
vartype
integer

版本定义 PG 19

指定服务器在关闭期间等待所有 WAL 数据复制到接收端的最长时间。如果此值未指定单位,则按毫秒计。值 -1(默认值)会禁用超时机制,允许 WAL 发送进程根据需要一直等待接收端追赶。值 0 会使 WAL 发送进程不等待接收端追赶便终止。

使用复制时,发送服务器通常会等待直到所有 WAL 数据都已传输到接收端,才完成关闭。这有助于在关闭后保持发送端和接收端同步,这对于物理复制切换尤其重要,但也可能延迟关闭。

如果此参数设置为零或正值,则超时到达时服务器会停止等待并完成关闭。这可以缩短关闭时间,例如在高延迟网络上复制较慢,或者逻辑复制应用工作进程因等待锁而阻塞时。不过在这种情况下,关闭后发送端和接收端可能不同步。应谨慎选择足够大的值,以便在正常情况下让所有 WAL 数据都能复制到接收端。

该参数可以在 primary_conninfo 中以及 CREATE SUBSCRIPTION 的 CONNECTION 子句中设置(例如在连接串中包含 options=-cwal_sender_shutdown_timeout=10s),从而为不同的复制连接设置不同的超时时间。例如,同时使用物理复制和逻辑复制时,可以对物理复制禁用该超时(例如用于切换),而对逻辑复制启用它以限制关闭时间。

比较版本

完整来源事实

doc html

<p>
        Specifies the maximum time the server waits during shutdown for all
        WAL data to be replicated to the receiver.  If this value is specified
        without units, it is taken as milliseconds.  A value of
        <code class="literal">-1</code> (the default) disables the timeout mechanism,
        allowing the WAL sender to wait as long as necessary for the receiver
        to catch up.  A value of <code class="literal">0</code> causes the WAL sender to
        terminate without waiting for the receiver to catch up.
       </p><p>
        When replication is in use, the sending server normally waits until
        all WAL data has been transferred to the receiver before completing
        shutdown.  This helps keep sender and receiver in sync after shutdown,
        which is especially important for physical replication switchovers,
        but it can delay shutdown.
       </p><p>
        If this parameter is set to zero or a positive value, the server stops
        waiting and completes shutdown when the timeout expires.  This can
        shorten shutdown time, for example, when replication is slow on
        high-latency networks or when a logical replication apply worker is
        blocked waiting for locks.  However, in this case the sender and
        receiver may be out of sync after shutdown.  Care should be taken to
        select a value high enough to allow all WAL data to be replicated to
        the receiver under normal circumstances.
       </p><p>
        This parameter can be set in <code class="varname">primary_conninfo</code> and
        in the <code class="literal">CONNECTION</code> clause of
        <code class="command">CREATE SUBSCRIPTION</code> (for example, include
        <code class="literal">options=-cwal_sender_shutdown_timeout=10s</code> in the
        connection string), allowing different timeouts per replication
        connection.  For example, when both physical and logical replication
        are used, it can be disabled for physical replication (e.g., for
        switchovers) while enabled for logical replication to limit shutdown
        time.
       </p>

documentation revision

{"inputs":[{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"en","sha256":"76b3c1615af7dd60d031cefd485568e6336b3d13c366e8a473304bd7ef2fb92d","version":"19rc2"},{"file":"runtime-config-replication.html","kind":"same-version-reviewed-manual","locale":"zh-Hans","sha256":"935f29b71e863329c3c39caae902de37d5bbf03c2adcf42322225d3cefe71a84","version":"19rc2"}],"release":"19rc2","runtime_remeasured":false,"source_revision":"pgdoc:b9f0e7232f60f380d642ac9b99226606c254b552"}

来源引用

完整定义与证据 JSON

定义来源

center · PostgreSQL 19 · wiki-repair-20261023:e79c425094f8350a583033eb1b9c68a55b1f70ddb700fdbb2d2687af196ed218

正文语言: zh-Hans · wiki-repair-20261023:e79c425094f8350a583033eb1b9c68a55b1f70ddb700fdbb2d2687af196ed218