apache/pulsar · error · MetadataStoreException

Failed to get data from ${path}

Error message

Failed to get data from ${path}

What it means

BaseResources.get performs a blocking read of a metadata node; on ExecutionException whose cause is not already a MetadataStoreException, or on timeout/interruption, it throws MetadataStoreException('Failed to get data from <path>'). It signals the broker could not read the resource at that path from the metadata store cache.

Source

Thrown at pulsar-broker-common/src/main/java/org/apache/pulsar/broker/resources/BaseResources.java:137

            // childPrefix creates a path hierarchy if children has multi level path
            String childPrefix = path.equals(parent) ? "" : parent + "/";
            totalResults.addAndGet(childList.size());
            for (String child : childList) {
                children.add(childPrefix + child);
                String childPath = path + "/" + child;
                getChildrenRecursiveAsync(childPath, children, result, totalResults, child);
            }
        });
    }

    protected Optional<T> get(String path) throws MetadataStoreException {
        try {
            return getAsync(path).get(operationTimeoutSec, TimeUnit.SECONDS);
        } catch (ExecutionException e) {
            throw (e.getCause() instanceof MetadataStoreException) ? (MetadataStoreException) e.getCause()
                    : new MetadataStoreException(e.getCause());
        } catch (Exception e) {
            throw new MetadataStoreException("Failed to get data from " + path, e);
        }
    }

    protected CompletableFuture<Optional<T>> getAsync(String path) {
        return cache.get(path);
    }

    protected CompletableFuture<Optional<T>> refreshAndGetAsync(String path) {
        return store.sync(path).thenCompose(___ -> {
            cache.invalidate(path);
            return cache.get(path);
        });
    }

    protected void set(String path, Function<T, T> modifyFunction) throws MetadataStoreException {
        try {
            setAsync(path, modifyFunction).get(operationTimeoutSec, TimeUnit.SECONDS);
        } catch (ExecutionException e) {

View on GitHub (pinned to 820761864e)

Solutions

  1. Verify metadata store connectivity and health
  2. Inspect the underlying cause for deserialization vs connectivity issues
  3. Raise operationTimeoutSec if timeouts occur under load
  4. Check broker logs for session-expiry / connection-loss events preceding the failure

Example fix

// before
Optional<Policies> p = nsResources.getPolicies(path);
// after
try {
    Optional<Policies> p = nsResources.getPolicies(path);
} catch (MetadataStoreException e) {
    throw new PulsarServerException("Cannot read policies at " + path, e.getCause());
}
Defensive patterns

Strategy: retry

Validate before calling

boolean healthy = metadataStoreHealthCheck();
if (!healthy) throw new IllegalStateException("Skip read: metadata store not healthy");

Try / catch

try { data = resources.get(path); }
catch (MetadataStoreException e) {
    // distinguish cause: deserialization vs connectivity
    log.warn("get failed for {}", path, e.getCause());
    throw e;
}

Prevention

When it happens

Trigger: Calling get(path) when the underlying cache/metadata-store get fails, when the read exceeds operationTimeoutSec, or when the waiting thread is interrupted.

Common situations: Metadata store down or session expired; slow store exceeding the timeout; deserialization failure of stored data causing non-MetadataStoreException cause; network issues between broker and store.

Related errors


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