apache/pulsar · error · IllegalArgumentException

rereplicationEntryBatchSize should be smaller than maxPendin

Error message

rereplicationEntryBatchSize should be smaller than maxPendingReadRequestPerThread

What it means

As a sanity check after loading the Bookie config, readBookieConfFile verifies that rereplicationEntryBatchSize is not larger than maxPendingReadRequestPerThread. Both control read request batching in BookKeeper; violating the invariant is rejected at startup with this IllegalArgumentException.

Source

Thrown at pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java:124

        private boolean generateDocs = false;
    }

    private static ServerConfiguration readBookieConfFile(String bookieConfigFile) throws IllegalArgumentException {
        ServerConfiguration bookieConf = new ServerConfiguration();
        try {
            bookieConf.loadConf(new File(bookieConfigFile).toURI().toURL());
            bookieConf.validate();
            log.info().attr("file", bookieConfigFile).log("Using bookie configuration file");
        } catch (MalformedURLException e) {
            log.error().attr("file", bookieConfigFile).exception(e).log("Could not open configuration file");
            throw new IllegalArgumentException("Could not open configuration file");
        } catch (ConfigurationException e) {
            log.error().attr("file", bookieConfigFile).exception(e).log("Malformed configuration file");
            throw new IllegalArgumentException("Malformed configuration file");
        }

        if (bookieConf.getMaxPendingReadRequestPerThread() < bookieConf.getRereplicationEntryBatchSize()) {
            throw new IllegalArgumentException(
                "rereplicationEntryBatchSize should be smaller than " + "maxPendingReadRequestPerThread");
        }
        return bookieConf;
    }

    protected static class BrokerStarter implements Callable<Integer> {
        private ServiceConfiguration brokerConfig;
        private PulsarService pulsarService;
        private LifecycleComponent bookieServer;
        private volatile CompletableFuture<Void> bookieStartFuture;
        private AutoRecoveryMain autoRecoveryMain;
        private StatsProvider bookieStatsProvider;
        private ServerConfiguration bookieConfig;
        private WorkerService functionsWorkerService;
        private WorkerConfig workerConfig;

        private CommandLine commander;

View on GitHub (pinned to 820761864e)

Solutions

  1. Set rereplicationEntryBatchSize smaller than maxPendingReadRequestPerThread in the bookie config
  2. Or raise maxPendingReadRequestPerThread above the configured rereplicationEntryBatchSize
  3. Restart the broker after fixing the values

Example fix

// before (bookie.conf)
maxPendingReadRequestPerThread=2500
rereplicationEntryBatchSize=5000
// after
maxPendingReadRequestPerThread=5000
rereplicationEntryBatchSize=2500
Defensive patterns

Strategy: validation

Validate before calling

Properties p = loadBookieProps(bookieConfigFile);
int maxPending = Integer.parseInt(p.getProperty("maxPendingReadRequestPerThread"));
int rereplBatch = Integer.parseInt(p.getProperty("rereplicationEntryBatchSize"));
if (rereplBatch >= maxPending) {
    throw new IllegalStateException("rereplicationEntryBatchSize must be < maxPendingReadRequestPerThread");
}

Try / catch

try {
    BookKeeperConfiguration conf = readBookieConfFile(bookieConfigFile);
} catch (IllegalArgumentException e) {
    if (e.getMessage().startsWith("rereplicationEntryBatchSize")) {
        throw new IllegalStateException("Fix bookie.conf: lower rereplicationEntryBatchSize below maxPendingReadRequestPerThread", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Bookie config sets rereplicationEntryBatchSize >= maxPendingReadRequestPerThread; thrown during broker+bookie co-startup right after the config loads.

Common situations: Tuning one property (usually rereplicationEntryBatchSize) without adjusting the other; copying tuning snippets from docs for a different BookKeeper version.

Related errors


AI-assisted analysis of apache/pulsar@820761864e (2026-09-06). Data as JSON: /api/errors/46cac257fba163fc. Report an issue: GitHub.