{"record":{"id":"e211a74968ca63c5","repo":"apache/cassandra","slug":"failed-to-retrieve-the-sampled-data-abort-the-bac","errorCode":null,"errorMessage":"Failed to retrieve the sampled data. Abort the background sampling job: {}.","messagePattern":"Failed to retrieve the sampled data\\. Abort the background sampling job: (.+?)\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/metrics/SamplingManager.java","lineNumber":242,"sourceCode":"     * ordering between a \"start\" and \"end\" runnable\n     */\n    private Runnable createSamplingEndRunnable(JobId jobId, Iterable<ColumnFamilyStore> tables, int duration, int interval, int capacity, int count, List<String> samplers)\n    {\n        return () ->\n        {\n            Map<String, List<CompositeData>> results = new HashMap<>();\n            for (String sampler : samplers)\n            {\n                List<CompositeData> topk = new ArrayList<>();\n                for (ColumnFamilyStore cfs : tables)\n                {\n                    try\n                    {\n                        topk.addAll(cfs.finishLocalSampling(sampler, count));\n                    }\n                    catch (OpenDataException e)\n                    {\n                        logger.warn(\"Failed to retrieve the sampled data. Abort the background sampling job: {}.\", jobId, e);\n                        activeSamplingTasks.remove(jobId);\n                        cancelingTasks.remove(jobId);\n                        return;\n                    }\n                }\n\n                topk.sort((left, right) -> Long.compare((long) right.get(\"count\"), (long) left.get(\"count\")));\n                // sublist is not serializable for jmx\n                topk = new ArrayList<>(topk.subList(0, Math.min(topk.size(), count)));\n                results.put(sampler, topk);\n            }\n            AtomicBoolean first = new AtomicBoolean(false);\n            ResultBuilder rb = new ResultBuilder(first, results, samplers);\n            logger.info(formatResult(rb));\n\n            // If nobody has canceled us, we ping-pong back to a \"begin\" runnable to run another profile load\n            if (!cancelingTasks.contains(jobId))\n            {","sourceCodeStart":224,"sourceCodeEnd":260,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/metrics/SamplingManager.java#L224-L260","documentation":"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.","triggerScenarios":"Thrown at src/java/org/apache/cassandra/metrics/SamplingManager.java:242 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the logged cause (often table dropped or JMX serialization issue mid-sampling).","Restart the sampling job via nodetool if continuous sampling is required."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}