From: Tatsuo Ishii Date: Fri, 25 Jul 2025 04:55:42 +0000 (+0900) Subject: Fix watchdog to print inappropriate NOTICE message. X-Git-Tag: V4_6_3~6 X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=75d905ff91f6badca30c22bf31a51a69bf9c6d3a;p=pgpool2.git 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 --- 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) {