{"record":{"id":"a5c5a035259a6a03","repo":"apache/pulsar","slug":"name-failed-to-fill-existing-items-in-secs-s","errorCode":null,"errorMessage":"${name} failed to fill existing items in ${secs} secs. Filled count:${count}","messagePattern":"(.+?) failed to fill existing items in (.+?) secs\\. Filled count:(.+?)","errorType":"exception","errorClass":"MetadataStoreException","httpStatus":null,"severity":"error","filePath":"pulsar-metadata/src/main/java/org/apache/pulsar/metadata/tableview/impl/MetadataStoreTableViewImpl.java","lineNumber":345,"sourceCode":"                });\n    }\n\n    /**\n     * Note: this method only be called when a broker is starting, please call {@link #fillAsync(AtomicLong, boolean)}\n     * for other use-case, otherwise, you may get a thread deadlock error.\n     */\n    private void fill() throws MetadataStoreException {\n        AtomicLong loadedCounter = new AtomicLong();\n        long maxWaitTime = Math.min(timeoutInMillis, FILL_TIMEOUT_IN_MILLIS);\n        try {\n            fillAsync(loadedCounter, false).get(maxWaitTime, TimeUnit.MILLISECONDS);\n            log.info().attr(\"name\", name).attr(\"size\", loadedCounter.get()).log(\"Completed filling existing items\");\n        } catch (InterruptedException | ExecutionException | TimeoutException e) {\n            String err = name + \" failed to fill existing items in \"\n                    + TimeUnit.MILLISECONDS.toSeconds(maxWaitTime) + \" secs. Filled count:\"\n                    + loadedCounter.get();\n            log.error(err);\n            throw new MetadataStoreException(err, FutureUtil.unwrapCompletionException(e));\n        }\n    }\n\n    private CompletableFuture<Void> handleExistingLeafs(String rootPath, String path, @Nullable AtomicLong count,\n                                                        boolean printDetails) {\n        return store.getChildren(path).thenCompose(children -> {\n            if (children.isEmpty()) {\n                // Skip root path.\n                if (rootPath.equals(path)) {\n                    return CompletableFuture.completedFuture(null);\n                }\n                // Leaf node.\n                if (count != null) {\n                    count.incrementAndGet();\n                }\n                if (printDetails) {\n                    log.info().attr(\"path\", path).log(\"Handling existing leaf\");\n                }","sourceCodeStart":327,"sourceCodeEnd":363,"githubUrl":"https://github.com/apache/pulsar/blob/820761864ed8e2a7d2e52dd9763ad2ae117c1395/pulsar-metadata/src/main/java/org/apache/pulsar/metadata/tableview/impl/MetadataStoreTableViewImpl.java#L327-L363","documentation":"MetadataStoreException thrown by MetadataStoreTableViewImpl.fill when iterating and loading all existing items under the tableview root does not complete within maxWaitTime milliseconds. The wrapped cause (InterruptedException/ExecutionException/TimeoutException) is attached.","triggerScenarios":"Starting a TableView where the backing metadata store has many children under the root path, or the metadata store (e.g. ZooKeeper) is slow/unavailable so the getChildren futures don't finish before maxWaitTime elapses.","commonSituations":"Large existing datasets in a tableview namespace, metadata store latency or network issues, or setting TableViewBuilder.createAsync maxWaitTime too low for the number of keys.","solutions":["Increase maxWaitTime on the TableViewBuilder (tableview builder maxWaitTime option) to allow full initial load.","Check metadata store health and network latency between client and store.","Reduce the number of keys under the tableview root path, or use a narrower rootPath.","Inspect the wrapped cause (TimeoutException vs ExecutionException) to distinguish slowness from hard store failures; retry startup after the store recovers."],"exampleFix":"// before\nclient.newTableViewBuilder(Schema.STRING)\n    .topic(...)\n    .maxWaitTime(30_000)\n// after\nclient.newTableViewBuilder(Schema.STRING)\n    .topic(...)\n    .maxWaitTime(300_000)","handlingStrategy":"retry","validationCode":"// estimate needed wait: e.g. sample child count first\nLong childCount = store.getChildren(rootPath).get(30, TimeUnit.SECONDS);\nlong budgetMs = Math.max(60_000, childCount * 100); // heuristic\nbuilder.maxWaitTime(budgetMs);","typeGuard":null,"tryCatchPattern":"try {\n    tableView = builder.createAsync().get(maxWaitTime, TimeUnit.MILLISECONDS);\n} catch (ExecutionException e) {\n    if (FutureUtil.unwrapCompletionException(e) instanceof TimeoutException) {\n        // retry with larger maxWaitTime after checking store health\n    }\n}","preventionTips":["Set maxWaitTime proportional to expected key count under the tableview root.","Monitor metadata store latency and alert before timeouts trigger.","Avoid starting many tableviews simultaneously against a cold store.","Check the wrapped cause to distinguish timeout from store failure."],"tags":["timeout","tableview","metadata-store","initialization"],"backgroundTag":"operation-timeout","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"}