{"record":{"id":"46cac257fba163fc","repo":"apache/pulsar","slug":"rereplicationentrybatchsize-should-be-smaller-than","errorCode":null,"errorMessage":"rereplicationEntryBatchSize should be smaller than maxPendingReadRequestPerThread","messagePattern":"rereplicationEntryBatchSize should be smaller than maxPendingReadRequestPerThread","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java","lineNumber":124,"sourceCode":"        private boolean generateDocs = false;\n    }\n\n    private static ServerConfiguration readBookieConfFile(String bookieConfigFile) throws IllegalArgumentException {\n        ServerConfiguration bookieConf = new ServerConfiguration();\n        try {\n            bookieConf.loadConf(new File(bookieConfigFile).toURI().toURL());\n            bookieConf.validate();\n            log.info().attr(\"file\", bookieConfigFile).log(\"Using bookie configuration file\");\n        } catch (MalformedURLException e) {\n            log.error().attr(\"file\", bookieConfigFile).exception(e).log(\"Could not open configuration file\");\n            throw new IllegalArgumentException(\"Could not open configuration file\");\n        } catch (ConfigurationException e) {\n            log.error().attr(\"file\", bookieConfigFile).exception(e).log(\"Malformed configuration file\");\n            throw new IllegalArgumentException(\"Malformed configuration file\");\n        }\n\n        if (bookieConf.getMaxPendingReadRequestPerThread() < bookieConf.getRereplicationEntryBatchSize()) {\n            throw new IllegalArgumentException(\n                \"rereplicationEntryBatchSize should be smaller than \" + \"maxPendingReadRequestPerThread\");\n        }\n        return bookieConf;\n    }\n\n    protected static class BrokerStarter implements Callable<Integer> {\n        private ServiceConfiguration brokerConfig;\n        private PulsarService pulsarService;\n        private LifecycleComponent bookieServer;\n        private volatile CompletableFuture<Void> bookieStartFuture;\n        private AutoRecoveryMain autoRecoveryMain;\n        private StatsProvider bookieStatsProvider;\n        private ServerConfiguration bookieConfig;\n        private WorkerService functionsWorkerService;\n        private WorkerConfig workerConfig;\n\n        private CommandLine commander;\n","sourceCodeStart":106,"sourceCodeEnd":142,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-broker/src/main/java/org/apache/pulsar/PulsarBrokerStarter.java#L106-L142","documentation":"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.","triggerScenarios":"Bookie config sets rereplicationEntryBatchSize >= maxPendingReadRequestPerThread; thrown during broker+bookie co-startup right after the config loads.","commonSituations":"Tuning one property (usually rereplicationEntryBatchSize) without adjusting the other; copying tuning snippets from docs for a different BookKeeper version.","solutions":["Set rereplicationEntryBatchSize smaller than maxPendingReadRequestPerThread in the bookie config","Or raise maxPendingReadRequestPerThread above the configured rereplicationEntryBatchSize","Restart the broker after fixing the values"],"exampleFix":"// before (bookie.conf)\nmaxPendingReadRequestPerThread=2500\nrereplicationEntryBatchSize=5000\n// after\nmaxPendingReadRequestPerThread=5000\nrereplicationEntryBatchSize=2500","handlingStrategy":"validation","validationCode":"Properties p = loadBookieProps(bookieConfigFile);\nint maxPending = Integer.parseInt(p.getProperty(\"maxPendingReadRequestPerThread\"));\nint rereplBatch = Integer.parseInt(p.getProperty(\"rereplicationEntryBatchSize\"));\nif (rereplBatch >= maxPending) {\n    throw new IllegalStateException(\"rereplicationEntryBatchSize must be < maxPendingReadRequestPerThread\");\n}","typeGuard":null,"tryCatchPattern":"try {\n    BookKeeperConfiguration conf = readBookieConfFile(bookieConfigFile);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().startsWith(\"rereplicationEntryBatchSize\")) {\n        throw new IllegalStateException(\"Fix bookie.conf: lower rereplicationEntryBatchSize below maxPendingReadRequestPerThread\", e);\n    }\n    throw e;\n}","preventionTips":["Tune both batching properties together in bookie.conf","Add config linting that enforces rereplicationEntryBatchSize < maxPendingReadRequestPerThread"],"tags":["configuration","bookkeeper","validation"],"backgroundTag":"config-value-validation","analyzedSha":"820761864ed8e2a7d2e52dd9763ad2ae117c1395","analyzedAt":"2026-09-06T00:14:20.138Z","contentChangedAt":"2026-09-06T00:14:20.138Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}