@@ -416,20 +416,12 @@ int main(int argc, char **argv) {
416
416
goto cleanup;
417
417
}
418
418
419
- if (is_running (g_config, p_ndb) != 2 ) {
420
- g_logger.critical (" Failure on data/mgmd node(s)" );
421
- result = ERR_NDB_FAILED;
419
+ if ((result = check_ndb_or_servers_failures (g_config))) {
422
420
break ;
423
421
}
424
422
425
- if (is_running (g_config, p_servers) != 2 ) {
426
- g_logger.critical (" Failure on server(s)" );
427
- result = ERR_SERVERS_FAILED;
428
- break ;
429
- }
430
-
431
- if (is_running (g_config, p_clients) == 0 ) {
432
- break ;
423
+ if (!is_client_running (g_config)) {
424
+ break ;
433
425
}
434
426
435
427
if (!do_command (g_config)) {
@@ -1162,25 +1154,34 @@ bool update_status(atrt_config &config, int types, bool fail_on_missing) {
1162
1154
return true ;
1163
1155
}
1164
1156
1165
- int is_running (atrt_config &config, int types) {
1166
- int found = 0 , running = 0 ;
1157
+ int check_ndb_or_servers_failures (atrt_config &config) {
1158
+ int result = 0 ;
1159
+ const int types = p_ndb | p_servers;
1167
1160
for (unsigned i = 0 ; i < config.m_processes .size (); i++) {
1168
1161
atrt_process &proc = *config.m_processes [i];
1169
1162
if ((types & proc.m_type ) != 0 ) {
1170
- found++;
1171
- if (proc.m_proc .m_status == " running" )
1172
- running++;
1173
- else {
1174
- if (IF_WIN (proc.m_type & atrt_process::AP_MYSQLD, 0 )) {
1175
- running++;
1176
- }
1163
+ if (!(proc.m_proc .m_status == " running" ||
1164
+ IF_WIN (proc.m_type & atrt_process::AP_MYSQLD, 0 ))) {
1165
+ g_logger.critical (" %s #%d not running on %s" , proc.m_name .c_str (),
1166
+ proc.m_index , proc.m_host ->m_hostname .c_str ());
1167
+ if (p_ndb & proc.m_type )
1168
+ result = ERR_NDB_FAILED;
1169
+ else if (p_servers & proc.m_type )
1170
+ result = ERR_SERVERS_FAILED;
1177
1171
}
1178
1172
}
1179
1173
}
1174
+ return result;
1175
+ }
1180
1176
1181
- if (found == running) return 2 ;
1182
- if (running == 0 ) return 0 ;
1183
- return 1 ;
1177
+ bool is_client_running (atrt_config &config) {
1178
+ for (unsigned i = 0 ; i < config.m_processes .size (); i++) {
1179
+ atrt_process &proc = *config.m_processes [i];
1180
+ if ((p_clients & proc.m_type ) != 0 && proc.m_proc .m_status == " running" ) {
1181
+ return true ;
1182
+ }
1183
+ }
1184
+ return false ;
1184
1185
}
1185
1186
1186
1187
bool wait_for_processes_to_stop (atrt_config &config, int types, int retries,
0 commit comments