apache/shardingsphere · error · PipelineInvalidParameterException

Invalid 'chunk-size' value: `${result}`, it should be a posi

Error message

Invalid 'chunk-size' value: `${result}`, it should be a positive integer.

What it means

After successfully parsing 'chunk-size', DataMatchTableDataConsistencyChecker enforces that it is a positive integer; values of 0 or negatives raise PipelineInvalidParameterException('Invalid chunk-size value ... should be a positive integer'). The chunk size controls inventory range width during data matching, so non-positive values would produce empty or infinite dump loops and are rejected up front.

Source

Thrown at kernel/data-pipeline/core/src/main/java/org/apache/shardingsphere/data/pipeline/core/consistencycheck/table/DataMatchTableDataConsistencyChecker.java:73

    @Override
    public void init(final Properties props) {
        chunkSize = getChunkSize(props);
        streamingRangeType = getStreamingRangeType(props);
    }
    
    private int getChunkSize(final Properties props) {
        String chunkSizeText = props.getProperty(CHUNK_SIZE_KEY);
        if (Strings.isNullOrEmpty(chunkSizeText)) {
            return DEFAULT_CHUNK_SIZE;
        }
        int result;
        try {
            result = Integer.parseInt(chunkSizeText);
        } catch (final NumberFormatException ignore) {
            throw new PipelineInvalidParameterException("'chunk-size' is not a valid number: `" + chunkSizeText + "`");
        }
        if (result <= 0) {
            throw new PipelineInvalidParameterException("Invalid 'chunk-size' value: `" + result + "`, it should be a positive integer.");
        }
        return result;
    }
    
    private StreamingRangeType getStreamingRangeType(final Properties props) {
        String streamingRangeTypeText = props.getProperty(STREAMING_RANGE_TYPE_KEY);
        if (Strings.isNullOrEmpty(streamingRangeTypeText)) {
            return DEFAULT_STREAMING_RANGE_TYPE;
        }
        try {
            return StreamingRangeType.valueOf(streamingRangeTypeText.toUpperCase());
        } catch (final IllegalArgumentException ex) {
            throw new PipelineInvalidParameterException("Invalid 'streaming-range-type' value: `" + streamingRangeTypeText
                    + "`, expected values are " + Arrays.toString(StreamingRangeType.values()));
        }
    }
    
    @Override

View on GitHub (pinned to e952770a21)

Solutions

  1. Set chunk-size to a positive integer >= 1 (typical values 1000-50000 depending on row width).
  2. Omit chunk-size to accept the built-in default when unsure.
  3. Add a config lint step that rejects non-positive numeric props before job submission.

Example fix

# before
props:
  chunk-size: 0

# after
props:
  chunk-size: 1000
Defensive patterns

Strategy: validation

Validate before calling

int chunkSize = Integer.parseInt(props.getProperty("chunk-size", String.valueOf(1000)));
if (chunkSize <= 0) {
    throw new IllegalArgumentException("chunk-size must be > 0, got: " + chunkSize);
}

Try / catch

try {
    new DataMatchTableDataConsistencyChecker(props);
} catch (final PipelineInvalidParameterException ex) {
    if (ex.getMessage().contains("chunk-size")) { /* fix prop, resubmit job */ }
}

Prevention

When it happens

Trigger: Configuring chunk-size: 0, a negative number, or an expression that evaluates to <= 0 in the DATA_MATCH algorithm props of a migration/consistency-check job.

Common situations: Copying a config template with chunk-size: 0 meant to mean 'auto'; arithmetic in deployment tooling producing 0 (e.g. dividing batch size); someone lowering chunk-size below 1 to 'reduce load'.

Related errors


AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14). Data as JSON: /api/errors/171ac9a65b60e6d2. Report an issue: GitHub.