/** * Logs and gets error call back on the response with the provided error message. * * @param message The error message passed to the logger and the exception * @param query The query with the schema for processing this response */ private void logAndGetErrorCallback(String message, DruidAggregationQuery<?> query) { LOG.error(message); getErrorCallback(query).dispatch( Status.INTERNAL_SERVER_ERROR.getStatusCode(), "The server encountered an unexpected condition which prevented it from fulfilling the request.", message); }
validateJsonResponse(json, query); checkOverflow(json, query); SimplifiedIntervalList overlap = getOverlap(json, query); if (!overlap.isEmpty()) { logAndGetErrorCallback(ErrorMessageFormat.DATA_AVAILABILITY_MISMATCH.format(overlap), query); logAndGetErrorCallback( "Content Not Modified(304), but no etag cache response processor is available to process " + "the 304 response",
/** * Checks and invokes error if the number of missing intervals are overflowed, i.e. more than the configured limit. * * @param json The json object containing the overflow flag * @param query The query with the schema for processing this response */ private void checkOverflow(JsonNode json, DruidAggregationQuery<?> query) { if (json.get(DruidJsonResponseContentKeys.DRUID_RESPONSE_CONTEXT.getName()) .get(DruidJsonResponseContentKeys.UNCOVERED_INTERVALS_OVERFLOWED.getName()) .asBoolean() ) { logAndGetErrorCallback( ErrorMessageFormat.TOO_MANY_INTERVALS_MISSING.format( query.getContext().getUncoveredIntervalsLimit() ), query ); } }
@Override public boolean handleRequest( RequestContext context, DataApiRequest request, DruidAggregationQuery<?> druidQuery, ResponseProcessor response ) { return next.handleRequest( context, request, druidQuery.withContext( druidQuery.getContext().withUncoveredIntervalsLimit(druidUncoveredIntervalLimit) ), new DruidPartialDataResponseProcessor(response) ); } }
logAndGetErrorCallback(ErrorMessageFormat.CONTEXT_AND_STATUS_MISSING_FROM_RESPONSE.format(), query); logAndGetErrorCallback(ErrorMessageFormat.DRUID_RESPONSE_CONTEXT_MISSING_FROM_RESPONSE.format(), query); return; logAndGetErrorCallback( ErrorMessageFormat.UNCOVERED_INTERVALS_MISSING_FROM_RESPONSE.format(), query logAndGetErrorCallback( ErrorMessageFormat.UNCOVERED_INTERVALS_OVERFLOWED_MISSING_FROM_RESPONSE.format(), query logAndGetErrorCallback(ErrorMessageFormat.STATUS_CODE_MISSING_FROM_RESPONSE.format(), query);