Thread: [HACKERS] pg_upgrade vs. pg_ctl stop -m fast

[HACKERS] pg_upgrade vs. pg_ctl stop -m fast

From
Peter Eisentraut
Date:
In 9.5, the default pg_ctl stop mode was changed from "smart" to "fast".

In pg_upgrade, there is this code:

void
stop_postmaster(bool fast)
{   ...   exec_prog(SERVER_STOP_LOG_FILE, NULL, !fast,             "\"%s/pg_ctl\" -w -D \"%s\" -o \"%s\" %s stop",
      cluster->bindir, cluster->pgconfig,             cluster->pgopts ? cluster->pgopts : "",             fast ? "-m
fast": "");   ...
 
}

So, when upgrading from 9.5 or later, code that requested a non-fast
shutdown would now always get a fast shutdown.

I think the last line should be changed to something like
             fast ? "-m fast" : "-m smart");

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: [HACKERS] pg_upgrade vs. pg_ctl stop -m fast

From
Tom Lane
Date:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> In 9.5, the default pg_ctl stop mode was changed from "smart" to "fast".
> In pg_upgrade, there is this code:
>     ...
> I think the last line should be changed to something like
>               fast ? "-m fast" : "-m smart");

Ugh.  Clear oversight.

There is maybe room for a separate discussion about whether pg_upgrade
*should* be using fast mode, but if so we could remove the "bool fast"
argument from this function altogether.
        regards, tom lane



Re: [HACKERS] pg_upgrade vs. pg_ctl stop -m fast

From
Bruce Momjian
Date:
On Thu, Jan 12, 2017 at 10:17:52AM -0500, Tom Lane wrote:
> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> > In 9.5, the default pg_ctl stop mode was changed from "smart" to "fast".
> > In pg_upgrade, there is this code:
> >     ...
> > I think the last line should be changed to something like
> >               fast ? "-m fast" : "-m smart");
> 
> Ugh.  Clear oversight.
> 
> There is maybe room for a separate discussion about whether pg_upgrade
> *should* be using fast mode, but if so we could remove the "bool fast"
> argument from this function altogether.

Agreed, it should be remove.  Should I do it?

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://enterprisedb.com

+ As you are, so once was I.  As I am, so you will be. +
+                      Ancient Roman grave inscription +



Re: [HACKERS] pg_upgrade vs. pg_ctl stop -m fast

From
Peter Eisentraut
Date:
On 1/12/17 9:43 PM, Bruce Momjian wrote:
> On Thu, Jan 12, 2017 at 10:17:52AM -0500, Tom Lane wrote:
>> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>>> In 9.5, the default pg_ctl stop mode was changed from "smart" to "fast".
>>> In pg_upgrade, there is this code:
>>>     ...
>>> I think the last line should be changed to something like
>>>               fast ? "-m fast" : "-m smart");
>>
>> Ugh.  Clear oversight.
>>
>> There is maybe room for a separate discussion about whether pg_upgrade
>> *should* be using fast mode, but if so we could remove the "bool fast"
>> argument from this function altogether.
> 
> Agreed, it should be remove.  Should I do it?

For 9.5 and 9.6, I think we should backpatch what I suggested above, to
minimize the behavior change.  For master we can consider removing the
distinction and just use fast shutdown all the time, but I haven't
checked all the possible implications of that change.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



Re: [HACKERS] pg_upgrade vs. pg_ctl stop -m fast

From
Tom Lane
Date:
Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
> On 1/12/17 9:43 PM, Bruce Momjian wrote:
>> On Thu, Jan 12, 2017 at 10:17:52AM -0500, Tom Lane wrote:
>>> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>>>> I think the last line should be changed to something like
>>>> fast ? "-m fast" : "-m smart");

>>> There is maybe room for a separate discussion about whether pg_upgrade
>>> *should* be using fast mode, but if so we could remove the "bool fast"
>>> argument from this function altogether.

>> Agreed, it should be remove.  Should I do it?

> For 9.5 and 9.6, I think we should backpatch what I suggested above, to
> minimize the behavior change.  For master we can consider removing the
> distinction and just use fast shutdown all the time, but I haven't
> checked all the possible implications of that change.

That sounds sensible to me.
        regards, tom lane



Re: [HACKERS] pg_upgrade vs. pg_ctl stop -m fast

From
Peter Eisentraut
Date:
On 1/13/17 9:45 AM, Peter Eisentraut wrote:
> On 1/12/17 9:43 PM, Bruce Momjian wrote:
>> On Thu, Jan 12, 2017 at 10:17:52AM -0500, Tom Lane wrote:
>>> Peter Eisentraut <peter.eisentraut@2ndquadrant.com> writes:
>>>> In 9.5, the default pg_ctl stop mode was changed from "smart" to "fast".
>>>> In pg_upgrade, there is this code:
>>>>     ...
>>>> I think the last line should be changed to something like
>>>>               fast ? "-m fast" : "-m smart");
>>>
>>> Ugh.  Clear oversight.
>>>
>>> There is maybe room for a separate discussion about whether pg_upgrade
>>> *should* be using fast mode, but if so we could remove the "bool fast"
>>> argument from this function altogether.
>>
>> Agreed, it should be remove.  Should I do it?
> 
> For 9.5 and 9.6, I think we should backpatch what I suggested above, to
> minimize the behavior change.

I have committed that (including to master).

> For master we can consider removing the
> distinction and just use fast shutdown all the time, but I haven't
> checked all the possible implications of that change.

I'm not planning to work on this at this time.

-- 
Peter Eisentraut              http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services