From 75d905ff91f6badca30c22bf31a51a69bf9c6d3a Mon Sep 17 00:00:00 2001 From: Tatsuo Ishii Date: Fri, 25 Jul 2025 13:55:42 +0900 Subject: [PATCH] Fix watchdog to print inappropriate NOTICE message. read_ipc_socket_and_process() printed a notice message every time when it wrote commands to IPC socket even if it was successful. Fix this to print the notice message only when the write failed. The reason why this bug was not recognized is, the message appears only when log_min_messages is set to notice or higher. Discussion: https://github.com/pgpool/pgpool2/issues/121 Backpatch-through: v4.2 --- src/watchdog/watchdog.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/watchdog/watchdog.c b/src/watchdog/watchdog.c index 693793444..beb5a1519 100644 --- a/src/watchdog/watchdog.c +++ b/src/watchdog/watchdog.c @@ -1939,6 +1939,10 @@ read_sockets(fd_set *rmask, int pending_fds_count) return count; } +/* + * write watchdog IP command along with result data + * returns true on success + */ static bool write_ipc_command_with_result_data(WDCommandData * ipcCommand, char type, char *data, int len) { @@ -2088,7 +2092,7 @@ read_ipc_socket_and_process(int sock, bool *remove_socket) data_len = strlen(data) + 1; } - if (write_ipc_command_with_result_data(ipcCommand, res_type, data, data_len)) + if (!write_ipc_command_with_result_data(ipcCommand, res_type, data, data_len)) { ereport(NOTICE, (errmsg("error writing to IPC socket"))); @@ -3623,6 +3627,10 @@ update_successful_outgoing_cons(fd_set *wmask, int pending_fds_count) return count; } +/* + * write packet to watchdog communication socket + * returns true on success. + */ static bool write_packet_to_socket(int sock, WDPacketData * pkt, bool ipcPacket) { -- 2.39.5