Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1roywA-004RCf-7Q for pgsql-committers@arkaria.postgresql.org; Tue, 26 Mar 2024 05:01:26 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1royw7-00B5gO-AU for pgsql-committers@arkaria.postgresql.org; Tue, 26 Mar 2024 05:01:23 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1royw7-00B5gG-3M for pgsql-committers@lists.postgresql.org; Tue, 26 Mar 2024 05:01:23 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1royw3-006SSG-Ei for pgsql-committers@lists.postgresql.org; Tue, 26 Mar 2024 05:01:22 +0000 Received: by mail-pg1-x52f.google.com with SMTP id 41be03b00d2f7-5bdbe2de25fso3512572a12.3 for ; Mon, 25 Mar 2024 22:01:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1711429279; x=1712034079; darn=lists.postgresql.org; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:from:to:cc:subject :date:message-id:reply-to; bh=LBDJoDWR3Io4RCj4UXw7rZ6s7X1A32twuz6Is/6rmQY=; b=DjJGYB23c5aNcYGjdoCFRc9GGKNuNveR2NO7K22u8XpcAM9De5JQx4ZgrHSwkoZpXV AzRqcT9jHg1HAEs0jvvOfSt2GSc+iGHIYTbkAxrkYMyLgyNzL0M8dBO1MjP3esWA4H91 x+FBNkFlqN62nsp2e1R+at6pTBWMZVW+OKpT+TT7IiXmvRic35upEXvVw+FaNyzo0ebc 2klhrdFv+fGzuemiCaJCSibpHrSmsS5ECNYUHkMatsR3nElTLaEkLrrYI1wpC4YDA+Vo A/r85UvTd0/2I6c06HUWG88vw+w0Miy5XV+HSR/v2SoDurnN53NPww9cgnQeX92zZSoo 1law== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711429279; x=1712034079; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:from:subject:cc:to:message-id:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=LBDJoDWR3Io4RCj4UXw7rZ6s7X1A32twuz6Is/6rmQY=; b=CYGYa8P49M9VrAFua6IedNgWvXsoqOoWS3A0HDA5iPkv+pWZ/5dQx1hk6Gdvile9qH pruxD8HGQoNTEt9usRo+NJ/ffuLlzQPxb3ZEG3F8ah85DlqwpjunVdeUS0sD+vGJvPLQ AzqnlFWC8aPJPQEntuWJbTB6P5pRfseNaUUBNiRhawdKGNrOi6FGYM+cU44Mi0l2CM+W fMHzPi5uLfeN/jRvd4uoQVTvDYQRgzVRxAVwrWVWsZyMXV/8YDqe59mbjsjzdYr+Kc3D IWpqyVlaXE8OdPGzT1tnUcgQP9S/TUWOp5eoQMcVgnQqaUQpaOuvgpJNquZp81EsnlHF bpJw== X-Gm-Message-State: AOJu0YyLGTZHl2KU8dn/ULX5pkv2wSCv5t1uI4RhSwYYwgDoFZyZk7ES FWPHlirk7SJ/qTifu8PNqTMwJj/vBmInS3dRqfs+VmgG7iCzb3xF X-Google-Smtp-Source: AGHT+IEpDkd4NyXypCTw70ov9f3oiE1aisqt5CUTKoV3ynNNsOkpoNYdnN8JkVtv3gkKn5pXB8oJKA== X-Received: by 2002:a05:6a20:9585:b0:1a3:bc78:fd1 with SMTP id iu5-20020a056a20958500b001a3bc780fd1mr10269227pzb.59.1711429279285; Mon, 25 Mar 2024 22:01:19 -0700 (PDT) Received: from localhost (KD036014041111.ppp-bb.dion.ne.jp. [36.14.41.111]) by smtp.gmail.com with ESMTPSA id n1-20020aa79841000000b006e689b25e38sm5181613pfq.90.2024.03.25.22.01.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 22:01:18 -0700 (PDT) Date: Tue, 26 Mar 2024 14:01:16 +0900 (JST) Message-Id: <20240326.140116.1116279856046587865.horikyota.ntt@gmail.com> To: peter@eisentraut.org Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: pg_createsubscriber: creates a new logical replica from a standb From: Kyotaro Horiguchi In-Reply-To: References: User-Agent: Mew version 6.8 on Emacs 27.2 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Tue_Mar_26_14_01_16_2024_374)--" Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Tue_Mar_26_14_01_16_2024_374)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Hello. This commit added the following error message: pg_createsubscriber.c: 375 > pg_fatal("could not access directory \"%s\": %s", datadir, > strerror(errno)); Although other messages use %s with PQresultErrorMessage(), regarding this specific message, shouldn't we use %m instead of %s + strerror()? I'm not sure if that would be better. pg_createsubscriber.c: 687 > pg_log_error("could not obtain database OID: got %d rows, expected %d rows", > PQntuples(res), 1); pg_createsubscriber.c: 1652 > pg_log_error("could not obtain subscription OID: got %d rows, expected %d rows", In these messages, the second %d is always written as "1 rows", whereas a similar message correctly uses "1 row". pg_createsubscriber.c: 561 > pg_log_error("could not get system identifier: got %d rows, expected %d row", > PQntuples(res), 1); I think it would be better to change the former instances to "%d row", or to change both to "1 row". I'd like to go the second way but maybe we should take the first way following our convention. pg_createsubscriber.c: 923 > pg_log_error("publisher requires wal_level >= logical"); We discussed this message in relation to commit 801792e528, and decided to quote "logical" to clarify that it is a string literal. I'd like to follow the conclusion here, too. regards. -- Kyotaro Horiguchi NTT Open Source Software Center ----Next_Part(Tue_Mar_26_14_01_16_2024_374)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="pg_createsubscriber_message_fixes_v1.patch" diff --git a/src/bin/pg_basebackup/pg_createsubscriber.c b/src/bin/pg_basebackup/pg_createsubscriber.c index b8f8269340..a6e0986670 100644 --- a/src/bin/pg_basebackup/pg_createsubscriber.c +++ b/src/bin/pg_basebackup/pg_createsubscriber.c @@ -372,8 +372,7 @@ check_data_directory(const char *datadir) if (errno == ENOENT) pg_fatal("data directory \"%s\" does not exist", datadir); else - pg_fatal("could not access directory \"%s\": %s", datadir, - strerror(errno)); + pg_fatal("could not access directory \"%s\": %m", datadir); } snprintf(versionfile, MAXPGPATH, "%s/PG_VERSION", datadir); @@ -684,7 +683,7 @@ generate_object_name(PGconn *conn) if (PQntuples(res) != 1) { - pg_log_error("could not obtain database OID: got %d rows, expected %d rows", + pg_log_error("could not obtain database OID: got %d rows, expected %d row", PQntuples(res), 1); disconnect_database(conn, true); } @@ -920,7 +919,7 @@ check_publisher(const struct LogicalRepInfo *dbinfo) if (strcmp(wal_level, "logical") != 0) { - pg_log_error("publisher requires wal_level >= logical"); + pg_log_error("publisher requires wal_level >= \"logical\""); failed = true; } @@ -1649,7 +1648,7 @@ set_replication_progress(PGconn *conn, const struct LogicalRepInfo *dbinfo, cons if (PQntuples(res) != 1 && !dry_run) { - pg_log_error("could not obtain subscription OID: got %d rows, expected %d rows", + pg_log_error("could not obtain subscription OID: got %d rows, expected %d row", PQntuples(res), 1); disconnect_database(conn, true); } ----Next_Part(Tue_Mar_26_14_01_16_2024_374)----