Details
Description
Currently, the frontend sets the "Query compilation" timeline only if doCreateExecRequest() finishes successfully.
private TExecRequest doCreateExecRequest(TQueryCtx queryCtx...) { ...... <snip>...... timeline.markEvent("Planning finished"); result.setTimeline(timeline.toThrift()); return result; }
There can be cases where the timeline could be useful for debugging when the planning fails.
One recent case I came across is the exhaustion of retries on InconsistentMetadataFetchException. For every retry of query due to this exception, we add a timeline event.
while (true) { try { return doCreateExecRequest(queryCtx, timeline, explainString); } catch (InconsistentMetadataFetchException e) { if (attempt++ == INCONSISTENT_METADATA_NUM_RETRIES) { throw e; } if (attempt > 1) { // Back-off a bit on later retries. Uninterruptibles.sleepUninterruptibly(200 * attempt, TimeUnit.MILLISECONDS); } timeline.markEvent( String.format("Retrying query planning due to inconsistent metadata " + "fetch, attempt %s of %s: ", attempt, INCONSISTENT_METADATA_NUM_RETRIES) + e.getMessage());
However, if the planning eventually fails, the timeline about retries is gone. This would've confirmed that the query was re-tried for 10 times.
Would be really useful if we can populate the partial timeline, even if the planning failed.