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 1qh5a0-001APT-Rm for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Sep 2023 09:57:40 +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 1qh5Zz-00Ft9x-Kh for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Sep 2023 09:57:39 +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 1qh5Zz-00Ft9d-AC for pgsql-hackers@lists.postgresql.org; Fri, 15 Sep 2023 09:57:39 +0000 Received: from smtp.outgoing.loopia.se ([93.188.3.37]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qh5Zv-004hJY-ES for pgsql-hackers@lists.postgresql.org; Fri, 15 Sep 2023 09:57:37 +0000 Received: from s807.loopia.se (localhost [127.0.0.1]) by s807.loopia.se (Postfix) with ESMTP id 7275D2FAEB1B for ; Fri, 15 Sep 2023 11:57:32 +0200 (CEST) Received: from s981.loopia.se (unknown [172.22.191.5]) by s807.loopia.se (Postfix) with ESMTP id 632242E285F8; Fri, 15 Sep 2023 11:57:32 +0200 (CEST) Received: from s471.loopia.se (unknown [172.22.191.6]) by s981.loopia.se (Postfix) with ESMTP id 61C2022B17CB; Fri, 15 Sep 2023 11:57:32 +0200 (CEST) X-Virus-Scanned: amavisd-new at amavis.loopia.se X-Spam-Flag: NO X-Spam-Score: -1 X-Spam-Level: X-Spam-Status: No, score=-1 tagged_above=-999 required=6.2 tests=[ALL_TRUSTED=-1] autolearn=disabled Received: from s979.loopia.se ([172.22.191.6]) by s471.loopia.se (s471.loopia.se [172.22.190.35]) (amavisd-new, port 10024) with UTF8LMTP id 3YpZaDdaSt9j; Fri, 15 Sep 2023 11:57:32 +0200 (CEST) X-Loopia-Auth: user X-Loopia-User: daniel@yesql.se X-Loopia-Originating-IP: 89.255.232.193 Received: from smtpclient.apple (customer-89-255-232-193.stosn.net [89.255.232.193]) (Authenticated sender: daniel@yesql.se) by s979.loopia.se (Postfix) with ESMTPSA id E8DF710BC44E; Fri, 15 Sep 2023 11:57:31 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.120.41.1.3\)) Subject: Re: Improve the log message output of basic_archive when basic_archive.archive_directory parameter is not set From: Daniel Gustafsson In-Reply-To: <4109578306242a7cd5661171647e11b2@oss.nttdata.com> Date: Fri, 15 Sep 2023 11:57:31 +0200 Cc: pgsql-hackers@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: <3395F53B-934F-47F9-9BA9-E19AC3842937@yesql.se> References: <4109578306242a7cd5661171647e11b2@oss.nttdata.com> To: bt23nguyent X-Mailer: Apple Mail (2.3696.120.41.1.3) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk > On 15 Sep 2023, at 11:38, bt23nguyent = wrote: >=20 > Hi, >=20 > When archive_library is set to 'basic_archive' but = basic_archive.archive_directory is not set, WAL archiving doesn't work = and only the following warning message is logged. >=20 > $ emacs $PGDATA/postgresql.conf > archive_mode =3D on > archive_library =3D 'basic_archive' >=20 > $ bin/pg_ctl -D $PGDATA restart > .... > WARNING: archive_mode enabled, yet archiving is not configured >=20 > The issue here is that this warning message doesn't suggest any hint = regarding the cause of WAL archiving failure. In other words, I think = that the log message in this case should report that WAL archiving = failed because basic_archive.archive_directory is not set. That doesn't seem unreasonable, and I can imagine other callbacks having = the need to give errhints as well to assist the user. > Thus, I think it's worth implementing new patch that improves that = warning message, and here is the patch for that. -basic_archive_configured(ArchiveModuleState *state) +basic_archive_configured(ArchiveModuleState *state, const char = **errmsg) The variable name errmsg implies that it will contain the errmsg() data = when it in fact is used for errhint() data, so it should be named accordingly. It's probably better to define the interface as ArchiveCheckConfiguredCB functions returning an allocated string in the passed pointer which the = caller is responsible for freeing. -- Daniel Gustafsson