Thread: pgsql: Report progress of startup operations that take a long time.

pgsql: Report progress of startup operations that take a long time.

From
Robert Haas
Date:
Report progress of startup operations that take a long time.

Users sometimes get concerned whe they start the server and it
emits a few messages and then doesn't emit any more messages for
a long time. Generally, what's happening is either that the
system is taking a long time to apply WAL, or it's taking a
long time to reset unlogged relations, or it's taking a long
time to fsync the data directory, but it's not easy to tell
which is the case.

To fix that, add a new 'log_startup_progress_interval' setting,
by default 10s. When an operation that is known to be potentially
long-running takes more than this amount of time, we'll log a
status update each time this interval elapses.

To avoid undesirable log chatter, don't log anything about WAL
replay when in standby mode.

Nitin Jadhav and Robert Haas, reviewed by Amul Sul, Bharath
Rupireddy, Justin Pryzby, Michael Paquier, and Álvaro Herrera.

Discussion: https://postgr.es/m/CA+TgmoaHQrgDFOBwgY16XCoMtXxsrVGFB2jNCvb7-ubuEe1MGg@mail.gmail.com
Discussion: https://postgr.es/m/CAMm1aWaHF7VE69572_OLQ+MgpT5RUiUDgF1x5RrtkJBLdpRj3Q@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/9ce346eabf350a130bba46be3f8c50ba28506969

Modified Files
--------------
doc/src/sgml/config.sgml                      | 24 +++++++++
src/backend/access/transam/xlog.c             | 14 ++++++
src/backend/nls.mk                            |  6 ++-
src/backend/postmaster/startup.c              | 71 +++++++++++++++++++++++++++
src/backend/storage/file/fd.c                 | 21 +++++++-
src/backend/storage/file/reinit.c             | 12 +++++
src/backend/utils/misc/guc.c                  | 13 +++++
src/backend/utils/misc/postgresql.conf.sample |  5 ++
src/include/postmaster/startup.h              | 17 +++++++
src/include/utils/timeout.h                   |  1 +
10 files changed, 181 insertions(+), 3 deletions(-)


Re: pgsql: Report progress of startup operations that take a long time.

From
Alvaro Herrera
Date:
On 2021-Oct-25, Robert Haas wrote:

> Report progress of startup operations that take a long time.

I noticed that the docs for this don't mention the default value and how
can it be changed.  I propose something like the attached, where I also
change the order of things so that the example is in a separate
paragraph and the reference blurb is all together.

I was also going to complain that this failed to keep the alphabetical
order of the entries, but there was quite a mess already before this
patch, so I'd rather not get into that.

-- 
Álvaro Herrera              Valdivia, Chile  —  https://www.EnterpriseDB.com/
"World domination is proceeding according to plan"        (Andrew Morton)

Attachment

Re: pgsql: Report progress of startup operations that take a long time.

From
Robert Haas
Date:
On Fri, Oct 29, 2021 at 5:23 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> I noticed that the docs for this don't mention the default value and how
> can it be changed.  I propose something like the attached, where I also
> change the order of things so that the example is in a separate
> paragraph and the reference blurb is all together.

OK. I don't mind that. I wasn't sure if it was our practice to mention
the default value in all cases. Maybe I should have checked more
carefully.

> I was also going to complain that this failed to keep the alphabetical
> order of the entries, but there was quite a mess already before this
> patch, so I'd rather not get into that.

Well, I suppose that's up to you. :-)

-- 
Robert Haas
EDB: http://www.enterprisedb.com



Re: pgsql: Report progress of startup operations that take a long time.

From
Alvaro Herrera
Date:
On 2021-Oct-29, Robert Haas wrote:

> On Fri, Oct 29, 2021 at 5:23 PM Alvaro Herrera <alvherre@alvh.no-ip.org> wrote:
> > I noticed that the docs for this don't mention the default value and how
> > can it be changed.  I propose something like the attached, where I also
> > change the order of things so that the example is in a separate
> > paragraph and the reference blurb is all together.
> 
> OK. I don't mind that. I wasn't sure if it was our practice to mention
> the default value in all cases. Maybe I should have checked more
> carefully.

Thanks.  I only noticed because I got curious about what the default
was :-)

> > I was also going to complain that this failed to keep the alphabetical
> > order of the entries, but there was quite a mess already before this
> > patch, so I'd rather not get into that.
> 
> Well, I suppose that's up to you. :-)

I'll leave that for some other day :-)

-- 
Álvaro Herrera           39°49'30"S 73°17'W  —  https://www.EnterpriseDB.com/
"This is what I like so much about PostgreSQL.  Most of the surprises
are of the "oh wow!  That's cool" Not the "oh shit!" kind.  :)"
Scott Marlowe, http://archives.postgresql.org/pgsql-admin/2008-10/msg00152.php