Re: [HACKERS] Replication slot xmin is not reset if HS feedback isturned off while standby is shut down - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: [HACKERS] Replication slot xmin is not reset if HS feedback isturned off while standby is shut down
Date
Msg-id CAMsr+YFCdcT76WMkBq954m7LUBx09f1cYNeCjB9hX8f_nbBtOA@mail.gmail.com
Whole thread Raw
In response to Re: [HACKERS] Replication slot xmin is not reset if HS feedback isturned off while standby is shut down  (Ants Aasma <ants.aasma@eesti.ee>)
List pgsql-hackers
On 21 December 2016 at 21:03, Ants Aasma <ants.aasma@eesti.ee> wrote:

> There was a !HotStandbyActive() check there previously, I was not sure
> if it was only to avoid sending useless messages or was necessary
> because something was not initialized otherwise. Looks like it is not
> needed and can be removed. Revised patch that does so attached.

Ah, see, I'm blind. Too much multi-tasking. Turns out patch review
with a toddler's help is hard ;)

HotStandbyActive() call is actually just checking if we're still in
crash or archive recovery, per

        /*
         * SharedHotStandbyActive indicates if we're still in crash or archive
         * recovery.  Protected by info_lck.
         */
        bool            SharedHotStandbyActive;


so it is appropriate to defer any hot standby feedback until then. By
that point we've definitely finished setting up replication slots for
one thing, and know for sure if we have something useful to say and
won't send the wrong thing.

It looks to me like we should continue to bail out if !HotStandbyActive() . The

    Assert(!master_has_standby_xmin)

can go, since there's now a valid case where master_has_standby_xmin
can be true before HotStandbyActive() is true.

Here's a revised version. I haven't run it against your tests yet.

-- 
 Craig Ringer                   http://www.2ndQuadrant.com/
 PostgreSQL Development, 24x7 Support, Training & Services

-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Attachment

pgsql-hackers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: Re: [HACKERS] Logical tape pause/resume
Next
From: Stas Kelvich
Date:
Subject: Re: [HACKERS] Speedup twophase transactions