[ML] Don't log a stack trace when updating a non-open process (elastic/x-pack-elasticsearch#896)

It's possible for a C++ process to exit between the time when a
config update message for it is queued and the time that message
is processed.  This commit ensures we don't spam the log with a
stack trace in this situation, as it's not a problem at all.

relates elastic/x-pack-elasticsearch#891

Original commit: elastic/x-pack-elasticsearch@81af8eaf70
This commit is contained in:
David Roberts 2017-03-31 10:56:46 +01:00 committed by GitHub
parent 0cb2b18265
commit 21bac70d87
1 changed files with 9 additions and 2 deletions

View File

@ -5,6 +5,7 @@
*/
package org.elasticsearch.xpack.ml.job;
import org.elasticsearch.ElasticsearchStatusException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.client.Client;
import org.elasticsearch.cluster.LocalNodeMasterListener;
@ -107,8 +108,14 @@ public class UpdateJobProcessNotifier extends AbstractComponent
@Override
public void onFailure(Exception e) {
logger.error("Failed to update remote job [" + update.getJobId() + "]",
e);
if (e.getMessage().contains("because job [" + update.getJobId() +
"] is not open") && e instanceof ElasticsearchStatusException) {
logger.debug("Remote job [{}] not updated as it is no longer open",
update.getJobId());
} else {
logger.error("Failed to update remote job [" + update.getJobId() + "]",
e);
}
}
});
}