pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Alexey Kondratov <a.kondratov@postgrespro.ru>
To: PostgreSQL Hackers <pgsql-hackers@postgresql.org>
To: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
Subject: Fix two issues after moving to unified logging system for command-line utils
Date: Mon, 1 Jul 2019 18:18:33 +0300
Message-ID: <adb41f24-9bf6-7eb3-77de-52a172ef5f4c@postgrespro.ru> (raw)

Hi hackers,

I have found two minor issues with unified logging system for 
command-line programs (commited by Peter cc8d415117), while was rebasing 
my pg_rewind patch:

1) forgotten new-line symbol in pg_fatal call inside pg_rewind, which 
will cause the following Assert in common/logging.c to fire

Assert(fmt[strlen(fmt) - 1] != '\n');

It seems not to be a problem for a production Postgres installation 
without asserts, but should be removed for sanity.

2) swapped progname <-> full_path in initdb.c setup_bin_paths's call 
[1], while logging message remained the same. So the output will be 
rather misleading, since in the pg_ctl and pg_dumpall the previous order 
is used.

Attached is a small patch that fixes these issues.

[1] 
https://github.com/postgres/postgres/commit/cc8d41511721d25d557fc02a46c053c0a602fed0#diff-c4414062a0...



Regards

-- 
Alexey Kondratov

Postgres Professional https://www.postgrespro.com
Russian Postgres Company

Attachments:

v1-0001-Fix-usage-of-unified-logging-pg_log_-in-pg_rewind.patch (text/x-patch, 1.5K) download From 2ea4a17ecc8f9bd57bb676f684fb729279339534 Mon Sep 17 00:00:00 2001 From: Alexey Kondratov <kondratov.aleksey@gmail.com> Date: Mon, 1 Jul 2019 18:11:25 +0300 Subject: [PATCH v1] Fix usage of unified logging pg_log_* in pg_rewind and initdb --- src/bin/initdb/initdb.c | 2 +- src/bin/pg_rewind/pg_rewind.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c index 2ef179165b..70273be783 100644 --- a/src/bin/initdb/initdb.c +++ b/src/bin/initdb/initdb.c @@ -2497,7 +2497,7 @@ setup_bin_paths(const char *argv0) pg_log_error("The program \"postgres\" is needed by %s but was not found in the\n" "same directory as \"%s\".\n" "Check your installation.", - full_path, progname); + progname, full_path); else pg_log_error("The program \"postgres\" was found by \"%s\"\n" "but was not the same version as %s.\n" diff --git a/src/bin/pg_rewind/pg_rewind.c b/src/bin/pg_rewind/pg_rewind.c index 6e77201be6..d378053de4 100644 --- a/src/bin/pg_rewind/pg_rewind.c +++ b/src/bin/pg_rewind/pg_rewind.c @@ -555,7 +555,7 @@ getTimelineHistory(ControlFileData *controlFile, int *nentries) else if (controlFile == &ControlFile_target) histfile = slurpFile(datadir_target, path, NULL); else - pg_fatal("invalid control file\n"); + pg_fatal("invalid control file"); history = rewind_parseTimeLineHistory(histfile, tli, nentries); pg_free(histfile); base-commit: 95bbe5d82e428db342fa3ec60b95f1b9873741e5 -- 2.17.1

view thread (2+ messages)  latest in thread

Message-ID: <adb41f24-9bf6-7eb3-77de-52a172ef5f4c@postgrespro.ru>
Permalink:  ../adb41f24-9bf6-7eb3-77de-52a172ef5f4c@postgrespro.ru/
Also on:    postgresql.org/message-id/adb41f24-9bf6-7eb3-77de-52a172ef5f4c@postgrespro.ru

 ·  · 

reply

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: a.kondratov@postgrespro.ru, peter.eisentraut@2ndquadrant.com
  Subject: Re: Fix two issues after moving to unified logging system for command-line utils
  In-Reply-To: <adb41f24-9bf6-7eb3-77de-52a172ef5f4c@postgrespro.ru>

* 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