From: Michael Banck <michael.banck@credativ.de>
To: Magnus Hagander <magnus@hagander.net>
Cc: Pg Hackers <pgsql-hackers@postgresql.org>
Subject: Re: gitlab post-mortem: pg_basebackup waiting for checkpoint
Date: Sat, 11 Feb 2017 11:36:24 +0100
Message-ID: <1486809384.14426.1.camel@credativ.de> (raw)
In-Reply-To: <1486808720.24568.103.camel@credativ.de>
References: <1486805889.24568.96.camel@credativ.de>
<CABUevExpVYuLUgoNgYNNHxFmZqo3PuuaKgcVwYE5B5wCGScZkQ@mail.gmail.com>
<1486808720.24568.103.camel@credativ.de>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
Hi,
Am Samstag, den 11.02.2017, 11:25 +0100 schrieb Michael Banck:
> Am Samstag, den 11.02.2017, 11:07 +0100 schrieb Magnus Hagander:
> > As for the code, while I haven't tested it, isn't the "checkpoint
> > completed" message in the wrong place? Doesn't PQsendQuery() complete
> > immediately, and the check needs to be put *after* the PQgetResult()
> > call?
>
> I guess you're right, I've moved it further down. There is in fact a
> message about the xlog location (unless you switch off wal entirely),
> but having another one right before that mentioning the completed
> checkpoint sounds ok to me.
>
> There's also some inconsistencies around which messages are prepended
> with "pg_basebackup: " and which are translatable; I guess all messages
> printed on --verbose should be translatable? Also, as almost all
> messages have a "pg_basebackup: " prefix, I've added it to the rest.
Sorry, there were two typoes in the last patch, I've attached a fixed
one.
Michael
--
Michael Banck
Projektleiter / Senior Berater
Tel.: +49 2166 9901-171
Fax: +49 2166 9901-100
Email: michael.banck@credativ.de
credativ GmbH, HRB Mönchengladbach 12080
USt-ID-Nummer: DE204566209
Trompeterallee 108, 41189 Mönchengladbach
Geschäftsführung: Dr. Michael Meskes, Jörg Folz, Sascha Heuer
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:
[text/x-patch] pg_basebackup_v3.patch (2.6K, ../1486809384.14426.1.camel@credativ.de/2-pg_basebackup_v3.patch)
download | inline diff:diff --git a/doc/src/sgml/ref/pg_basebackup.sgml b/doc/src/sgml/ref/pg_basebackup.sgmlindex c9dd62c..a298e5c 100644--- a/doc/src/sgml/ref/pg_basebackup.sgml+++ b/doc/src/sgml/ref/pg_basebackup.sgml@@ -660,6 +660,14 @@ PostgreSQL documentation
<title>Notes</title>
<para>
+ At the beginning of the backup, a checkpoint needs to be written on the+ server the backup is taken from. Especially if the option+ <literal>--checkpoint=fast</literal> is not used, this can take some time+ during which <application>pg_basebackup</application> will be idle on the+ server it is running on.+ </para>++ <para>
The backup will include all files in the data directory and tablespaces,
including the configuration files and any additional files placed in the
directory by third parties, except certain temporary files managed by
diff --git a/src/bin/pg_basebackup/pg_basebackup.c b/src/bin/pg_basebackup/pg_basebackup.cindex b6463fa..60200a9 100644--- a/src/bin/pg_basebackup/pg_basebackup.c+++ b/src/bin/pg_basebackup/pg_basebackup.c@@ -1754,6 +1754,11 @@ BaseBackup(void)
if (maxrate > 0)
maxrate_clause = psprintf("MAX_RATE %u", maxrate);
+ if (verbose)+ fprintf(stderr,+ _("%s: initiating base backup, waiting for checkpoint to complete\n"),+ progname);+
basebkp =
psprintf("BASE_BACKUP LABEL '%s' %s %s %s %s %s %s",
escaped_label,
@@ -1791,6 +1796,9 @@ BaseBackup(void)
strlcpy(xlogstart, PQgetvalue(res, 0, 0), sizeof(xlogstart));
+ if (verbose)+ fprintf(stderr, _("%s: checkpoint completed\n"), progname);+
/*
* 9.3 and later sends the TLI of the starting point. With older servers,
* assume it's the same as the latest timeline reported by
@@ -1804,8 +1812,8 @@ BaseBackup(void)
MemSet(xlogend, 0, sizeof(xlogend));
if (verbose && includewal != NO_WAL)
- fprintf(stderr, _("transaction log start point: %s on timeline %u\n"),- xlogstart, starttli);+ fprintf(stderr, _("%s: transaction log start point: %s on timeline %u\n"),+ progname, xlogstart, starttli);
/*
* Get the header
@@ -1907,7 +1915,7 @@ BaseBackup(void)
}
strlcpy(xlogend, PQgetvalue(res, 0, 0), sizeof(xlogend));
if (verbose && includewal != NO_WAL)
- fprintf(stderr, "transaction log end point: %s\n", xlogend);+ fprintf(stderr, _("%s: transaction log end point: %s\n"), progname, xlogend);
PQclear(res);
res = PQgetResult(conn);
@@ -2048,7 +2056,7 @@ BaseBackup(void)
}
if (verbose)
- fprintf(stderr, "%s: base backup completed\n", progname);+ fprintf(stderr, _("%s: base backup completed\n"), progname);
}
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: michael.banck@credativ.de, magnus@hagander.net
Subject: Re: gitlab post-mortem: pg_basebackup waiting for checkpoint
In-Reply-To: <1486809384.14426.1.camel@credativ.de>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox