apache/cassandra · error · UnsupportedOperationException

Bloom filter size is > 16GB, reduce the bloom_filter_fp_chan

Error message

Bloom filter size is > 16GB, reduce the bloom_filter_fp_chance

What it means

OffHeapBitSet sizes its off-heap bit array from the requested bit count; if that requires more than Integer.MAX_VALUE 64-bit words (i.e. > 16GB) it refuses with UnsupportedOperationException because the word count cannot be stored in an int. The bloom filter derived from bloom_filter_fp_chance is too large.

Source

Thrown at src/java/org/apache/cassandra/utils/obs/OffHeapBitSet.java:46

import org.apache.cassandra.io.util.Memory;
import org.apache.cassandra.io.util.MemoryOutputStream;
import org.apache.cassandra.utils.FBUtilities;
import org.apache.cassandra.utils.concurrent.Ref;

/**
 * Off-heap bitset,
 * file compatible with OpeBitSet
 */
public class OffHeapBitSet implements IBitSet
{
    private final Memory bytes;

    public OffHeapBitSet(long numBits)
    {
        /** returns the number of 64 bit words it would take to hold numBits */
        long wordCount = (((numBits - 1) >>> 6) + 1);
        if (wordCount > Integer.MAX_VALUE)
            throw new UnsupportedOperationException("Bloom filter size is > 16GB, reduce the bloom_filter_fp_chance");
        try
        {
            long byteCount = wordCount * 8L;
            bytes = Memory.allocate(byteCount);
        }
        catch (OutOfMemoryError e)
        {
            throw new RuntimeException("Out of native memory occured, You can avoid it by increasing the system ram space or by increasing bloom_filter_fp_chance.");
        }
        // flush/clear the existing memory.
        clear();
    }

    private OffHeapBitSet(Memory bytes)
    {
        this.bytes = bytes;
    }

View on GitHub (pinned to 88fd0f6a0e)

Solutions

  1. Raise the table's bloom_filter_fp_chance (e.g. ALTER TABLE ... WITH bloom_filter_fp_chance = 0.01 or higher) to shrink the filter.
  2. Reduce per-SSTable key counts by compacting more or partitioning data across tables/keyspaces.
  3. If the fp chance is required, use a non-off-heap or large-capacity filter implementation available in your version.

Example fix

// before
ALTER TABLE big_table WITH bloom_filter_fp_chance = 0.0005;
// after
ALTER TABLE big_table WITH bloom_filter_fp_chance = 0.01;
Defensive patterns

Strategy: validation

Validate before calling

double fpChance = tableParams.getBloomFilterFpChance();
if (fpChance < 0.01) logger.warn("bloom_filter_fp_chance {} very low; filter may exceed 16GB on large tables", fpChance);

Try / catch

try { new OffHeapBitSet(numBits); } catch (UnsupportedOperationException e) { /* lower filter size or raise fp chance */ }

Prevention

When it happens

Trigger: Creating a bloom filter whose requested numBits implies wordCount > Integer.MAX_VALUE, e.g. building an SSTable summary/bloom filter with a very low bloom_filter_fp_chance and a huge number of keys.

Common situations: bloom_filter_fp_chance set extremely low (near 0.001 or below) on tables with billions of rows; default fp chance lowered to reduce false positives on huge compacted SSTables.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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