Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhy4k-0001qD-2G for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 15:18:38 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hhy4i-0000d6-Rs for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 15:18:36 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhy4i-0000cz-Iw for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2019 15:18:36 +0000 Received: from cyclops.postgrespro.ru ([93.174.131.138] helo=mail.postgrespro.ru) by magus.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hhy4g-0007mz-37 for pgsql-hackers@postgresql.org; Mon, 01 Jul 2019 15:18:36 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.postgrespro.ru (Postfix) with ESMTP id 56A5B21C2717; Mon, 1 Jul 2019 18:18:33 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at postgrespro.ru X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=x tagged_above=-99 required=4 WHITELISTED tests=[] autolearn=unavailable Received: from [192.168.27.223] (gw.postgrespro.ru [93.174.131.141]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 2587A21C2668; Mon, 1 Jul 2019 18:18:33 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1561994313; bh=ihTPZxj3SF/Z+eOP6+YQIXC3UhE1M3mtSZ8cX6fLsN0=; h=To:From:Subject:Date; b=eiVr9QDAqF0T2IuaIidQfcqY5XhNLqhSD0SV048FiCMT84JUHTzR7F/iS6HQgUAM5 sx9tB5yJL67JNv2zOtU3JApsVBmnmtuPt8vvlna3PinDpivM12jIpyWH8VMYY++2zJ xz4KIfIbllRNIuMQygZZBG4q1dk1ZtYVUrBeI0CA= To: PostgreSQL Hackers , Peter Eisentraut From: Alexey Kondratov Subject: Fix two issues after moving to unified logging system for command-line utils Message-ID: Date: Mon, 1 Jul 2019 18:18:33 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------0DB63CE8F653DAD250E3D5A4" Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------0DB63CE8F653DAD250E3D5A4 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit 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-c4414062a0071ec15df504d39a6df705R2500 Regards -- Alexey Kondratov Postgres Professional https://www.postgrespro.com Russian Postgres Company --------------0DB63CE8F653DAD250E3D5A4 Content-Type: text/x-patch; name="v1-0001-Fix-usage-of-unified-logging-pg_log_-in-pg_rewind.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="v1-0001-Fix-usage-of-unified-logging-pg_log_-in-pg_rewind.pa"; filename*1="tch" From 2ea4a17ecc8f9bd57bb676f684fb729279339534 Mon Sep 17 00:00:00 2001 From: Alexey Kondratov 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 --------------0DB63CE8F653DAD250E3D5A4--