apache/cassandra · error

Failed to retrieve the sampled data. Abort the background…

Error message

Failed to retrieve the sampled data. Abort the background sampling job: {}.

What it means

Background sampling job in SamplingManager's end-of-sampling runnable failed to retrieve sampled top-K data for a table (exception while collecting CompositeData results). The job aborts for that round; the error is logged with the cause and sampling stops.

Solutions

  1. Check the logged cause (often table dropped or JMX serialization issue mid-sampling).
  2. Restart the sampling job via nodetool if continuous sampling is required.
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at src/java/org/apache/cassandra/metrics/SamplingManager.java:242 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of apache/cassandra@88fd0f6a0e (2026-09-10). Data as JSON: /api/errors/e211a74968ca63c5. Report an issue: GitHub.

Appendix: source

Thrown at src/java/org/apache/cassandra/metrics/SamplingManager.java:242

     * ordering between a "start" and "end" runnable
     */
    private Runnable createSamplingEndRunnable(JobId jobId, Iterable<ColumnFamilyStore> tables, int duration, int interval, int capacity, int count, List<String> samplers)
    {
        return () ->
        {
            Map<String, List<CompositeData>> results = new HashMap<>();
            for (String sampler : samplers)
            {
                List<CompositeData> topk = new ArrayList<>();
                for (ColumnFamilyStore cfs : tables)
                {
                    try
                    {
                        topk.addAll(cfs.finishLocalSampling(sampler, count));
                    }
                    catch (OpenDataException e)
                    {
                        logger.warn("Failed to retrieve the sampled data. Abort the background sampling job: {}.", jobId, e);
                        activeSamplingTasks.remove(jobId);
                        cancelingTasks.remove(jobId);
                        return;
                    }
                }

                topk.sort((left, right) -> Long.compare((long) right.get("count"), (long) left.get("count")));
                // sublist is not serializable for jmx
                topk = new ArrayList<>(topk.subList(0, Math.min(topk.size(), count)));
                results.put(sampler, topk);
            }
            AtomicBoolean first = new AtomicBoolean(false);
            ResultBuilder rb = new ResultBuilder(first, results, samplers);
            logger.info(formatResult(rb));

            // If nobody has canceled us, we ping-pong back to a "begin" runnable to run another profile load
            if (!cancelingTasks.contains(jobId))
            {

View on GitHub (pinned to 88fd0f6a0e)