[7.x] Ensure that the monitoring export exceptions are logged. (#56237) (#56251)

If an exception occurs while flushing a bulk the cause of the exception
can be lost. This commit ensures that cause of the exception is carried
forward and gets logged.
This commit is contained in:
Jake Landis 2020-05-05 19:24:26 -05:00 committed by GitHub
parent 133ba2691f
commit a22690c9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -88,7 +88,7 @@ public abstract class ExportBulk {
bulk.add(docs); bulk.add(docs);
} catch (ExportException e) { } catch (ExportException e) {
if (exception == null) { if (exception == null) {
exception = new ExportException("failed to add documents to export bulks"); exception = new ExportException("failed to add documents to export bulks", e);
} }
exception.addExportException(e); exception.addExportException(e);
} }

View File

@ -243,7 +243,12 @@ public class Exporters extends AbstractLifecycleComponent {
} else { } else {
listener.onFailure(exceptionRef.get()); listener.onFailure(exceptionRef.get());
} }
}, listener::onFailure)); }, (exception) -> {
if (exceptionRef.get() != null) {
exception.addSuppressed(exceptionRef.get());
}
listener.onFailure(exception);
}));
} }
} }