Skip to content

Commit

Permalink
Improve logging of repository verification exceptions.
Browse files Browse the repository at this point in the history
Some repository verification exceptions are currently only returned to the users but not logged on the nodes where the exceptions occurred, which makes troubleshooting difficult.

Closes #11760
  • Loading branch information
imotov committed Jun 20, 2015
1 parent 89997e8 commit a24f378
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
Expand Up @@ -21,7 +21,6 @@

import com.google.common.base.Joiner;
import com.google.common.collect.ImmutableMap;
import org.apache.lucene.util.IOUtils;
import org.elasticsearch.ElasticsearchIllegalStateException;
import org.elasticsearch.action.ActionListener;
import org.elasticsearch.cluster.*;
Expand All @@ -34,7 +33,6 @@
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.inject.Inject;
import org.elasticsearch.common.inject.Injector;
import org.elasticsearch.common.inject.Injectors;
import org.elasticsearch.common.inject.ModulesBuilder;
import org.elasticsearch.common.regex.Regex;
import org.elasticsearch.common.settings.Settings;
Expand Down Expand Up @@ -222,7 +220,7 @@ public void onResponse(VerifyResponse verifyResponse) {
try {
repository.endVerification(verificationToken);
} catch (Throwable t) {
logger.warn("[{}] failed to finish repository verification", repositoryName, t);
logger.warn("[{}] failed to finish repository verification", t, repositoryName);
listener.onFailure(t);
return;
}
Expand All @@ -238,7 +236,7 @@ public void onFailure(Throwable e) {
try {
repository.endVerification(verificationToken);
} catch (Throwable t1) {
logger.warn("[{}] failed to finish repository verification", repositoryName, t);
logger.warn("[{}] failed to finish repository verification", t1, repositoryName);
}
listener.onFailure(t);
}
Expand Down
Expand Up @@ -30,7 +30,6 @@
import org.elasticsearch.common.component.AbstractComponent;
import org.elasticsearch.common.io.stream.StreamInput;
import org.elasticsearch.common.io.stream.StreamOutput;
import org.elasticsearch.common.io.stream.Streamable;
import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.index.snapshots.IndexShardRepository;
import org.elasticsearch.threadpool.ThreadPool;
Expand Down Expand Up @@ -86,6 +85,7 @@ public void verify(String repository, String verificationToken, final ActionList
try {
doVerify(repository, verificationToken);
} catch (Throwable t) {
logger.warn("[{}] failed to verify repository", t, repository);
errors.add(new VerificationFailure(node.id(), ExceptionsHelper.detailedMessage(t)));
}
if (counter.decrementAndGet() == 0) {
Expand Down Expand Up @@ -164,7 +164,12 @@ public String executor() {

@Override
public void messageReceived(VerifyNodeRepositoryRequest request, TransportChannel channel) throws Exception {
doVerify(request.repository, request.verificationToken);
try {
doVerify(request.repository, request.verificationToken);
} catch (Exception ex) {
logger.warn("[{}] failed to verify repository", ex, request.repository);
throw ex;
}
channel.sendResponse(TransportResponse.Empty.INSTANCE);
}
}
Expand Down

0 comments on commit a24f378

Please sign in to comment.