From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Amit Kapila <amit(dot)kapila16(at)gmail(dot)com> |
Cc: | Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>, Michael Paquier <michael(at)paquier(dot)xyz>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: min_safe_lsn column in pg_replication_slots view |
Date: | 2020-07-07 00:54:36 |
Message-ID: | 20200707005436.GA27882@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 2020-Jul-06, Alvaro Herrera wrote:
> Hmm, I like safe_wal_size.
>
> I've been looking at this intermittently since late last week and I
> intend to get it done in the next couple of days.
I propose the attached. This is pretty much what was proposed by
Kyotaro, but I made a couple of changes. Most notably, I moved the
calculation to the view code itself rather than creating a function in
xlog.c, mostly because it seemed to me that the new function was
creating an abstraction leakage without adding any value; also, if we
add per-slot size limits later, it would get worse.
The other change was to report negative values when the slot becomes
unreserved, rather than zero. It shows how much beyond safety your
slots are getting, so it seems useful. Clamping at zero seems to serve
no purpose.
I also made it report null immediately when slots are in state lost.
But beware of slots that appear lost but fall in the unreserved category
because they advanced before checkpointer signalled them. (This case
requires a debugger to hit ...)
One thing that got my attention while going over this is that the error
message we throw when making a slot invalid is not very helpful; it
doesn't say what the current insertion LSN was at that point. Maybe we
should add that? (As a separate patch, of couse.)
Any more thoughts? If not, I'll get this pushed tomorrow finally.
Thanks
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Attachment | Content-Type | Size |
---|---|---|
0001-Morph-pg_replication_slots.min_safe_lsn-to-safe_wal_.patch | text/x-diff | 11.9 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | vignesh C | 2020-07-07 01:26:29 | Re: Parallel worker hangs while handling errors. |
Previous Message | Tom Lane | 2020-07-07 00:32:22 | Re: Multi-byte character case-folding |