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.96) (envelope-from ) id 1vUwIu-009Pd0-0J for pgpool-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 00:19:09 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.96) (envelope-from ) id 1vUwIs-00Ekje-1X for pgpool-hackers@arkaria.postgresql.org; Mon, 15 Dec 2025 00:19:07 +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.96) (envelope-from ) id 1vUwIs-00EkjR-0r for pgpool-hackers@lists.postgresql.org; Mon, 15 Dec 2025 00:19:07 +0000 Received: from meldrar.postgresql.org ([2a02:c0:301:0:ffff::31]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vUwIp-000hBJ-2Y for pgpool-hackers@lists.postgresql.org; Mon, 15 Dec 2025 00:19:06 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=postgresql.org; s=20171124; h=Content-Transfer-Encoding:Content-Type: Mime-Version:References:In-Reply-To:From:Subject:To:Message-Id:Date:Sender: Reply-To:Cc:Content-ID:Content-Description; bh=zahG4BzEwPmE4S91uUH6w5UuiQu/Ll2IjGv4OrN9s7g=; b=iBX/4cjaMJMHrITF6DoWIPqp8e 6/TMzNYV9E/G9QUB7Vopa+qFpM8ZVycCGdTVGEDF2DO42SqTYzmwFoip7sobAxWsx3oASet7OQ+aE tpMjS03/WrjX0RQCCMCeqGXp2LH5VWKjAs1bhs9g2GnXsitK4mWlsrv7xAmEj/gQkhTU2SmxJgEF2 pyfHEEeWuTgU8uFMifI827xEz6PowuNvXIJgbyo4/mF8uUPLt9rVXWnfZOqWzjfprAOYbJ1HYhJIr nb7de7HVLmey7DFbebkSuKLF1Tx4L72VtuOO/Z+x5jXo7BADQ4dwaiAHsuy1SNwd6/336cj9izvcj 8rgqs7Ig==; Received: from [2409:11:4120:300:560c:ccb:f22:e0e2] (helo=localhost) by meldrar.postgresql.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1vUwIm-001O4v-0O for pgpool-hackers@lists.postgresql.org; Mon, 15 Dec 2025 00:19:02 +0000 Date: Mon, 15 Dec 2025 09:18:51 +0900 (JST) Message-Id: <20251215.091851.1058501454610792105.ishii@postgresql.org> To: pgpool-hackers@lists.postgresql.org Subject: Re: Feature: add sync message logging to log_per_node_statement and notice_per_node_statement From: Tatsuo Ishii In-Reply-To: <20251214.220231.820411055090373414.ishii@postgresql.org> References: <20251214.220231.820411055090373414.ishii@postgresql.org> X-Mailer: Mew version 6.8 on Emacs 29.3 Mime-Version: 1.0 Content-Type: Multipart/Mixed; boundary="--Next_Part(Mon_Dec_15_09_18_51_2025_306)--" Content-Transfer-Encoding: 7bit X-Host-Lookup-Failed: Reverse DNS lookup failed for 2409:11:4120:300:560c:ccb:f22:e0e2 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk ----Next_Part(Mon_Dec_15_09_18_51_2025_306)-- Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit > Currently pgpool does not emit logs for a "sync" message when > log_per_node_statement/notice_per_node_statement enabled. Although > "sync" is not a query statement, I think a sync message plays > important role in extended query protocol since it indicates the > completion of series of extended query protocol messages, and logging > a sync message is important in a trouble shooting (I myself often > enable debug message just to know whether a sync message is sent to > backend or not, but enabling debug message creates lots of noise). So > I propose to add logging for a sync message for upcoming Pgpool-II > 4.8. > > Comments or suggestions are welcome. Patch attached. -- Tatsuo Ishii SRA OSS K.K. English: http://www.sraoss.co.jp/index_en/ Japanese:http://www.sraoss.co.jp ----Next_Part(Mon_Dec_15_09_18_51_2025_306)-- Content-Type: Text/X-Patch; charset=us-ascii Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="log_sync_message.patch" diff --git a/src/protocol/pool_process_query.c b/src/protocol/pool_process_query.c index 96334f8e0..0dacbcbc4 100644 --- a/src/protocol/pool_process_query.c +++ b/src/protocol/pool_process_query.c @@ -879,6 +879,14 @@ SimpleForwardToBackend(char kind, POOL_CONNECTION *frontend, pool_write(CONNECTION(backend, i), &kind, 1); pool_write_and_flush(CONNECTION(backend, i), &sendlen, sizeof(sendlen)); + /* If sync message, emit log */ + if (kind == 'S') + { + char *str = "Sync"; + + per_node_statement_log(backend, i, str); + per_node_statement_notice(backend, i, str); + } } } return POOL_CONTINUE; ----Next_Part(Mon_Dec_15_09_18_51_2025_306)----