prestodb/presto · error

UNEXPECTED_ACCUMULO_ERROR

UNEXPECTED_ACCUMULO_ERROR

Error message

Exception when getting index ranges

What it means

PrestoException with code UNEXPECTED_ACCUMULO_ERROR thrown from getIndexRanges when the future gathering Accumulo index ranges fails with an ExecutionException or InterruptedException. The real failure (scan error, table offline, interruption) is attached as the cause. The interrupt flag is restored before throwing so cancellation is not swallowed.

Source

Thrown at presto-accumulo/src/main/java/com/facebook/presto/accumulo/index/IndexLookup.java:365

        }
        tasks.forEach(future ->
        {
            try {
                // If finalRanges is null, we have not yet added any column ranges
                if (finalRanges.isEmpty()) {
                    finalRanges.addAll(future.get());
                }
                else {
                    // Retain only the row IDs for this column that have already been added
                    // This is your set intersection operation!
                    finalRanges.retainAll(future.get());
                }
            }
            catch (ExecutionException | InterruptedException e) {
                if (e instanceof InterruptedException) {
                    Thread.currentThread().interrupt();
                }
                throw new PrestoException(UNEXPECTED_ACCUMULO_ERROR, "Exception when getting index ranges", e.getCause());
            }
        });
        return ImmutableList.copyOf(finalRanges);
    }

    private static void binRanges(int numRangesPerBin, List<Range> splitRanges, List<TabletSplitMetadata> prestoSplits)
    {
        checkArgument(numRangesPerBin > 0, "number of ranges per bin must be greater than zero");
        int toAdd = splitRanges.size();
        int fromIndex = 0;
        int toIndex = Math.min(toAdd, numRangesPerBin);
        do {
            // Add the sublist of range handles
            // Use an empty location because we are binning multiple Ranges spread across many tablet servers
            prestoSplits.add(new TabletSplitMetadata(Optional.empty(), splitRanges.subList(fromIndex, toIndex)));
            toAdd -= toIndex - fromIndex;
            fromIndex = toIndex;
            toIndex += Math.min(toAdd, numRangesPerBin);

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Inspect the cause chain (e.getCause()) for the real Accumulo exception and fix the underlying scan failure
  2. Verify Accumulo connectivity (zookeepers, instance name) and that the index table exists and is online in the Accumulo shell
  3. Retry the query; transient tablet-server or network failures often resolve
  4. If the cause is InterruptedException, check what cancelled the query (timeout, user kill, resource limits) and re-run

Example fix

// before
List<Range> ranges = indexLookup.getIndexRanges(constraints);
// after
try {
    List<Range> ranges = indexLookup.getIndexRanges(constraints);
} catch (PrestoException e) {
    log.warn("index range lookup failed", e.getCause()); // inspect the real cause
    throw e;
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify Accumulo reachability and index table presence before querying
if (!accumuloClient.tableOperations().exists(indexTable)) throw new IllegalStateException("index table missing");
if (!accumuloClient.tableOperations().getOnlineTables().contains(indexTable)) throw new IllegalStateException("index table offline");

Type guard

// narrow the wrapped cause to decide retry vs fail
static boolean isTransientIndexFailure(PrestoException e) {
    Throwable c = e.getCause();
    return c instanceof org.apache.accumulo.core.client.TableOfflineException
        || c instanceof java.io.IOException
        || c instanceof org.apache.thrift.transport.TTransportException;
}

Try / catch

try {
    ranges = indexLookup.getIndexRanges(constraints);
} catch (PrestoException e) {
    if (isTransientIndexFailure(e)) {
        ranges = retryWithBackoff(() -> indexLookup.getIndexRanges(constraints), 3);
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Calling IndexLookup.getIndexRanges (via indexRanges or getRangesWithMetrics) when the underlying Accumulo range-lookup future fails: tablet server unreachable, scan timeout, index table deleted/offlined mid-query, or the query thread being cancelled/interrupted.

Common situations: Accumulo cluster degraded or restarted during a query; wrong zookeeper/instance config making scans hang then fail; user killing the Presto query causing Future cancellation; network partition between Presto workers and Accumulo tservers.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/212b672293a811fc. Report an issue: GitHub.