Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-21 Thread Masahiko Sawada
On Thu, Oct 20, 2022 at 6:54 AM Andres Freund wrote: > > Hi, > > On 2022-10-13 15:57:28 +0900, Masahiko Sawada wrote: > > I've attached an updated patch. I've added the common function to > > start pg_recvlogical and wait for it to become active. Please review > > it. > > > +# Start

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-19 Thread Andres Freund
Hi, On 2022-10-13 15:57:28 +0900, Masahiko Sawada wrote: > I've attached an updated patch. I've added the common function to > start pg_recvlogical and wait for it to become active. Please review > it. > +# Start pg_recvlogical process and wait for it to become active. > +sub

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-13 Thread Masahiko Sawada
On Thu, Oct 13, 2022 at 1:21 AM Andres Freund wrote: > > Hi, > > On 2022-10-11 17:10:52 +0900, Masahiko Sawada wrote: > > +# Reset the replication slot statistics. > > +$node->safe_psql('postgres', > > + "SELECT pg_stat_reset_replication_slot('regression_slot');"); > > +my $result =

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-12 Thread Andres Freund
Hi, On 2022-10-11 17:10:52 +0900, Masahiko Sawada wrote: > +# Reset the replication slot statistics. > +$node->safe_psql('postgres', > + "SELECT pg_stat_reset_replication_slot('regression_slot');"); > +my $result = $node->safe_psql('postgres', > + "SELECT * FROM pg_stat_replication_slots

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-11 Thread Masahiko Sawada
On Sun, Oct 9, 2022 at 2:42 AM Andres Freund wrote: > > On 2022-10-08 09:53:50 -0700, Andres Freund wrote: > > On 2022-10-07 19:56:33 -0700, Andres Freund wrote: > > > I'm planning to push this either later tonight (if I feel up to it after > > > cooking dinner) or tomorrow morning PST, due to

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-08 Thread Jonathan S. Katz
On 10/8/22 1:40 PM, Andres Freund wrote: On 2022-10-08 09:53:50 -0700, Andres Freund wrote: On 2022-10-07 19:56:33 -0700, Andres Freund wrote: I'm planning to push this either later tonight (if I feel up to it after cooking dinner) or tomorrow morning PST, due to the release wrap deadline. I

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-08 Thread Andres Freund
On 2022-10-08 09:53:50 -0700, Andres Freund wrote: > On 2022-10-07 19:56:33 -0700, Andres Freund wrote: > > I'm planning to push this either later tonight (if I feel up to it after > > cooking dinner) or tomorrow morning PST, due to the release wrap deadline. > > I looked this over again, tested a

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-08 Thread Andres Freund
Hi, On 2022-10-07 19:56:33 -0700, Andres Freund wrote: > I'm planning to push this either later tonight (if I feel up to it after > cooking dinner) or tomorrow morning PST, due to the release wrap deadline. I looked this over again, tested a bit more, and pushed the adjusted 15 and master

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-07 Thread Andres Freund
Hi, On 2022-10-07 12:00:56 -0700, Andres Freund wrote: > On 2022-10-07 15:30:43 +0900, Kyotaro Horiguchi wrote: > > The key point of this is this: > > > > +* XXX: I think there cannot actually be data from an older slot > > +* here. After a crash we throw away the old stats data and if

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-07 Thread Andres Freund
Hi, On 2022-10-07 15:30:43 +0900, Kyotaro Horiguchi wrote: > At Fri, 7 Oct 2022 12:14:40 +0900, Masahiko Sawada > wrote in > > > What about if we go the other direction - simply remove the name from the > > > stats entry at all. I don't actually think we need it anymore. Unless I am > > >

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-07 Thread Kyotaro Horiguchi
At Fri, 7 Oct 2022 12:14:40 +0900, Masahiko Sawada wrote in > > What about if we go the other direction - simply remove the name from the > > stats entry at all. I don't actually think we need it anymore. Unless I am > > missing something right now - entirely possible! - the danger that > >

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-06 Thread Masahiko Sawada
On Fri, Oct 7, 2022 at 8:00 AM Andres Freund wrote: > > Hi, > > On 2022-10-06 14:10:46 +0900, Kyotaro Horiguchi wrote: > > +1. FWIW, the atttached is an example of what it looks like if we > > avoid file format change. > > What about if we go the other direction - simply remove the name from the

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-06 Thread Andres Freund
Hi, On 2022-10-06 14:10:46 +0900, Kyotaro Horiguchi wrote: > +1. FWIW, the atttached is an example of what it looks like if we > avoid file format change. What about if we go the other direction - simply remove the name from the stats entry at all. I don't actually think we need it anymore.

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-06 Thread Jonathan S. Katz
On 10/6/22 1:10 AM, Kyotaro Horiguchi wrote: At Thu, 6 Oct 2022 13:44:43 +0900, Michael Paquier wrote in On Wed, Oct 05, 2022 at 11:24:57PM -0400, Jonathan S. Katz wrote: On 10/5/22 8:44 PM, Andres Freund wrote: I have two ideas how to fix it. As a design constraint, I'd be interested in

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-05 Thread Kyotaro Horiguchi
At Thu, 6 Oct 2022 13:44:43 +0900, Michael Paquier wrote in > On Wed, Oct 05, 2022 at 11:24:57PM -0400, Jonathan S. Katz wrote: > > On 10/5/22 8:44 PM, Andres Freund wrote: > >> I have two ideas how to fix it. As a design constraint, I'd be interested > >> in > >> the RMTs opinion on the

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-05 Thread Michael Paquier
On Wed, Oct 05, 2022 at 11:24:57PM -0400, Jonathan S. Katz wrote: > On 10/5/22 8:44 PM, Andres Freund wrote: >> I have two ideas how to fix it. As a design constraint, I'd be interested in >> the RMTs opinion on the following: >> Is a cleaner fix that changes the stats format (i.e. existing stats

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-05 Thread Jonathan S. Katz
On 10/5/22 8:44 PM, Andres Freund wrote: Hi, On 2022-10-05 13:00:53 -0400, Jonathan S. Katz wrote: On 9/27/22 1:52 AM, Kyotaro Horiguchi wrote: Thanks! At Mon, 26 Sep 2022 19:53:02 -0700, Andres Freund wrote in I wonder if the correct fix here wouldn't be to move the slotname out of

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-05 Thread Andres Freund
Hi, On 2022-10-05 13:00:53 -0400, Jonathan S. Katz wrote: > On 9/27/22 1:52 AM, Kyotaro Horiguchi wrote: > > Thanks! > > > > At Mon, 26 Sep 2022 19:53:02 -0700, Andres Freund > > wrote in > > > I wonder if the correct fix here wouldn't be to move the slotname out of > > >

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-10-05 Thread Jonathan S. Katz
On 9/27/22 1:52 AM, Kyotaro Horiguchi wrote: Thanks! At Mon, 26 Sep 2022 19:53:02 -0700, Andres Freund wrote in I wonder if the correct fix here wouldn't be to move the slotname out of PgStat_StatReplSlotEntry? Ugh. Right. I thought its outer struct as purely the part for the common header.

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-26 Thread Kyotaro Horiguchi
Thanks! At Mon, 26 Sep 2022 19:53:02 -0700, Andres Freund wrote in > I wonder if the correct fix here wouldn't be to move the slotname out of > PgStat_StatReplSlotEntry? Ugh. Right. I thought its outer struct as purely the part for the common header. But we can freely place anything after the

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-26 Thread Andres Freund
Hi, I wonder if the correct fix here wouldn't be to move the slotname out of PgStat_StatReplSlotEntry? On 2022-09-16 14:37:17 +0900, Kyotaro Horiguchi wrote: > diff --git a/src/backend/utils/activity/pgstat.c > b/src/backend/utils/activity/pgstat.c > index 6224c498c2..ed3f3af4d9 100644 > ---

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-26 Thread Kyotaro Horiguchi
At Mon, 19 Sep 2022 11:04:03 -0500, Jaime Casanova wrote in > On Fri, Sep 16, 2022 at 02:37:17PM +0900, Kyotaro Horiguchi wrote: > > At Thu, 15 Sep 2022 11:15:12 -0500, Jaime Casanova > > wrote in > > > It fails at ./src/backend/utils/activity/pgstat_shmem.c:530 inside > > > > Thanks for

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-19 Thread Jaime Casanova
On Fri, Sep 16, 2022 at 02:37:17PM +0900, Kyotaro Horiguchi wrote: > At Thu, 15 Sep 2022 11:15:12 -0500, Jaime Casanova > wrote in > > It fails at ./src/backend/utils/activity/pgstat_shmem.c:530 inside > > Thanks for the info. I reproduced by make check.. stupid.. > > It's the thinko about

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-15 Thread Kyotaro Horiguchi
At Thu, 15 Sep 2022 11:15:12 -0500, Jaime Casanova wrote in > It fails at ./src/backend/utils/activity/pgstat_shmem.c:530 inside Thanks for the info. I reproduced by make check.. stupid.. It's the thinko about the base address of reset_off. So the attached doesn't crash.. regards. --

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-15 Thread Jaime Casanova
On Thu, Sep 15, 2022 at 05:30:11PM +0900, Kyotaro Horiguchi wrote: > At Thu, 15 Sep 2022 01:26:15 -0500, Jaime Casanova > wrote in > > On Tue, Sep 13, 2022 at 10:07:50PM -0500, Jaime Casanova wrote: > > > On Tue, Sep 13, 2022 at 06:48:45PM +0900, Kyotaro Horiguchi wrote: > > > > > > > >

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-15 Thread Kyotaro Horiguchi
At Thu, 15 Sep 2022 01:26:15 -0500, Jaime Casanova wrote in > On Tue, Sep 13, 2022 at 10:07:50PM -0500, Jaime Casanova wrote: > > On Tue, Sep 13, 2022 at 06:48:45PM +0900, Kyotaro Horiguchi wrote: > > > > > > Another measure would be to add the region to wipe-out on reset to > > >

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-15 Thread Jaime Casanova
On Tue, Sep 13, 2022 at 10:07:50PM -0500, Jaime Casanova wrote: > On Tue, Sep 13, 2022 at 06:48:45PM +0900, Kyotaro Horiguchi wrote: > > > > Another measure would be to add the region to wipe-out on reset to > > PgStat_KindInfo, but it seems too much.. (attached) > > > > This patch solves the

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-13 Thread Jaime Casanova
On Tue, Sep 13, 2022 at 06:48:45PM +0900, Kyotaro Horiguchi wrote: > Nice finding. > > At Tue, 13 Sep 2022 00:39:45 -0500, Jaime Casanova > wrote in > > and the problem seems to be that after zero'ing the stats that includes > > the name of the replication slot, this simple patch fixes it...

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-13 Thread Kyotaro Horiguchi
Nice finding. At Tue, 13 Sep 2022 00:39:45 -0500, Jaime Casanova wrote in > and the problem seems to be that after zero'ing the stats that includes > the name of the replication slot, this simple patch fixes it... not sure > if it's the right fix though... That doesn't work. since what that

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-12 Thread Jaime Casanova
On Wed, Sep 07, 2022 at 12:39:08PM -0700, Andres Freund wrote: > Hi, > > On 2022-09-06 18:40:49 -0500, Jaime Casanova wrote: > > I'm not sure what is causing this, but I have seen this twice. The > > second time without activity after changing the set of tables in a > > PUBLICATION. This crash

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-09 Thread Jaime Casanova
On Wed, Sep 07, 2022 at 12:39:08PM -0700, Andres Freund wrote: > Hi, > > On 2022-09-06 18:40:49 -0500, Jaime Casanova wrote: > > I'm not sure what is causing this, but I have seen this twice. The > > second time without activity after changing the set of tables in a > > PUBLICATION. > > Can you

Re: START_REPLICATION SLOT causing a crash in an assert build

2022-09-07 Thread Andres Freund
Hi, On 2022-09-06 18:40:49 -0500, Jaime Casanova wrote: > I'm not sure what is causing this, but I have seen this twice. The > second time without activity after changing the set of tables in a > PUBLICATION. Can you describe the steps to reproduce? Which git commit does this happen on? > gdb

START_REPLICATION SLOT causing a crash in an assert build

2022-09-06 Thread Jaime Casanova
Hi, I'm not sure what is causing this, but I have seen this twice. The second time without activity after changing the set of tables in a PUBLICATION. gdb says that debug_query_string contains: """ START_REPLICATION SLOT "sub_pgbench" LOGICAL 0/0 (proto_version '3', publication_names