Re: [HACKERS] Restricting maximum keep segments by repslots
Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
From: Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
To: stark@mit.edu
Cc: sk@zsrv.org, michael.paquier@gmail.com, andres@anarazel.de,
peter.eisentraut@2ndquadrant.com, pgsql-hackers@postgresql.org
Date: 2018-01-15T06:36:32Z
Lists: pgsql-hackers
Hello,
At Thu, 11 Jan 2018 13:56:14 +0000, Greg Stark <stark@mit.edu> wrote in <CAM-w4HOVYZkCbCdFt8N8zwAAcuETFimwOB_Db+jgFajn-iYHEQ@mail.gmail.com>
> On 11 January 2018 at 09:55, Sergei Kornilov <sk@zsrv.org> wrote:
> > if (active_pid != 0)
> > status = "streaming";
> > else
> > status = "keeping";
>
> Perhaps "idle" by analogy to a pg_stat_activity entry for a backend
> that's connected but not doing anything.
The state "keeping" is "some segments that are needed by a slot
are still existing but to be removed by the next checkpoint". The
three states are alogogous to green/yellow/red in traffic
lights. "idle" doesn't feel right.
> > status = "may_lost";
>
> Perhaps "stale" or "expired"?
Some random thoughts on this topic:
Reading the field as "WAL record at restrat_lsn is/has been
$(status)", "expired" fits there. "safe"/"crtical"/("stale" and
"expired") would fit "restart_lsn is $(status)"?
If we merge the second sate to the red-side, a boolean column
with the names "wal_preserved" or "wal_available" might work. But
I believe the second state is crucial.
> Is this patch in bike-shed territory? Are there any questions about
> whether we want the basic shape to look like this?
FWIW the summary history of this patch follows.
- added monitoring feature,
- GUC in bytes not in segments,
- show the "min_keep_lsn" instead of "spare amount of avalable
WAL(distance)" (*1)
- changed the words to show the status. (still under discussion)
- added documentation.
I didn't adopt "setting per slot" since the keep amount is not
measured from slot's restart_lsn, but from checkpoint LSN.
*1: As I mentioned upthread, I think that at least the
"pg_replication_slots.min_keep_lsn" is arguable since it shows
the same value for all slots and I haven't found no other
appropriate place.
> Fwiw I think there's a real need for this feature so I would like to
> get it in for Postgres 11.
It encourages me a lot. Thanks.
regards,
--
Kyotaro Horiguchi
NTT Open Source Software Center
Commits
-
Save slot's restart_lsn when invalidated due to size
- 12e52ba5a76e 13.0 landed
- 0188bb82531f 14.0 landed
-
Fix checkpoint signalling
- 1816a1c6ffe4 13.0 landed
-
Check slot->restart_lsn validity in a few more places
- d0abe78d8427 13.0 landed
-
Allow users to limit storage reserved by replication slots
- c6550776394e 13.0 landed
-
Remove header noise from test_decoding test
- 69360b34589b 13.0 landed
-
Rework WAL-reading supporting structs
- 709d003fbd98 13.0 cited
-
Flip argument order in XLogSegNoOffsetToRecPtr
- a22445ff0be2 12.0 cited