From 576b825d1c71ff826fc1c8a50453fe99c2094c66 Mon Sep 17 00:00:00 2001 From: Igor Motov Date: Fri, 19 Jun 2015 22:09:03 -0400 Subject: [PATCH] Improve logging of repository verification exceptions. 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 --- .../elasticsearch/repositories/RepositoriesService.java | 4 ++-- .../repositories/VerifyNodeRepositoryAction.java | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/core/src/main/java/org/elasticsearch/repositories/RepositoriesService.java b/core/src/main/java/org/elasticsearch/repositories/RepositoriesService.java index a74998aa63e..95666cf8cf4 100644 --- a/core/src/main/java/org/elasticsearch/repositories/RepositoriesService.java +++ b/core/src/main/java/org/elasticsearch/repositories/RepositoriesService.java @@ -217,7 +217,7 @@ public class RepositoriesService extends AbstractComponent implements ClusterSta 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; } @@ -233,7 +233,7 @@ public class RepositoriesService extends AbstractComponent implements ClusterSta 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); } diff --git a/core/src/main/java/org/elasticsearch/repositories/VerifyNodeRepositoryAction.java b/core/src/main/java/org/elasticsearch/repositories/VerifyNodeRepositoryAction.java index 11fb1cb3225..35a168428bf 100644 --- a/core/src/main/java/org/elasticsearch/repositories/VerifyNodeRepositoryAction.java +++ b/core/src/main/java/org/elasticsearch/repositories/VerifyNodeRepositoryAction.java @@ -80,6 +80,7 @@ public class VerifyNodeRepositoryAction extends AbstractComponent { 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) { @@ -146,7 +147,12 @@ public class VerifyNodeRepositoryAction extends AbstractComponent { class VerifyNodeRepositoryRequestHandler implements TransportRequestHandler { @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); } }