mirror of
https://github.com/postgres/postgres.git
synced 2025-06-16 06:01:02 +03:00
Adjust max_slot_wal_keep_size behavior per review
In pg_replication_slot, change output from normal/reserved/lost to reserved/extended/unreserved/ lost, which better expresses the possible states particularly near the time where segments are no longer safe but checkpoint has not run yet. Under the new definition, reserved means the slot is consuming WAL that's still under the normal WAL size constraints; extended means it's consuming WAL that's being protected by wal_keep_segments or the slot itself, whose size is below max_slot_wal_keep_size; unreserved means the WAL is no longer safe, but checkpoint has not yet removed those files. Such as slot is in imminent danger, but can still continue for a little while and may catch up to the reserved WAL space. Also, there were some bugs in the calculations used to report the status; fixed those. Backpatch to 13. Reported-by: Fujii Masao <masao.fujii@oss.nttdata.com> Author: Kyotaro Horiguchi <horikyota.ntt@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@oss.nttdata.com> Reviewed-by: Álvaro Herrera <alvherre@alvh.no-ip.org> Discussion: https://postgr.es/m/20200616.120236.1809496990963386593.horikyota.ntt@gmail.com
This commit is contained in:
@ -11239,19 +11239,29 @@ SELECT * FROM pg_locks pl LEFT JOIN pg_prepared_xacts ppx
|
||||
Possible values are:
|
||||
<itemizedlist>
|
||||
<listitem>
|
||||
<para><literal>normal</literal> means that the claimed files
|
||||
<para><literal>reserved</literal> means that the claimed files
|
||||
are within <varname>max_wal_size</varname>.</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>reserved</literal> means
|
||||
<para><literal>extended</literal> means
|
||||
that <varname>max_wal_size</varname> is exceeded but the files are
|
||||
still held, either by some replication slot or
|
||||
by <varname>wal_keep_segments</varname>.</para>
|
||||
still retained, either by the replication slot or
|
||||
by <varname>wal_keep_segments</varname>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para><literal>lost</literal> means that some WAL files are
|
||||
definitely lost and this slot cannot be used to resume replication
|
||||
anymore.</para>
|
||||
<para>
|
||||
<literal>unreserved</literal> means that the slot no longer
|
||||
retains the required WAL files and some of them are to be removed at
|
||||
the next checkpoint. This state can return
|
||||
to <literal>reserved</literal> or <literal>extended</literal>.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>
|
||||
<literal>lost</literal> means that some required WAL files have
|
||||
been removed and this slot is no longer usable.
|
||||
</para>
|
||||
</listitem>
|
||||
</itemizedlist>
|
||||
The last two states are seen only when
|
||||
|
Reference in New Issue
Block a user