From: Michael Paquier <michael.paquier@gmail.com>
To: Robert Haas <robertmhaas@gmail.com>
Cc: Alvaro Herrera <alvherre@2ndquadrant.com>
Cc: pgsql-hackers@postgresql.org <pgsql-hackers@postgresql.org>
Subject: Re: Re: [COMMITTERS] pgsql: pg_rewind: Fix some problems when copying files >2GB.
Date: Tue, 29 Aug 2017 11:22:12 +0900
Message-ID: <CAB7nPqSSq2_e4DjyR4sKgOoNGxewueF82np4EPHG8cF1tt4yLw@mail.gmail.com> (raw)
In-Reply-To: <CA+Tgmobzki2RY+KhvNx3MOeN4ZRyFs98yetF7T+OfHir7hh__w@mail.gmail.com>
References: <CA+TgmoaDdiOL4DFS07ynmfYJw5kOZwixP83G1YKoV4xRAuH-=g@mail.gmail.com>
<20170828141631.zabmccmic7nmrel4@alvherre.pgsql>
<CA+Tgmobzki2RY+KhvNx3MOeN4ZRyFs98yetF7T+OfHir7hh__w@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-hackers>
On Mon, Aug 28, 2017 at 11:24 PM, Robert Haas <robertmhaas@gmail.com> wrote:
> On Mon, Aug 28, 2017 at 10:16 AM, Alvaro Herrera
> <alvherre@2ndquadrant.com> wrote:
>>> I am fine with however you want to handle it, but it seems odd to me
>>> that we don't have a way of embedding INT64_FORMAT in a translatable
>>> string. Surely that's going to be a problem in some case, sometime,
>>> isn't it?
>>
>> The way we do that elsewhere is to print out the value to a string
>> variable and then use %s in the translatable message.
>
> Hmm. OK. That doesn't sound great, but if there's no better option...
I don't like breaking the abstraction of pg_log() with the existing
flags with some kind of pg_debug() layer. The set of APIs present now
in pg_rewind for logging is nice to have, and I think that those debug
messages should be translated. So what about the attached?
--
Michael
--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackersAttachments:rewind-int64-log.patch (application/octet-stream, 998B) downloaddiff --git a/src/bin/pg_rewind/libpq_fetch.c b/src/bin/pg_rewind/libpq_fetch.cindex a6ff4e3817..ee62c6db88 100644--- a/src/bin/pg_rewind/libpq_fetch.c+++ b/src/bin/pg_rewind/libpq_fetch.c@@ -272,6 +272,7 @@ receiveFileChunks(const char *sql)
int64 chunkoff;
int chunksize;
char *chunk;
+ char chunkoff_str[32];
switch (PQresultStatus(res))
{
@@ -342,8 +343,14 @@ receiveFileChunks(const char *sql)
continue;
}
- pg_log(PG_DEBUG, "received chunk for file \"%s\", offset " INT64_FORMAT ", size %d\n",- filename, chunkoff, chunksize);+ /*+ * Separate step to keep platform-dependent format code out of+ * translatable strings. And we only test for INT64_FORMAT+ * availability in snprintf, not fprintf.+ */+ snprintf(chunkoff_str, sizeof(chunkoff_str), INT64_FORMAT, chunkoff);+ pg_log(PG_DEBUG, "received chunk for file \"%s\", offset %s, size %d\n",+ filename, chunkoff_str, chunksize);
open_target_file(filename, false);
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-committers@postgresql.org
Cc: michael.paquier@gmail.com, robertmhaas@gmail.com, alvherre@2ndquadrant.com, pgsql-hackers@postgresql.org
Subject: Re: Re: [COMMITTERS] pgsql: pg_rewind: Fix some problems when copying files >2GB.
In-Reply-To: <CAB7nPqSSq2_e4DjyR4sKgOoNGxewueF82np4EPHG8cF1tt4yLw@mail.gmail.com>
* 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