Re: Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-03-06 Thread Alvaro Herrera
Craig Ringer wrote: > Revised patch attached. > > I have _not_ rewritten to use sscanf yet. I'll do that next, so you can > choose the fewer-changes patch for backpatching if desired. Pushed, with a further change: it seems more sensible to centralize the whole operation of building the path, ra

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-03-06 Thread Petr Jelinek
On 06/03/18 09:37, Craig Ringer wrote: > > Revised patch attached. > > I have _not_ rewritten to use sscanf yet. I'll do that next, so you > can choose the fewer-changes patch for backpatching if desired.  > > > ... and I'm not convinced it's really an improvement. > >         uint

Re: Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-03-06 Thread Craig Ringer
On 6 March 2018 at 16:07, Craig Ringer wrote: > On 6 March 2018 at 09:58, Craig Ringer wrote: > >> On 5 March 2018 at 23:25, David Steele wrote: >> >>> Hi Craig, >>> >>> On 1/21/18 5:45 PM, Craig Ringer wrote: >>> > On 6 January 2018 at 08:28, Alvaro Herrera >> >

Re: Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-03-06 Thread Craig Ringer
On 6 March 2018 at 09:58, Craig Ringer wrote: > On 5 March 2018 at 23:25, David Steele wrote: > >> Hi Craig, >> >> On 1/21/18 5:45 PM, Craig Ringer wrote: >> > On 6 January 2018 at 08:28, Alvaro Herrera > > > wrote: >> > >> > I think this should use ReadDirExt

Re: Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-03-05 Thread Craig Ringer
On 5 March 2018 at 23:25, David Steele wrote: > Hi Craig, > > On 1/21/18 5:45 PM, Craig Ringer wrote: > > On 6 January 2018 at 08:28, Alvaro Herrera > > wrote: > > > > I think this should use ReadDirExtended with an elevel less than > ERROR, > > and do not

Re: Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-03-05 Thread David Steele
Hi Craig, On 1/21/18 5:45 PM, Craig Ringer wrote: > On 6 January 2018 at 08:28, Alvaro Herrera > wrote: > > I think this should use ReadDirExtended with an elevel less than ERROR, > and do nothing. > > Why have strcmp(.) and strcmp(..)?  These are goi

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-01-21 Thread Craig Ringer
On 6 January 2018 at 08:28, Alvaro Herrera wrote: > I think this should use ReadDirExtended with an elevel less than ERROR, > and do nothing. > > Why have strcmp(.) and strcmp(..)? These are going to be skipped by the > comparison to "xid" prefix anyway. Looks like strcmp processing power > was

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-01-05 Thread Alvaro Herrera
I think this should use ReadDirExtended with an elevel less than ERROR, and do nothing. Why have strcmp(.) and strcmp(..)? These are going to be skipped by the comparison to "xid" prefix anyway. Looks like strcmp processing power waste. Please don't use bare sprintf() -- upgrade to snprintf. W

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-01-04 Thread Craig Ringer
On 5 January 2018 at 12:16, Stephen Frost wrote: > Greetings all, > > * Masahiko Sawada (sawada.m...@gmail.com) wrote: > > On Tue, Dec 26, 2017 at 10:03 PM, Petr Jelinek > > wrote: > > > On 26/12/17 11:13, Masahiko Sawada wrote: > > >> On Tue, Dec 26, 2017 at 12:49 AM, Petr Jelinek > > >> wrote

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2018-01-04 Thread Stephen Frost
Greetings all, * Masahiko Sawada (sawada.m...@gmail.com) wrote: > On Tue, Dec 26, 2017 at 10:03 PM, Petr Jelinek > wrote: > > On 26/12/17 11:13, Masahiko Sawada wrote: > >> On Tue, Dec 26, 2017 at 12:49 AM, Petr Jelinek > >> wrote: > >> > > It's not a problem on crash restart because S

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2017-12-26 Thread Masahiko Sawada
On Tue, Dec 26, 2017 at 10:03 PM, Petr Jelinek wrote: > On 26/12/17 11:13, Masahiko Sawada wrote: >> On Tue, Dec 26, 2017 at 12:49 AM, Petr Jelinek >> wrote: >> It's not a problem on crash restart because StartupReorderBuffer already does the required delete. ReorderBuffe

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2017-12-26 Thread Petr Jelinek
On 26/12/17 11:13, Masahiko Sawada wrote: > On Tue, Dec 26, 2017 at 12:49 AM, Petr Jelinek > wrote: > >>> >>> It's not a problem on crash restart because StartupReorderBuffer already >>> does the required delete. >>> >>> ReorderBufferSerializeTXN, which spills the txns to disk, doesn't appear >>>

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2017-12-26 Thread Masahiko Sawada
On Tue, Dec 26, 2017 at 12:49 AM, Petr Jelinek wrote: > Hi, > > thanks for writing the patch. > > On 05/12/17 06:58, Craig Ringer wrote: >> Hi all >> >> [...] >>> The cause appears to be that walsender.c's ProcessRepliesIfAny writes a >> LOG for unexpected EOF then calls proc_exit(0). But seriali

Re: BUGFIX: standby disconnect can corrupt serialized reorder buffers

2017-12-25 Thread Petr Jelinek
Hi, thanks for writing the patch. On 05/12/17 06:58, Craig Ringer wrote: > Hi all > > [...] >> The cause appears to be that walsender.c's ProcessRepliesIfAny writes a > LOG for unexpected EOF then calls proc_exit(0). But  serialized txn > cleanup is done by  > ReorderBufferRestoreCleanup, as cal

BUGFIX: standby disconnect can corrupt serialized reorder buffers

2017-12-04 Thread Craig Ringer
Hi all TL;DR: we should delete pg_replslot/$SLOTNAME/* at the start of each decoding session or we can accidentally re-use stale reorder buffer contents from prior runs and $BADNESS happens. StartupReorderBuffer() is not sufficient. Details: Petr and I have found a bug in logical decoding where