apache/seatunnel · warning

Read config.chunks collection failed

Error message

Read config.chunks collection failed: {}, fallback to SampleSplitter

What it means

ShardedSplitStrategy caught a MongoQueryException other than code 13 while reading config.chunks. It logs this warning with the server error message and falls back to SampleBucketSplitter. Chunk boundaries could not be read, so sampling is used to generate splits.

Solutions

  1. Inspect the logged server error message for the underlying cause.
  2. Retry the job — many causes (balancer churn) are transient.
  3. Verify mongos connectivity and config server health (sh.status()).
  4. Use the SampleSplitter explicitly if chunk reads are persistently unreliable.
Defensive patterns

Strategy: retry

Try / catch

// wrap split planning with retry on MongoQueryException
try {
    return shardedStrategy.split(ctx);
} catch (MongoQueryException e) {
    log.warn("chunk read failed, retrying or falling back", e);
    return sampleStrategy.split(ctx);
}

Prevention

When it happens

Trigger: readChunks(mongoClient, collectionMetadata) issues a query on config.chunks that fails with a non-authorization MongoQueryException (e.g. query failure on the config database, mongos routing error, stale metadata).

Common situations: Transient cluster issues (balancer moving chunks, config server primary changes); shard cluster metadata inconsistencies; network hiccups between connector and mongos.

Understand the failure class

Background: Database query failed: Internal Server Error 500s wrapping SQL, Prisma, and connection failures — what to check first — this error's family across 16 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/e8b8b20cfa4998d2. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-cdc/connector-cdc-mongodb/src/main/java/org/apache/seatunnel/connectors/seatunnel/cdc/mongodb/source/splitters/ShardedSplitStrategy.java:74

        List<BsonDocument> chunks;
        BsonDocument collectionMetadata;
        try {
            collectionMetadata = readCollectionMetadata(mongoClient, collectionId);
            if (!isValidShardedCollection(collectionMetadata)) {
                log.warn(
                        "Collection {} does not appear to be sharded, fallback to SampleSplitter.",
                        collectionId);
                return SampleBucketSplitStrategy.INSTANCE.split(splitContext);
            }
            chunks = readChunks(mongoClient, collectionMetadata);
        } catch (MongoQueryException e) {
            if (e.getErrorCode() == UNAUTHORIZED_ERROR) {
                log.warn(
                        "Unauthorized to read config.collections or config.chunks: {}, fallback to SampleSplitter.",
                        e.getErrorMessage());
            } else {
                log.warn(
                        "Read config.chunks collection failed: {}, fallback to SampleSplitter",
                        e.getErrorMessage());
            }
            return SampleBucketSplitStrategy.INSTANCE.split(splitContext);
        }

        if (chunks.isEmpty()) {
            log.warn(
                    "Collection {} does not appear to be sharded, fallback to SampleSplitter.",
                    collectionId);
            return SampleBucketSplitStrategy.INSTANCE.split(splitContext);
        }

        BsonDocument splitKeys = collectionMetadata.getDocument(SHARD_KEY_FIELD);
        SeaTunnelRowType rowType = shardKeysToRowType(splitKeys);

        List<SnapshotSplit> snapshotSplits = new ArrayList<>(chunks.size());
        for (int i = 0; i < chunks.size(); i++) {

View on GitHub (pinned to cf67b549a7)