nfsantos commented on code in PR #639:
URL: https://github.com/apache/jackrabbit-oak/pull/639#discussion_r929897721
##########
oak-search-elastic/src/main/java/org/apache/jackrabbit/oak/plugins/index/elastic/query/async/ElasticResultRowAsyncIterator.java:
##########
@@ -111,6 +111,21 @@ public boolean hasNext() {
throw new IllegalStateException("Error reading next result
from Elastic", e);
}
}
+
+ // Check if there are any Throwable filled from onFailure Callback in
the errorReference
+ // Any exception (such as ParseException) during the prefetch (init
scanner) via the async call to ES would be available here
+ // when the cursor is actually being traversed.
+ // This is being done so that we can log the caller stack trace in
case of any exception from ES and not just the trace of the async query thread.
+
+ Throwable error = errorRef.getAndSet(null);
+ if (error != null) {
+ Exception e = new Exception();
+ e.setStackTrace(Thread.currentThread().getStackTrace());
Review Comment:
Does this line have any effect? The constructor of `Exception` (actually, of
`Throwable`) calls `fillInStackTrace()`, which should be very similar to what
`Thread.currentThread().getStackTrace()` returns. What do you think about using
the original exception but replacing the stack trace with the caller's trace by
calling `error.fillInStackTrace()`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]