Re: Replication slot stats misgivings

2021-04-20 Thread vignesh C
On Tue, Apr 20, 2021 at 9:08 AM Masahiko Sawada wrote: > > On Mon, Apr 19, 2021 at 4:48 PM Masahiko Sawada wrote: > > > > On Mon, Apr 19, 2021 at 2:14 PM Amit Kapila wrote: > > > > > > On Mon, Apr 19, 2021 at 9:00 AM Masahiko Sawada > > > wrote: > > > > > > > > On Fri, Apr 16, 2021 at 2:58 PM

Re: Replication slot stats misgivings

2021-04-20 Thread Amit Kapila
On Tue, Apr 20, 2021 at 9:08 AM Masahiko Sawada wrote: > > I've attached the new version patch that fixed the compilation error > reported off-line by Amit. > I was thinking about whether we can someway avoid the below risk: In case where the + * message for dropping the old slot gets lost and a

Re: Replication slot stats misgivings

2021-04-19 Thread Masahiko Sawada
On Mon, Apr 19, 2021 at 4:48 PM Masahiko Sawada wrote: > > On Mon, Apr 19, 2021 at 2:14 PM Amit Kapila wrote: > > > > On Mon, Apr 19, 2021 at 9:00 AM Masahiko Sawada > > wrote: > > > > > > On Fri, Apr 16, 2021 at 2:58 PM Amit Kapila > > > wrote: > > > > > > > > > > > > 4. > > > > +CREATE VIEW

Re: Replication slot stats misgivings

2021-04-19 Thread vignesh C
On Fri, Apr 16, 2021 at 3:16 PM Amit Kapila wrote: > > On Mon, Apr 12, 2021 at 2:57 PM vignesh C wrote: > > > > On Sat, Mar 20, 2021 at 9:26 AM Amit Kapila wrote: > > > > > > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > > > > > And then more generally about the feature: > > > >

Re: Replication slot stats misgivings

2021-04-19 Thread Masahiko Sawada
On Mon, Apr 19, 2021 at 2:14 PM Amit Kapila wrote: > > On Mon, Apr 19, 2021 at 9:00 AM Masahiko Sawada wrote: > > > > On Fri, Apr 16, 2021 at 2:58 PM Amit Kapila wrote: > > > > > > > > > 4. > > > +CREATE VIEW pg_stat_replication_slots AS > > > +SELECT > > > +s.slot_name, > > > +

Re: Replication slot stats misgivings

2021-04-18 Thread Amit Kapila
On Mon, Apr 19, 2021 at 9:00 AM Masahiko Sawada wrote: > > On Fri, Apr 16, 2021 at 2:58 PM Amit Kapila wrote: > > > > > > 4. > > +CREATE VIEW pg_stat_replication_slots AS > > +SELECT > > +s.slot_name, > > +s.spill_txns, > > +s.spill_count, > > +

Re: Replication slot stats misgivings

2021-04-18 Thread Amit Kapila
On Fri, Apr 16, 2021 at 8:50 AM Justin Pryzby wrote: > > On Fri, Apr 16, 2021 at 08:48:29AM +0530, Amit Kapila wrote: > > I am fine with your proposed changes. There are one or two more > > patches in this area. I can include your suggestions along with those > > if you don't mind? > > However's c

Re: Replication slot stats misgivings

2021-04-18 Thread Amit Kapila
On Sun, Apr 18, 2021 at 6:51 PM Masahiko Sawada wrote: > > Yes, also the following expectation in expected/stats.out is wrong: > > SELECT slot_name, spill_txns = 0 AS spill_txns, spill_count = 0 AS > spill_count, total_txns > 0 AS total_txns, total_bytes > 0 AS > total_bytes FROM pg_stat_replicati

Re: Replication slot stats misgivings

2021-04-18 Thread Masahiko Sawada
On Fri, Apr 16, 2021 at 2:58 PM Amit Kapila wrote: > > On Thu, Apr 15, 2021 at 4:35 PM Masahiko Sawada wrote: > > > > Thank you for the update! The patch looks good to me. > > > > I have pushed the first patch. Comments on the next patch > v13-0001-Use-HTAB-for-replication-slot-statistics: > 1. >

Re: Replication slot stats misgivings

2021-04-18 Thread vignesh C
On Sun, Apr 18, 2021 at 9:02 AM vignesh C wrote: > > On Sun, Apr 18, 2021 at 8:43 AM Amit Kapila wrote: > > > > On Sun, Apr 18, 2021 at 7:36 AM vignesh C wrote: > > > > > > On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > > > > > > > I wrote: > > > > > The buildfarm suggests that this isn't

Re: Replication slot stats misgivings

2021-04-18 Thread Masahiko Sawada
On Sun, Apr 18, 2021 at 12:13 PM Amit Kapila wrote: > > On Sun, Apr 18, 2021 at 7:36 AM vignesh C wrote: > > > > On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > > > > > I wrote: > > > > The buildfarm suggests that this isn't entirely stable: > > > > https://buildfarm.postgresql.org/cgi-bin/s

Re: Replication slot stats misgivings

2021-04-17 Thread vignesh C
On Sun, Apr 18, 2021 at 8:43 AM Amit Kapila wrote: > > On Sun, Apr 18, 2021 at 7:36 AM vignesh C wrote: > > > > On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > > > > > I wrote: > > > > The buildfarm suggests that this isn't entirely stable: > > > > https://buildfarm.postgresql.org/cgi-bin/sh

Re: Replication slot stats misgivings

2021-04-17 Thread Amit Kapila
On Sun, Apr 18, 2021 at 7:36 AM vignesh C wrote: > > On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > > > I wrote: > > > The buildfarm suggests that this isn't entirely stable: > > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=anole&dt=2021-04-17%2011%3A14%3A49 > > > https://buildf

Re: Replication slot stats misgivings

2021-04-17 Thread vignesh C
On Sun, Apr 18, 2021 at 3:51 AM Tom Lane wrote: > > I wrote: > > The buildfarm suggests that this isn't entirely stable: > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=anole&dt=2021-04-17%2011%3A14%3A49 > > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bichir&dt=2021-04-17%2

Re: Replication slot stats misgivings

2021-04-17 Thread Tom Lane
I wrote: > The buildfarm suggests that this isn't entirely stable: > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=anole&dt=2021-04-17%2011%3A14%3A49 > https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bichir&dt=2021-04-17%2016%3A30%3A15 Oh, I missed that hyrax is showing the ident

Re: Replication slot stats misgivings

2021-04-17 Thread Tom Lane
Amit Kapila writes: > I have pushed the first patch. The buildfarm suggests that this isn't entirely stable: https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=anole&dt=2021-04-17%2011%3A14%3A49 https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bichir&dt=2021-04-17%2016%3A30%3A15 Eac

Re: Replication slot stats misgivings

2021-04-16 Thread vignesh C
On Fri, Apr 16, 2021 at 11:28 AM Amit Kapila wrote: > > On Thu, Apr 15, 2021 at 4:35 PM Masahiko Sawada wrote: > > > > Thank you for the update! The patch looks good to me. > > > > I have pushed the first patch. Comments on the next patch > v13-0001-Use-HTAB-for-replication-slot-statistics: Also

Re: Replication slot stats misgivings

2021-04-16 Thread vignesh C
On Fri, Apr 16, 2021 at 3:16 PM Amit Kapila wrote: > > On Mon, Apr 12, 2021 at 2:57 PM vignesh C wrote: > > > > On Sat, Mar 20, 2021 at 9:26 AM Amit Kapila wrote: > > > > > > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > > > > > And then more generally about the feature: > > > >

Re: Replication slot stats misgivings

2021-04-16 Thread Amit Kapila
On Mon, Apr 12, 2021 at 2:57 PM vignesh C wrote: > > On Sat, Mar 20, 2021 at 9:26 AM Amit Kapila wrote: > > > > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > > > And then more generally about the feature: > > > - If a slot was used to stream out a large amount of changes (say an

Re: Replication slot stats misgivings

2021-04-15 Thread Amit Kapila
On Thu, Apr 15, 2021 at 4:35 PM Masahiko Sawada wrote: > > Thank you for the update! The patch looks good to me. > I have pushed the first patch. Comments on the next patch v13-0001-Use-HTAB-for-replication-slot-statistics: 1. + /* + * Check for all replication slots in stats hash table. We do th

Re: Replication slot stats misgivings

2021-04-15 Thread vignesh C
On Thu, Apr 15, 2021 at 2:46 PM Amit Kapila wrote: > > On Thu, Apr 15, 2021 at 1:13 PM Masahiko Sawada wrote: > > > > On Thu, Apr 15, 2021 at 3:22 PM Amit Kapila wrote: > > > > > Thank you for updating the patch. > > > > I have one question on the doc change: > > > > +so the counter is n

Re: Replication slot stats misgivings

2021-04-15 Thread Justin Pryzby
On Fri, Apr 16, 2021 at 08:48:29AM +0530, Amit Kapila wrote: > I am fine with your proposed changes. There are one or two more > patches in this area. I can include your suggestions along with those > if you don't mind? However's convenient is fine -- Justin

Re: Replication slot stats misgivings

2021-04-15 Thread Amit Kapila
On Fri, Apr 16, 2021 at 8:22 AM Justin Pryzby wrote: > > On Thu, Apr 15, 2021 at 02:46:35PM +0530, Amit Kapila wrote: > > On Thu, Apr 15, 2021 at 1:13 PM Masahiko Sawada > > wrote: > > > > > > On Thu, Apr 15, 2021 at 3:22 PM Amit Kapila > > > wrote: > > > > > > > Thank you for updating the pat

Re: Replication slot stats misgivings

2021-04-15 Thread Justin Pryzby
On Thu, Apr 15, 2021 at 02:46:35PM +0530, Amit Kapila wrote: > On Thu, Apr 15, 2021 at 1:13 PM Masahiko Sawada wrote: > > > > On Thu, Apr 15, 2021 at 3:22 PM Amit Kapila wrote: > > > > > Thank you for updating the patch. > > > > I have one question on the doc change: > > > > +so the count

Re: Replication slot stats misgivings

2021-04-15 Thread Masahiko Sawada
On Thu, Apr 15, 2021 at 6:16 PM Amit Kapila wrote: > > On Thu, Apr 15, 2021 at 1:13 PM Masahiko Sawada wrote: > > > > On Thu, Apr 15, 2021 at 3:22 PM Amit Kapila wrote: > > > > > Thank you for updating the patch. > > > > I have one question on the doc change: > > > > +so the counter is n

Re: Replication slot stats misgivings

2021-04-15 Thread Amit Kapila
On Thu, Apr 15, 2021 at 1:13 PM Masahiko Sawada wrote: > > On Thu, Apr 15, 2021 at 3:22 PM Amit Kapila wrote: > > > Thank you for updating the patch. > > I have one question on the doc change: > > +so the counter is not incremented for subtransactions. Note that this > +includes t

Re: Replication slot stats misgivings

2021-04-15 Thread Masahiko Sawada
On Thu, Apr 15, 2021 at 3:22 PM Amit Kapila wrote: > > On Wed, Apr 14, 2021 at 5:52 PM vignesh C wrote: > > > > I have made minor changes to the 0001 and 0002 patches. Attached is > the combined patch for them, I think we can push them as one patch. > Changes made are (a) minor editing in comment

Re: Replication slot stats misgivings

2021-04-15 Thread Amit Kapila
On Thu, Apr 15, 2021 at 12:45 PM vignesh C wrote: > > On Thu, Apr 15, 2021 at 11:52 AM Amit Kapila wrote: > > > > On Wed, Apr 14, 2021 at 5:52 PM vignesh C wrote: > > > > > > > I have made minor changes to the 0001 and 0002 patches. Attached is > > the combined patch for them, I think we can pus

Re: Replication slot stats misgivings

2021-04-15 Thread vignesh C
On Thu, Apr 15, 2021 at 11:52 AM Amit Kapila wrote: > > On Wed, Apr 14, 2021 at 5:52 PM vignesh C wrote: > > > > I have made minor changes to the 0001 and 0002 patches. Attached is > the combined patch for them, I think we can push them as one patch. > Changes made are (a) minor editing in commen

Re: Replication slot stats misgivings

2021-04-14 Thread Amit Kapila
On Wed, Apr 14, 2021 at 5:52 PM vignesh C wrote: > I have made minor changes to the 0001 and 0002 patches. Attached is the combined patch for them, I think we can push them as one patch. Changes made are (a) minor editing in comments, (b) changed the condition when to report stats such that unles

Re: Replication slot stats misgivings

2021-04-14 Thread vignesh C
On Wed, Apr 14, 2021 at 12:09 PM Amit Kapila wrote: > > On Tue, Apr 13, 2021 at 1:37 PM vignesh C wrote: > > > > On Mon, Apr 12, 2021 at 7:03 PM Masahiko Sawada > > wrote: > > > > > > > > > The following test for the latest v8 patch seems to show different. > > > total_bytes is 1808 whereas spi

Re: Replication slot stats misgivings

2021-04-13 Thread Amit Kapila
On Tue, Apr 13, 2021 at 1:37 PM vignesh C wrote: > > On Mon, Apr 12, 2021 at 7:03 PM Masahiko Sawada wrote: > > > > > > The following test for the latest v8 patch seems to show different. > > total_bytes is 1808 whereas spill_bytes is 1320. Am I missing > > something? > > > > postgres(1:85969

Re: Replication slot stats misgivings

2021-04-13 Thread Amit Kapila
On Wed, Apr 14, 2021 at 8:04 AM vignesh C wrote: > > On Wed, Apr 14, 2021 at 7:52 AM Masahiko Sawada wrote: > > > > I've not looked at the patches yet but as Amit mentioned before[1], > > it's better to move 0002 patch to after 0004. That is, 0001 patch > > changes data type to NameData, 0002 pat

Re: Replication slot stats misgivings

2021-04-13 Thread vignesh C
On Wed, Apr 14, 2021 at 7:52 AM Masahiko Sawada wrote: > > On Tue, Apr 13, 2021 at 5:07 PM vignesh C wrote: > > > > On Mon, Apr 12, 2021 at 7:03 PM Masahiko Sawada > > wrote: > > > > > > On Mon, Apr 12, 2021 at 9:36 PM Amit Kapila > > > wrote: > > > > > > > > On Mon, Apr 12, 2021 at 5:29 PM M

Re: Replication slot stats misgivings

2021-04-13 Thread Masahiko Sawada
On Tue, Apr 13, 2021 at 5:07 PM vignesh C wrote: > > On Mon, Apr 12, 2021 at 7:03 PM Masahiko Sawada wrote: > > > > On Mon, Apr 12, 2021 at 9:36 PM Amit Kapila wrote: > > > > > > On Mon, Apr 12, 2021 at 5:29 PM Masahiko Sawada > > > wrote: > > > > > > > > On Mon, Apr 12, 2021 at 8:08 PM Amit K

Re: Replication slot stats misgivings

2021-04-13 Thread vignesh C
On Tue, Apr 13, 2021 at 10:46 AM Masahiko Sawada wrote: > > On Mon, Apr 12, 2021 at 9:16 PM vignesh C wrote: > > > > On Mon, Apr 12, 2021 at 4:46 PM Amit Kapila wrote: > > > > > > On Sat, Apr 10, 2021 at 6:51 PM vignesh C wrote: > > > > > > > > > > Thanks, 0001 and 0002 look good to me. I have

Re: Replication slot stats misgivings

2021-04-13 Thread vignesh C
On Mon, Apr 12, 2021 at 7:03 PM Masahiko Sawada wrote: > > On Mon, Apr 12, 2021 at 9:36 PM Amit Kapila wrote: > > > > On Mon, Apr 12, 2021 at 5:29 PM Masahiko Sawada > > wrote: > > > > > > On Mon, Apr 12, 2021 at 8:08 PM Amit Kapila > > > wrote: > > > > > > > > On Mon, Apr 12, 2021 at 4:34 PM

Re: Replication slot stats misgivings

2021-04-12 Thread Masahiko Sawada
On Mon, Apr 12, 2021 at 9:16 PM vignesh C wrote: > > On Mon, Apr 12, 2021 at 4:46 PM Amit Kapila wrote: > > > > On Sat, Apr 10, 2021 at 6:51 PM vignesh C wrote: > > > > > > > Thanks, 0001 and 0002 look good to me. I have a minor comment for 0002. > > > > > > +total_bytesbigint > > +

Re: Replication slot stats misgivings

2021-04-12 Thread vignesh C
On Mon, Apr 12, 2021 at 7:03 PM Masahiko Sawada wrote: > > On Mon, Apr 12, 2021 at 9:36 PM Amit Kapila wrote: > > > > On Mon, Apr 12, 2021 at 5:29 PM Masahiko Sawada > > wrote: > > > > > > On Mon, Apr 12, 2021 at 8:08 PM Amit Kapila > > > wrote: > > > > > > > > On Mon, Apr 12, 2021 at 4:34 PM

Re: Replication slot stats misgivings

2021-04-12 Thread Masahiko Sawada
On Mon, Apr 12, 2021 at 9:36 PM Amit Kapila wrote: > > On Mon, Apr 12, 2021 at 5:29 PM Masahiko Sawada wrote: > > > > On Mon, Apr 12, 2021 at 8:08 PM Amit Kapila wrote: > > > > > > On Mon, Apr 12, 2021 at 4:34 PM Masahiko Sawada > > > wrote: > > > > > > > > On Mon, Apr 12, 2021 at 6:19 PM Amit

Re: Replication slot stats misgivings

2021-04-12 Thread Amit Kapila
On Mon, Apr 12, 2021 at 5:29 PM Masahiko Sawada wrote: > > On Mon, Apr 12, 2021 at 8:08 PM Amit Kapila wrote: > > > > On Mon, Apr 12, 2021 at 4:34 PM Masahiko Sawada > > wrote: > > > > > > On Mon, Apr 12, 2021 at 6:19 PM Amit Kapila > > > wrote: > > > > > > > > On Mon, Apr 12, 2021 at 10:27 A

Re: Replication slot stats misgivings

2021-04-12 Thread vignesh C
On Mon, Apr 12, 2021 at 4:46 PM Amit Kapila wrote: > > On Sat, Apr 10, 2021 at 6:51 PM vignesh C wrote: > > > > Thanks, 0001 and 0002 look good to me. I have a minor comment for 0002. > > > +total_bytesbigint > + > + > +Amount of decoded transactions data sent to th

Re: Replication slot stats misgivings

2021-04-12 Thread Masahiko Sawada
On Mon, Apr 12, 2021 at 8:08 PM Amit Kapila wrote: > > On Mon, Apr 12, 2021 at 4:34 PM Masahiko Sawada wrote: > > > > On Mon, Apr 12, 2021 at 6:19 PM Amit Kapila wrote: > > > > > > On Mon, Apr 12, 2021 at 10:27 AM Masahiko Sawada > > > wrote: > > > > > > > > On Sat, Apr 10, 2021 at 9:53 PM Ami

Re: Replication slot stats misgivings

2021-04-12 Thread Amit Kapila
On Sat, Apr 10, 2021 at 6:51 PM vignesh C wrote: > Thanks, 0001 and 0002 look good to me. I have a minor comment for 0002. +total_bytesbigint + + +Amount of decoded transactions data sent to the decoding output plugin +while decoding the changes from WAL fo

Re: Replication slot stats misgivings

2021-04-12 Thread vignesh C
On Mon, Apr 12, 2021 at 4:34 PM Masahiko Sawada wrote: > > On Mon, Apr 12, 2021 at 6:19 PM Amit Kapila wrote: > > > > On Mon, Apr 12, 2021 at 10:27 AM Masahiko Sawada > > wrote: > > > > > > On Sat, Apr 10, 2021 at 9:53 PM Amit Kapila > > > wrote: > > > > > > > > > > > > It seems Vignesh has c

Re: Replication slot stats misgivings

2021-04-12 Thread Amit Kapila
On Mon, Apr 12, 2021 at 4:34 PM Masahiko Sawada wrote: > > On Mon, Apr 12, 2021 at 6:19 PM Amit Kapila wrote: > > > > On Mon, Apr 12, 2021 at 10:27 AM Masahiko Sawada > > wrote: > > > > > > On Sat, Apr 10, 2021 at 9:53 PM Amit Kapila > > > wrote: > > > > > > > > > > > > It seems Vignesh has c

Re: Replication slot stats misgivings

2021-04-12 Thread Masahiko Sawada
On Mon, Apr 12, 2021 at 6:19 PM Amit Kapila wrote: > > On Mon, Apr 12, 2021 at 10:27 AM Masahiko Sawada > wrote: > > > > On Sat, Apr 10, 2021 at 9:53 PM Amit Kapila wrote: > > > > > > > > > It seems Vignesh has changed patches based on the latest set of > > > comments so you might want to rebas

Re: Replication slot stats misgivings

2021-04-12 Thread vignesh C
On Sat, Mar 20, 2021 at 9:26 AM Amit Kapila wrote: > > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > And then more generally about the feature: > > - If a slot was used to stream out a large amount of changes (say an > > initial data load), but then replication is interrupted be

Re: Replication slot stats misgivings

2021-04-12 Thread Amit Kapila
On Mon, Apr 12, 2021 at 10:27 AM Masahiko Sawada wrote: > > On Sat, Apr 10, 2021 at 9:53 PM Amit Kapila wrote: > > > > > > It seems Vignesh has changed patches based on the latest set of > > comments so you might want to rebase. > > I've merged my patch into the v6 patch set Vignesh submitted. >

Re: Replication slot stats misgivings

2021-04-11 Thread Masahiko Sawada
On Sat, Apr 10, 2021 at 9:53 PM Amit Kapila wrote: > > On Sat, Apr 10, 2021 at 7:24 AM Masahiko Sawada wrote: > > > > IIUC there are two problems in the case where the drop message is lost: > > > > 1. Writing beyond the end of replSlotStats. > > This can happen if after restarting the number of s

Re: Replication slot stats misgivings

2021-04-11 Thread vignesh C
Thanks for the comments. On Fri, Apr 9, 2021 at 4:13 PM Amit Kapila wrote: > > On Wed, Apr 7, 2021 at 2:51 PM vignesh C wrote: > > > > That is not required, I have modified it. > > Attached v4 patch has the fixes for the same. > > > > Few comments: > > 0001 > -- > 1. The first patch includes

Re: Replication slot stats misgivings

2021-04-10 Thread vignesh C
On Sat, Apr 10, 2021 at 6:24 PM Amit Kapila wrote: > > On Sat, Apr 10, 2021 at 1:06 PM vignesh C wrote: > > > > Thanks Amit for your Patch. I have merged your changes into my > > patchset. I did not find any issues in my testing. > > Thoughts? > > > > 0001 > -- > PgStat_Counter m_stream_byt

Re: Replication slot stats misgivings

2021-04-10 Thread Amit Kapila
On Sat, Apr 10, 2021 at 1:06 PM vignesh C wrote: > > Thanks Amit for your Patch. I have merged your changes into my > patchset. I did not find any issues in my testing. > Thoughts? > 0001 -- PgStat_Counter m_stream_bytes; + PgStat_Counter m_total_txns; + PgStat_Counter m_total_bytes; } PgS

Re: Replication slot stats misgivings

2021-04-10 Thread Amit Kapila
On Sat, Apr 10, 2021 at 7:24 AM Masahiko Sawada wrote: > > IIUC there are two problems in the case where the drop message is lost: > > 1. Writing beyond the end of replSlotStats. > This can happen if after restarting the number of slots whose stats > are stored in the stats file exceeds max_replic

Re: Replication slot stats misgivings

2021-04-10 Thread vignesh C
On Sat, Apr 10, 2021 at 9:50 AM Amit Kapila wrote: > > On Fri, Apr 9, 2021 at 4:13 PM Amit Kapila wrote: > > > > 2. > > @@ -2051,6 +2054,17 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, > > ReorderBufferTXN *txn, > > rb->begin(rb, txn); > > } > > > > + /* > > + * Update total transaction coun

Re: Replication slot stats misgivings

2021-04-09 Thread Amit Kapila
On Sat, Apr 10, 2021 at 9:50 AM Amit Kapila wrote: > > On Fri, Apr 9, 2021 at 4:13 PM Amit Kapila wrote: > > > > 2. > > @@ -2051,6 +2054,17 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, > > ReorderBufferTXN *txn, > > rb->begin(rb, txn); > > } > > > > + /* > > + * Update total transaction coun

Re: Replication slot stats misgivings

2021-04-09 Thread Amit Kapila
On Fri, Apr 9, 2021 at 4:13 PM Amit Kapila wrote: > > 2. > @@ -2051,6 +2054,17 @@ ReorderBufferProcessTXN(ReorderBuffer *rb, > ReorderBufferTXN *txn, > rb->begin(rb, txn); > } > > + /* > + * Update total transaction count and total transaction bytes, if > + * transaction is streamed or spilled

Re: Replication slot stats misgivings

2021-04-09 Thread Masahiko Sawada
On Thu, Apr 8, 2021 at 7:30 PM Amit Kapila wrote: > > On Wed, Apr 7, 2021 at 2:51 PM vignesh C wrote: > > > > @@ -4069,6 +4069,24 @@ pgstat_read_statsfiles(Oid onlydb, bool > permanent, bool deep) > * slot follows. > */ > case 'R': > + /* > + * There is a remote scenario where one of the re

Re: Replication slot stats misgivings

2021-04-09 Thread Amit Kapila
On Wed, Apr 7, 2021 at 2:51 PM vignesh C wrote: > > That is not required, I have modified it. > Attached v4 patch has the fixes for the same. > Few comments: 0001 -- 1. The first patch includes changing char datatype to NameData datatype for slotname. I feel this can be a separate patch from

Re: Replication slot stats misgivings

2021-04-08 Thread vignesh C
On Thu, Apr 8, 2021 at 4:00 PM Amit Kapila wrote: > > On Wed, Apr 7, 2021 at 2:51 PM vignesh C wrote: > > > > @@ -4069,6 +4069,24 @@ pgstat_read_statsfiles(Oid onlydb, bool > permanent, bool deep) > * slot follows. > */ > case 'R': > + /* > + * There is a remote scenario where one of the re

Re: Replication slot stats misgivings

2021-04-08 Thread Amit Kapila
On Wed, Apr 7, 2021 at 2:51 PM vignesh C wrote: > @@ -4069,6 +4069,24 @@ pgstat_read_statsfiles(Oid onlydb, bool permanent, bool deep) * slot follows. */ case 'R': + /* + * There is a remote scenario where one of the replication slots + * is dropped and the drop slot statistics message is n

Re: Replication slot stats misgivings

2021-04-07 Thread vignesh C
On Tue, Apr 6, 2021 at 12:19 PM Amit Kapila wrote: > > On Mon, Apr 5, 2021 at 8:51 PM vignesh C wrote: > > > > Few comments on the latest patches: > Comments on 0001 > > 1. > @@ -659,6 +661,8 @@ ReorderBufferTXNByXid(ReorderBuffer *rb, > TransactionId xid, bool cr

Re: Replication slot stats misgivings

2021-04-06 Thread vignesh C
On Tue, Apr 6, 2021 at 12:19 PM Amit Kapila wrote: > > On Mon, Apr 5, 2021 at 8:51 PM vignesh C wrote: > > > > Few comments on the latest patches: > Comments on 0001 > > 1. > @@ -659,6 +661,8 @@ ReorderBufferTXNByXid(ReorderBuffer *rb, > TransactionId xid, bool cr

Re: Replication slot stats misgivings

2021-04-05 Thread Amit Kapila
On Mon, Apr 5, 2021 at 8:51 PM vignesh C wrote: > Few comments on the latest patches: Comments on 0001 1. @@ -659,6 +661,8 @@ ReorderBufferTXNByXid(ReorderBuffer *rb, TransactionId xid, bool create, dlist_push_tail(&rb->toplevel_by_lsn, &txn->node); AssertTXNL

Re: Replication slot stats misgivings

2021-04-05 Thread Amit Kapila
On Mon, Mar 22, 2021 at 9:55 AM Masahiko Sawada wrote: > > On Sat, Mar 20, 2021 at 3:52 AM Andres Freund wrote: > > > > > > - PgStat_ReplSlotStats etc use slotname[NAMEDATALEN]. Why not just NameData? > > That's because we followed other definitions in pgstat.h that use > char[NAMEDATALEN]. I'm o

Re: Replication slot stats misgivings

2021-04-05 Thread vignesh C
On Sat, Apr 3, 2021 at 11:07 PM vignesh C wrote: > > On Fri, Apr 2, 2021 at 9:29 AM Masahiko Sawada wrote: > > > > On Fri, Apr 2, 2021 at 1:55 AM vignesh C wrote: > > > > > > On Thu, Apr 1, 2021 at 5:58 PM Amit Kapila > > > wrote: > > > > > > > > On Thu, Apr 1, 2021 at 3:43 PM vignesh C wrote

Re: Replication slot stats misgivings

2021-04-05 Thread vignesh C
On Mon, Apr 5, 2021 at 12:44 PM Bharath Rupireddy wrote: > > On Sat, Apr 3, 2021 at 11:12 PM vignesh C 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 no

Re: Replication slot stats misgivings

2021-04-05 Thread Bharath Rupireddy
On Sat, Apr 3, 2021 at 11:12 PM vignesh C 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

Re: Replication slot stats misgivings

2021-04-03 Thread vignesh C
On Fri, Apr 2, 2021 at 11:28 AM Bharath Rupireddy wrote: > > On Fri, Apr 2, 2021 at 9:57 AM vignesh C wrote: > > Thanks for the comments, I will fix the comments and provide a patch > > for this soon. > Thanks for the comments. > Here are some comments: > 1) How about something like below > +

Re: Replication slot stats misgivings

2021-04-03 Thread vignesh C
On Fri, Apr 2, 2021 at 9:29 AM Masahiko Sawada wrote: > > On Fri, Apr 2, 2021 at 1:55 AM vignesh C wrote: > > > > On Thu, Apr 1, 2021 at 5:58 PM Amit Kapila wrote: > > > > > > On Thu, Apr 1, 2021 at 3:43 PM vignesh C wrote: > > > > > > > > On Wed, Mar 31, 2021 at 11:32 AM vignesh C wrote: > >

Re: Replication slot stats misgivings

2021-04-01 Thread Bharath Rupireddy
On Fri, Apr 2, 2021 at 9:57 AM vignesh C wrote: > Thanks for the comments, I will fix the comments and provide a patch > for this soon. Here are some comments: 1) How about something like below +(errmsg("skipping \"%s\" replication slot statistics as the statistic coll

Re: Replication slot stats misgivings

2021-04-01 Thread Amit Kapila
On Thu, Apr 1, 2021 at 6:19 PM Masahiko Sawada wrote: > > On Tue, Mar 30, 2021 at 9:58 AM Andres Freund wrote: > > > > IMO, independent of the shutdown / startup issue, it'd be worth writing > > a patch tracking the bytes sent independently of the slot stats storage > > issues. That would also ma

Re: Replication slot stats misgivings

2021-04-01 Thread vignesh C
On Fri, Apr 2, 2021 at 9:29 AM Masahiko Sawada wrote: > > On Fri, Apr 2, 2021 at 1:55 AM vignesh C wrote: > > > > On Thu, Apr 1, 2021 at 5:58 PM Amit Kapila wrote: > > > > > > On Thu, Apr 1, 2021 at 3:43 PM vignesh C wrote: > > > > > > > > On Wed, Mar 31, 2021 at 11:32 AM vignesh C wrote: > >

Re: Replication slot stats misgivings

2021-04-01 Thread Masahiko Sawada
On Fri, Apr 2, 2021 at 1:55 AM vignesh C wrote: > > On Thu, Apr 1, 2021 at 5:58 PM Amit Kapila wrote: > > > > On Thu, Apr 1, 2021 at 3:43 PM vignesh C wrote: > > > > > > On Wed, Mar 31, 2021 at 11:32 AM vignesh C wrote: > > > > > > > > On Tue, Mar 30, 2021 at 11:00 AM Andres Freund > > > > wr

Re: Replication slot stats misgivings

2021-04-01 Thread vignesh C
On Thu, Apr 1, 2021 at 5:58 PM Amit Kapila wrote: > > On Thu, Apr 1, 2021 at 3:43 PM vignesh C wrote: > > > > On Wed, Mar 31, 2021 at 11:32 AM vignesh C wrote: > > > > > > On Tue, Mar 30, 2021 at 11:00 AM Andres Freund wrote: > > > > > > > > Hi, > > > > > > > > On 2021-03-30 10:13:29 +0530, vig

Re: Replication slot stats misgivings

2021-04-01 Thread Masahiko Sawada
On Tue, Mar 30, 2021 at 9:58 AM Andres Freund wrote: > > IMO, independent of the shutdown / startup issue, it'd be worth writing > a patch tracking the bytes sent independently of the slot stats storage > issues. That would also make the testing for the above cheaper... Agreed. I think the bytes

Re: Replication slot stats misgivings

2021-04-01 Thread Amit Kapila
On Thu, Apr 1, 2021 at 3:43 PM vignesh C wrote: > > On Wed, Mar 31, 2021 at 11:32 AM vignesh C wrote: > > > > On Tue, Mar 30, 2021 at 11:00 AM Andres Freund wrote: > > > > > > Hi, > > > > > > On 2021-03-30 10:13:29 +0530, vignesh C wrote: > > > > On Tue, Mar 30, 2021 at 6:28 AM Andres Freund >

Re: Replication slot stats misgivings

2021-04-01 Thread vignesh C
On Wed, Mar 31, 2021 at 11:32 AM vignesh C wrote: > > On Tue, Mar 30, 2021 at 11:00 AM Andres Freund wrote: > > > > Hi, > > > > On 2021-03-30 10:13:29 +0530, vignesh C wrote: > > > On Tue, Mar 30, 2021 at 6:28 AM Andres Freund wrote: > > > > Any chance you could write a tap test exercising a few

Re: Replication slot stats misgivings

2021-03-30 Thread vignesh C
On Tue, Mar 30, 2021 at 11:00 AM Andres Freund wrote: > > Hi, > > On 2021-03-30 10:13:29 +0530, vignesh C wrote: > > On Tue, Mar 30, 2021 at 6:28 AM Andres Freund wrote: > > > Any chance you could write a tap test exercising a few of these cases? > > > > I can try to write a patch for this if nob

Re: Replication slot stats misgivings

2021-03-29 Thread Andres Freund
Hi, On 2021-03-30 10:13:29 +0530, vignesh C wrote: > On Tue, Mar 30, 2021 at 6:28 AM Andres Freund wrote: > > Any chance you could write a tap test exercising a few of these cases? > > I can try to write a patch for this if nobody objects. Cool! > > E.g. things like: > > > > - create a few slo

Re: Replication slot stats misgivings

2021-03-29 Thread vignesh C
On Tue, Mar 30, 2021 at 6:28 AM Andres Freund wrote: > > Hi, > > On 2021-03-26 07:58:58 +0530, Amit Kapila wrote: > > On Fri, Mar 26, 2021 at 1:17 AM Andres Freund wrote: > > > I suggest we wait doing anything about this until we know if the shared > > > stats patch gets in or not (I'd give it 50

Re: Replication slot stats misgivings

2021-03-29 Thread Andres Freund
Hi, On 2021-03-26 07:58:58 +0530, Amit Kapila wrote: > On Fri, Mar 26, 2021 at 1:17 AM Andres Freund wrote: > > I suggest we wait doing anything about this until we know if the shared > > stats patch gets in or not (I'd give it 50% maybe). If it does get in > > things get a good bit easier, becau

Re: Replication slot stats misgivings

2021-03-25 Thread Amit Kapila
On Fri, Mar 26, 2021 at 1:17 AM Andres Freund wrote: > > Hi, > > On 2021-03-25 17:12:31 +0530, Amit Kapila wrote: > > On Thu, Mar 25, 2021 at 11:36 AM Masahiko Sawada > > wrote: > > > > > > On Wed, Mar 24, 2021 at 7:06 PM Amit Kapila > > > wrote: > > > > > > > > > > > > Leaving aside restart c

Re: Replication slot stats misgivings

2021-03-25 Thread Andres Freund
Hi, On 2021-03-25 17:12:31 +0530, Amit Kapila wrote: > On Thu, Mar 25, 2021 at 11:36 AM Masahiko Sawada > wrote: > > > > On Wed, Mar 24, 2021 at 7:06 PM Amit Kapila wrote: > > > > > > > > > Leaving aside restart case, without some sort of such sanity checking, > > > if both drop (of old slot) a

Re: Replication slot stats misgivings

2021-03-25 Thread Amit Kapila
On Thu, Mar 25, 2021 at 11:36 AM Masahiko Sawada wrote: > > On Wed, Mar 24, 2021 at 7:06 PM Amit Kapila wrote: > > > > > > Leaving aside restart case, without some sort of such sanity checking, > > if both drop (of old slot) and create (of new slot) messages are lost > > then we will start accumu

Re: Replication slot stats misgivings

2021-03-24 Thread Masahiko Sawada
On Wed, Mar 24, 2021 at 7:06 PM Amit Kapila wrote: > > On Tue, Mar 23, 2021 at 10:54 PM Andres Freund wrote: > > > > On 2021-03-23 23:37:14 +0900, Masahiko Sawada wrote: > > > > > > > Maybe we can compare the slot name in the > > > > > received message to the name in the element of replSlotStats.

Re: Replication slot stats misgivings

2021-03-24 Thread Amit Kapila
On Tue, Mar 23, 2021 at 10:54 PM Andres Freund wrote: > > On 2021-03-23 23:37:14 +0900, Masahiko Sawada wrote: > > > > > Maybe we can compare the slot name in the > > > > received message to the name in the element of replSlotStats. If they > > > > don’t match, we swap entries in replSlotStats to

Re: Replication slot stats misgivings

2021-03-23 Thread Andres Freund
Hi, On 2021-03-23 23:37:14 +0900, Masahiko Sawada wrote: > On Tue, Mar 23, 2021 at 3:09 PM Amit Kapila wrote: > > > > On Mon, Mar 22, 2021 at 12:20 PM Masahiko Sawada > > wrote: > > > > > > On Mon, Mar 22, 2021 at 1:25 PM Masahiko Sawada > > > wrote: > > > > > > > > On Sat, Mar 20, 2021 at 3:

Re: Replication slot stats misgivings

2021-03-23 Thread Masahiko Sawada
On Tue, Mar 23, 2021 at 3:09 PM Amit Kapila wrote: > > On Mon, Mar 22, 2021 at 12:20 PM Masahiko Sawada > wrote: > > > > On Mon, Mar 22, 2021 at 1:25 PM Masahiko Sawada > > wrote: > > > > > > On Sat, Mar 20, 2021 at 3:52 AM Andres Freund wrote: > > > > > > > > - If max_replication_slots was l

Re: Replication slot stats misgivings

2021-03-22 Thread Amit Kapila
On Mon, Mar 22, 2021 at 12:20 PM Masahiko Sawada wrote: > > On Mon, Mar 22, 2021 at 1:25 PM Masahiko Sawada wrote: > > > > On Sat, Mar 20, 2021 at 3:52 AM Andres Freund wrote: > > > > > > - If max_replication_slots was lowered between a restart, > > > pgstat_read_statfile() will happily write

Re: Replication slot stats misgivings

2021-03-21 Thread Masahiko Sawada
On Mon, Mar 22, 2021 at 1:25 PM Masahiko Sawada wrote: > > On Sat, Mar 20, 2021 at 3:52 AM Andres Freund wrote: > > > > - If max_replication_slots was lowered between a restart, > > pgstat_read_statfile() will happily write beyond the end of > > replSlotStats. > > I think we cannot restart th

Re: Replication slot stats misgivings

2021-03-21 Thread Masahiko Sawada
On Sat, Mar 20, 2021 at 3:52 AM Andres Freund wrote: > > - If max_replication_slots was lowered between a restart, > pgstat_read_statfile() will happily write beyond the end of > replSlotStats. I think we cannot restart the server after lowering max_replication_slots to a value less than the

Re: Replication slot stats misgivings

2021-03-21 Thread Amit Kapila
On Mon, Mar 22, 2021 at 3:10 AM Andres Freund wrote: > > On 2021-03-21 16:08:00 +0530, Amit Kapila wrote: > > On Sun, Mar 21, 2021 at 2:57 AM Andres Freund wrote: > > > On 2021-03-20 10:28:06 +0530, Amit Kapila wrote: > > > > On Sat, Mar 20, 2021 at 9:25 AM Amit Kapila > > > > wrote: > > > > >

Re: Replication slot stats misgivings

2021-03-21 Thread Andres Freund
Hi, On 2021-03-21 16:08:00 +0530, Amit Kapila wrote: > On Sun, Mar 21, 2021 at 2:57 AM Andres Freund wrote: > > On 2021-03-20 10:28:06 +0530, Amit Kapila wrote: > > > On Sat, Mar 20, 2021 at 9:25 AM Amit Kapila > > > wrote: > > > > This idea is worth exploring to address the complaints but what

Re: Replication slot stats misgivings

2021-03-21 Thread Amit Kapila
On Sun, Mar 21, 2021 at 2:56 AM Andres Freund wrote: > > On 2021-03-20 09:25:40 +0530, Amit Kapila wrote: > > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > > > And then more generally about the feature: > > > - If a slot was used to stream out a large amount of changes (say an > >

Re: Replication slot stats misgivings

2021-03-21 Thread Amit Kapila
On Sun, Mar 21, 2021 at 2:57 AM Andres Freund wrote: > > Hi, > > On 2021-03-20 10:28:06 +0530, Amit Kapila wrote: > > On Sat, Mar 20, 2021 at 9:25 AM Amit Kapila wrote: > > > This idea is worth exploring to address the complaints but what do we > > > do when we detect that the stats are from the

Re: Replication slot stats misgivings

2021-03-20 Thread Andres Freund
Hi, On 2021-03-20 10:28:06 +0530, Amit Kapila wrote: > On Sat, Mar 20, 2021 at 9:25 AM Amit Kapila wrote: > > This idea is worth exploring to address the complaints but what do we > > do when we detect that the stats are from the different slot? It has > > mixed of stats from the old and new slot

Re: Replication slot stats misgivings

2021-03-20 Thread Andres Freund
Hi, On 2021-03-20 09:25:40 +0530, Amit Kapila wrote: > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > And then more generally about the feature: > > - If a slot was used to stream out a large amount of changes (say an > > initial data load), but then replication is interrupted be

Re: Replication slot stats misgivings

2021-03-19 Thread Amit Kapila
On Sat, Mar 20, 2021 at 9:25 AM Amit Kapila wrote: > > On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > > > And then more generally about the feature: > > - If a slot was used to stream out a large amount of changes (say an > > initial data load), but then replication is interrupted be

Re: Replication slot stats misgivings

2021-03-19 Thread Amit Kapila
On Sat, Mar 20, 2021 at 12:22 AM Andres Freund wrote: > > And then more generally about the feature: > - If a slot was used to stream out a large amount of changes (say an > initial data load), but then replication is interrupted before the > transaction is committed/aborted, stream_bytes will

<    1   2   3   >