Re: Replication slot stats misgivings
vignesh C <vignesh21@gmail.com>
From: vignesh C <vignesh21@gmail.com>
To: Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>
Cc: Masahiko Sawada <sawada.mshk@gmail.com>,
Amit Kapila <amit.kapila16@gmail.com>, Andres Freund <andres@anarazel.de>,
PostgreSQL-development <pgsql-hackers@postgresql.org>, Kyotaro HORIGUCHI <horiguchi.kyotaro@lab.ntt.co.jp>
Date: 2021-04-05T13:54:26Z
Lists: pgsql-hackers
On Mon, Apr 5, 2021 at 12:44 PM Bharath Rupireddy
<bharath.rupireddyforpostgres@gmail.com> wrote:
>
> On Sat, Apr 3, 2021 at 11:12 PM vignesh C <vignesh21@gmail.com> wrote:
> > Here pg_stat_replication_slots will not have enought slots. I changed
> > it to below:
> > errmsg("skipping \"%s\" replication slot statistics as
> > pg_stat_replication_slots does not have enough slots"
> > Thoughts?
>
> WFM.
>
> > > 3) Should we change the if condition to max_replication_slots <=
> > > nReplSlotStats instead of max_replication_slots == nReplSlotStats? In
> > > the scenario, it is mentioned that "one of the replication slots is
> > > dropped", will this issue occur when multiple replication slots are
> > > dropped?
> > >
> >
> > I felt it should be max_replication_slots == nReplSlotStats, if
> > max_replication_slots = 5, we will be able to store 5 replication slot
> > statistics from 0,1..4, from 5th we will not have space. I think this
> > need not be changed.
>
> I'm not sure whether we can have a situation where
> max_replication_slots < nReplSlotStats i.e. max_replication_slots
> getting set to lesser than nReplSlotStats. I think I didn't get the
> above mentioned scenario i.e. max_replication_slots == nReplSlotStats
> correctly. It will be great if you could throw some light on that
> scenario and ensure that it's not possible to reach a situation where
> max_replication_slots < nReplSlotStats.
Usually this will not happen, there is a remote chance that will
happen in the below scenario:
When a replication slot is created, a slot is created in
pg_stat_replication_slot also by the statistics collector, this cannot
exceed max_replication_slots. Whenever a slot is dropped, the
corresponding slot will be deleted from pg_stat_replication_slot. The
statistics collector uses UDP protocol for communication hence there
is no guarantee that the message is received by the statistic
collector process. After the user has dropped the replication slot, if
the server is stopped(here statistic collector process has not yet
received the drop replication slot statistic). Then the user reduces
the max_repllication_slot and starts the server. In this scenario the
statistic collector process will have more replication slot
statistics(as the drop was not received) than max_replication_slot.
Regards,
Vignesh
Commits
-
Doc: Update logical decoding stats information.
- 0c6b92d9c6fb 14.0 landed
-
Fix tests for replication slots stats.
- fc69509131c3 14.0 landed
-
Update replication statistics after every stream/spill.
- 592f00f8dec6 14.0 landed
-
Fix the computation of slot stats for 'total_bytes'.
- 205f466282be 14.0 landed
-
Another try to fix the test case added by commit f5fc2f5b23.
- 51ef9173030c 14.0 landed
-
Use HTAB for replication slot statistics.
- 3fa17d37716f 14.0 landed
-
Fix test case added by commit f5fc2f5b23.
- c64dcc7fee5f 14.0 landed
-
Add information of total data processed to replication slot stats.
- f5fc2f5b23d1 14.0 landed
-
Use NameData datatype for slotname in stats.
- cca57c1d9bf7 14.0 landed