From 4ec9fe0b9c9a6a2767fe617e64808901460fb784 Mon Sep 17 00:00:00 2001 From: yjlee Date: Wed, 18 Dec 2024 18:14:24 +0900 Subject: [PATCH 1/3] Change error message format --- src/executables/master_heartbeat.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/executables/master_heartbeat.c b/src/executables/master_heartbeat.c index 5a137fbdf9..9d4b57d1f6 100644 --- a/src/executables/master_heartbeat.c +++ b/src/executables/master_heartbeat.c @@ -3599,7 +3599,7 @@ hb_resource_job_confirm_start (HB_JOB_ARG * arg) /* shutdown working server processes to change its role to slave */ snprintf (hb_info_str, HB_INFO_STR_MAX, "%s The master node failed to restart the server process", HA_FAILBACK_DIAG_STRING); - MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 1, hb_info_str); + MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str); error = hb_resource_job_queue (HB_RJOB_DEMOTE_START_SHUTDOWN, NULL, HB_JOB_TIMER_IMMEDIATELY); assert (error == NO_ERROR); @@ -4158,7 +4158,7 @@ hb_cleanup_conn_and_start_process (CSS_CONN_ENTRY * conn, SOCKET sfd) snprintf (hb_info_str, HB_INFO_STR_MAX, "%s Server process failure repeated within a short period of time. The current node will be demoted", HA_FAILBACK_DIAG_STRING); - MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 1, hb_info_str); + MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 2, hb_info_str, error_string); error = hb_resource_job_queue (HB_RJOB_DEMOTE_START_SHUTDOWN, NULL, HB_JOB_TIMER_IMMEDIATELY); assert (error == NO_ERROR); @@ -4845,7 +4845,7 @@ hb_thread_check_disk_failure (void *arg) snprintf (hb_info_str, HB_INFO_STR_MAX, "%s The master node has lost its role due to server process problem, such as disk failure", HA_FAILOVER_DIAG_STRING); - MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 1, hb_info_str); + MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str); /* be silent to avoid blocking write operation on disk */ hb_disable_er_log (HB_NOLOG_DEMOTE_ON_DISK_FAIL, NULL); From 91005983a84a66b58178975607886e67cc0044cf Mon Sep 17 00:00:00 2001 From: yjlee Date: Fri, 20 Dec 2024 18:24:01 +0900 Subject: [PATCH 2/3] Fix typo and add missing message --- src/executables/master_heartbeat.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/executables/master_heartbeat.c b/src/executables/master_heartbeat.c index 9d4b57d1f6..f6e61d6221 100644 --- a/src/executables/master_heartbeat.c +++ b/src/executables/master_heartbeat.c @@ -4844,13 +4844,17 @@ hb_thread_check_disk_failure (void *arg) { snprintf (hb_info_str, HB_INFO_STR_MAX, "%s The master node has lost its role due to server process problem, such as disk failure", - HA_FAILOVER_DIAG_STRING); + HA_FAILBACK_DIAG_STRING); MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str); /* be silent to avoid blocking write operation on disk */ hb_disable_er_log (HB_NOLOG_DEMOTE_ON_DISK_FAIL, NULL); hb_Resource->state = HB_NSTATE_SLAVE; + snprintf (hb_info_str, HB_INFO_STR_MAX, "%s Current node has been successfully demoted to slave", + HA_FAILBACK_SUCCESS_STRING); + MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str); + pthread_mutex_unlock (&hb_Resource->lock); pthread_mutex_unlock (&hb_Cluster->lock); #if !defined(WINDOWS) From 7e6e49ae244807adc85edf1e30e9c25ce5da50ae Mon Sep 17 00:00:00 2001 From: yjlee Date: Mon, 23 Dec 2024 19:28:10 +0900 Subject: [PATCH 3/3] Change message to node event --- src/executables/master_heartbeat.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/executables/master_heartbeat.c b/src/executables/master_heartbeat.c index f6e61d6221..15782ab335 100644 --- a/src/executables/master_heartbeat.c +++ b/src/executables/master_heartbeat.c @@ -4154,11 +4154,10 @@ hb_cleanup_conn_and_start_process (CSS_CONN_ENTRY * conn, SOCKET sfd) /* demote the current node */ hb_Resource->state = HB_NSTATE_SLAVE; - snprintf (error_string, LINE_MAX, "(args:%s)", proc->args); snprintf (hb_info_str, HB_INFO_STR_MAX, - "%s Server process failure repeated within a short period of time. The current node will be demoted", - HA_FAILBACK_DIAG_STRING); - MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_PROCESS_EVENT, 2, hb_info_str, error_string); + "%s The master node failed to restart the server process due to repeated failures within a short period of time. The current node will be demoted (args:%s)", + HA_FAILBACK_DIAG_STRING, proc->args); + MASTER_ER_SET (ER_ERROR_SEVERITY, ARG_FILE_LINE, ER_HB_NODE_EVENT, 1, hb_info_str); error = hb_resource_job_queue (HB_RJOB_DEMOTE_START_SHUTDOWN, NULL, HB_JOB_TIMER_IMMEDIATELY); assert (error == NO_ERROR);