apache/cassandra · error · IllegalArgumentException

Number of concurrent compactors should be greater than 0.

Error message

Number of concurrent compactors should be greater than 0.

What it means

Thrown by StorageService.setConcurrentCompactors when a JMX or configuration caller attempts to set the number of concurrent compaction threads to zero or a negative value. Cassandra requires at least one compactor thread to make progress on compaction work, so non-positive values are rejected before updating DatabaseDescriptor and CompactionManager.

Source

Thrown at src/java/org/apache/cassandra/service/StorageService.java:1508

    {
        return DatabaseDescriptor.getBatchlogReplayThrottleInKiB();
    }

    public void setBatchlogReplayThrottleInKB(int throttleInKB)
    {
        DatabaseDescriptor.setBatchlogReplayThrottleInKiB(throttleInKB);
        BatchlogManager.instance.setRate(throttleInKB);
    }

    public int getConcurrentCompactors()
    {
        return DatabaseDescriptor.getConcurrentCompactors();
    }

    public void setConcurrentCompactors(int value)
    {
        if (value <= 0)
            throw new IllegalArgumentException("Number of concurrent compactors should be greater than 0.");
        DatabaseDescriptor.setConcurrentCompactors(value);
        CompactionManager.instance.setConcurrentCompactors(value);
    }

    public void bypassConcurrentValidatorsLimit()
    {
        logger.info("Enabling the ability to set concurrent validations to an unlimited value");
        DatabaseDescriptor.allowUnlimitedConcurrentValidations = true ;
    }

    public void enforceConcurrentValidatorsLimit()
    {
        logger.info("Disabling the ability to set concurrent validations to an unlimited value");
        DatabaseDescriptor.allowUnlimitedConcurrentValidations = false ;
    }

    public boolean isConcurrentValidatorsLimitEnforced()
    {

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Pass a positive integer, e.g. setConcurrentCompactors(2) or set concurrent_compactors to at least 1 in cassandra.yaml
  2. If compaction should be paused, use nodetool disableautocompaction instead of setting compactors to 0
  3. Verify the runtime environment exposes at least 1 CPU so core-count-derived defaults are >= 1

Example fix

// before
storageService.setConcurrentCompactors(0); // IllegalArgumentException
// after
int compactors = Math.max(1, Runtime.getRuntime().availableProcessors() / 2);
storageService.setConcurrentCompactors(compactors);
Defensive patterns

Strategy: validation

Validate before calling

if (value <= 0) throw new IllegalArgumentException("concurrentCompactors must be >= 1, got " + value);
storageService.setConcurrentCompactors(value);

Type guard

boolean isValidCompactorCount(int v) { return v > 0; }

Try / catch

try { storageService.setConcurrentCompactors(value); } catch (IllegalArgumentException e) { logger.warn("Invalid concurrent_compactors: {}", value, e); }

Prevention

When it happens

Trigger: Calling StorageService.setConcurrentCompactors(value) via JMX (mx4j/JConsole) or programmatically with value <= 0; setting concurrent_compactors in cassandra.yaml to 0 or a negative number and applying it at runtime.

Common situations: Operators mis-editing cassandra.yaml and setting concurrent_compactors: 0 thinking it disables compaction; automation scripts computing the value as a fraction of CPU cores that round down to 0 on small containers (e.g. 0.5 CPU cgroup limits); passing an uninitialized/absent config variable.

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


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