Why does analyze_new_cluster.sh use sleep?

Lists: pgsql-hackers
From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Why does analyze_new_cluster.sh use sleep?
Date: 2012-08-23 06:17:44
Message-ID: 1345702664.22401.3.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

The script analyze_new_cluster.sh output by pg_upgrade contains several
"sleep" calls (see contrib/pg_upgrade/check.c). What is the point of
this? If the purpose of this script is to get the database operational
again as soon as possible, waiting a few seconds doing nothing surely
isn't helping.

I could maybe see the point of waiting a bit between the different
vacuumdb calls, to catch some breath, but the one before the first call
to vacuumdb is highly dubious to me.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why does analyze_new_cluster.sh use sleep?
Date: 2012-08-23 21:05:45
Message-ID: 20120823210545.GB10337@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Aug 23, 2012 at 02:17:44AM -0400, Peter Eisentraut wrote:
> The script analyze_new_cluster.sh output by pg_upgrade contains several
> "sleep" calls (see contrib/pg_upgrade/check.c). What is the point of
> this? If the purpose of this script is to get the database operational
> again as soon as possible, waiting a few seconds doing nothing surely
> isn't helping.
>
> I could maybe see the point of waiting a bit between the different
> vacuumdb calls, to catch some breath, but the one before the first call
> to vacuumdb is highly dubious to me.

The sleep is there so the user can read the status message, in case it
scrolls off the screen once the next stage starts.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why does analyze_new_cluster.sh use sleep?
Date: 2012-08-24 03:15:06
Message-ID: 1345778106.9270.2.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, 2012-08-23 at 17:05 -0400, Bruce Momjian wrote:
> On Thu, Aug 23, 2012 at 02:17:44AM -0400, Peter Eisentraut wrote:
> > The script analyze_new_cluster.sh output by pg_upgrade contains several
> > "sleep" calls (see contrib/pg_upgrade/check.c). What is the point of
> > this? If the purpose of this script is to get the database operational
> > again as soon as possible, waiting a few seconds doing nothing surely
> > isn't helping.
> >
> > I could maybe see the point of waiting a bit between the different
> > vacuumdb calls, to catch some breath, but the one before the first call
> > to vacuumdb is highly dubious to me.
>
> The sleep is there so the user can read the status message, in case it
> scrolls off the screen once the next stage starts.

That seems completely arbitrary and contrary to the point of the script.
The pg_upgrade output already explains what the script is for. If we
really wanted the user to confirm what is going to happen, we should
wait for a key press or something. I also don't think that 2 seconds is
enough to read and react to the written text. Also, by that logic, we
need to put a delay between each database processed by vacuumdb as well.


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why does analyze_new_cluster.sh use sleep?
Date: 2012-08-24 12:19:51
Message-ID: 20120824121951.GA23432@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Thu, Aug 23, 2012 at 11:15:06PM -0400, Peter Eisentraut wrote:
> On Thu, 2012-08-23 at 17:05 -0400, Bruce Momjian wrote:
> > On Thu, Aug 23, 2012 at 02:17:44AM -0400, Peter Eisentraut wrote:
> > > The script analyze_new_cluster.sh output by pg_upgrade contains several
> > > "sleep" calls (see contrib/pg_upgrade/check.c). What is the point of
> > > this? If the purpose of this script is to get the database operational
> > > again as soon as possible, waiting a few seconds doing nothing surely
> > > isn't helping.
> > >
> > > I could maybe see the point of waiting a bit between the different
> > > vacuumdb calls, to catch some breath, but the one before the first call
> > > to vacuumdb is highly dubious to me.
> >
> > The sleep is there so the user can read the status message, in case it
> > scrolls off the screen once the next stage starts.
>
> That seems completely arbitrary and contrary to the point of the script.
> The pg_upgrade output already explains what the script is for. If we
> really wanted the user to confirm what is going to happen, we should
> wait for a key press or something. I also don't think that 2 seconds is
> enough to read and react to the written text. Also, by that logic, we
> need to put a delay between each database processed by vacuumdb as well.

Well, the idea is that the script is running stages, and your system is
mostly useful after the first stage is done. I don't see a keypress as
helping there. I think this is different from the vacuumdb case.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +


From: Peter Eisentraut <peter_e(at)gmx(dot)net>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why does analyze_new_cluster.sh use sleep?
Date: 2012-08-27 03:12:15
Message-ID: 1346037135.5873.8.camel@vanquo.pezone.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Fri, 2012-08-24 at 08:19 -0400, Bruce Momjian wrote:
> Well, the idea is that the script is running stages, and your system is
> mostly useful after the first stage is done. I don't see a keypress as
> helping there. I think this is different from the vacuumdb case.

Well, this is all debatable, but we certainly don't need the sleep
before the first vacuum, do we?


From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Why does analyze_new_cluster.sh use sleep?
Date: 2012-08-27 03:23:09
Message-ID: 20120827032309.GD28780@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-hackers

On Sun, Aug 26, 2012 at 11:12:15PM -0400, Peter Eisentraut wrote:
> On Fri, 2012-08-24 at 08:19 -0400, Bruce Momjian wrote:
> > Well, the idea is that the script is running stages, and your system is
> > mostly useful after the first stage is done. I don't see a keypress as
> > helping there. I think this is different from the vacuumdb case.
>
> Well, this is all debatable, but we certainly don't need the sleep
> before the first vacuum, do we?

That sleep is there so they can react to this line:

fprintf(script, "echo %sIf you would like default statistics as
quickly as possible, cancel%s\n",

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ It's impossible for everything to be true. +