prestodb/presto · critical

ZOOKEEPER_ERROR

ZOOKEEPER_ERROR

Error message

ZK error checking metadata root

What it means

During ZooKeeperMetadataManager initialization, a Curator client checks whether the Presto metadata root znode exists and creates it if missing. Any exception from checkExists()/create() is wrapped as ZOOKEEPER_ERROR. The connector cannot set up its metadata store in ZooKeeper.

Source

Thrown at presto-accumulo/src/main/java/com/facebook/presto/accumulo/metadata/ZooKeeperMetadataManager.java:74

        JsonObjectMapperProvider objectMapperProvider = new JsonObjectMapperProvider();
        objectMapperProvider.setJsonDeserializers(ImmutableMap.of(Type.class, new AccumuloModule.TypeDeserializer(typeManager)));
        mapper = objectMapperProvider.get();

        String zkMetadataRoot = config.getZkMetadataRoot();
        String zookeepers = config.getZooKeepers();

        // Create the connection to ZooKeeper to check if the metadata root exists
        CuratorFramework checkRoot = CuratorFrameworkFactory.newClient(zookeepers, new RetryForever(1000));
        checkRoot.start();

        try {
            // If the metadata root does not exist, create it
            if (checkRoot.checkExists().forPath(zkMetadataRoot) == null) {
                checkRoot.create().forPath(zkMetadataRoot);
            }
        }
        catch (Exception e) {
            throw new PrestoException(ZOOKEEPER_ERROR, "ZK error checking metadata root", e);
        }
        checkRoot.close();

        // Create the curator client framework to use for metadata management, set at the ZK root
        curator = CuratorFrameworkFactory.newClient(zookeepers + zkMetadataRoot, new RetryForever(1000));
        curator.start();

        try {
            // Create default schema should it not exist
            if (curator.checkExists().forPath("/" + DEFAULT_SCHEMA) == null) {
                curator.create().forPath("/" + DEFAULT_SCHEMA);
            }
        }
        catch (Exception e) {
            throw new PrestoException(ZOOKEEPER_ERROR, "ZK error checking/creating default schema", e);
        }
    }

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Verify ZooKeeper is reachable: check zookeepers host:port in catalog properties and test with a ZK client (e.g. zkCli.sh ls /)
  2. Create missing parent/chroot znodes manually (zkCli.sh create /presto-accumulo) or use a root path whose parents exist
  3. Check ZooKeeper ACLs/permissions allow the Presto user to create nodes at the metadata root
  4. Inspect the wrapped cause in the Presto log for connection-refused vs auth-failure specifics

Example fix

// before
zk.metadata.root=/presto-accumulo   // chroot never created in ZK
// after
// zkCli.sh -server zk1:2181 create /presto-accumulo
zk.metadata.root=/presto-accumulo
Defensive patterns

Strategy: validation

Validate before calling

// before starting Presto, verify ZK reachability and root writability
try (CuratorFramework c = CuratorFrameworkFactory.newClient(zkHosts, new RetryForever(1000))) {
    c.start();
    c.blockUntilConnected(30, TimeUnit.SECONDS);
    if (c.checkExists().forPath("/presto-accumulo") == null) {
        c.create().forPath("/presto-accumulo");
    }
}

Try / catch

try {
    // initialize connector / run query
} catch (PrestoException e) {
    if (e.getErrorCode().getName().equals("ZOOKEEPER_ERROR")) {
        // verify ZK quorum, chroot znodes, and ACLs, then restart/retry
    }
    throw e;
}

Prevention

When it happens

Trigger: Constructor-time checkExists().forPath(zkMetadataRoot) or create().forPath(zkMetadataRoot) throwing because ZooKeeper is unreachable, the chroot path's parents don't exist, or the client lacks create permission on the root.

Common situations: ZooKeeper quorum down or wrong host:port in catalog properties; zk metadata root configured under a chroot (e.g. /presto-accumulo) whose znode was never created; Kerberos/SASL ACLs denying access; network partition between Presto and ZooKeeper.

Related errors


AI-assisted analysis of prestodb/presto@55bb57d202 (2026-09-04). Data as JSON: /api/errors/5dd3ebfaa8327a4e. Report an issue: GitHub.