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 1qkeTn-00FRjI-NU for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Sep 2023 05:49:59 +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 1qkeTl-00FJtk-TS for pgsql-hackers@arkaria.postgresql.org; Mon, 25 Sep 2023 05:49:57 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qkeTl-00FJtY-J3 for pgsql-hackers@lists.postgresql.org; Mon, 25 Sep 2023 05:49:57 +0000 Received: from oss.nttdata.com ([49.212.34.109]) by magus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qkeTi-007QOX-K5 for pgsql-hackers@lists.postgresql.org; Mon, 25 Sep 2023 05:49:57 +0000 Received: from oss.nttdata.com (localhost [127.0.0.1]) by oss.nttdata.com (Postfix) with ESMTPA id AC3666067A; Mon, 25 Sep 2023 14:49:50 +0900 (JST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at oss.nttdata.com MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 25 Sep 2023 14:49:50 +0900 From: Ryoga Yoshida To: Michael Paquier Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Doesn't pgstat_report_wal() handle the argument "force" incorrectly In-Reply-To: References: <2f6f68343fcd244ef7be5dfae8e55f63@oss.nttdata.com> <5adaf4e34fca5612ff506b47f6e81e47@oss.nttdata.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: bt23yoshidar@oss.nttdata.com List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2023-09-25 14:38, Michael Paquier wrote: > We would not wait on the lock if force=false, which would do > nowait=true. And !force reads the same to me as force=false. > > Anyway, I am OK to remove this part. That seems to confuse you, so > you may not be the only one who would read this comment. When I first read it, I didn't read that !force as force=false, so removing it might be better. > Another idea would be to do like in pgstat.c by adding the following > line, then use "nowait" to call each sub-function: > nowait = !force; > pgstat_flush_wal(nowait); > pgstat_flush_io(nowait); That's very clear and I think it's good. Ryoga Yoshida