prestodb/presto · error · UnsupportedOperationException

setPartitionLeases is not supported in RecordingHiveMetastor

Error message

setPartitionLeases is not supported in RecordingHiveMetastore

What it means

setPartitionLeases is a metastore write operation that RecordingHiveMetastore deliberately does not support (it neither records nor replays it), so calling it always raises this UnsupportedOperationException regardless of mode.

Source

Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/RecordingHiveMetastore.java:506

    public void revokeRoles(MetastoreContext metastoreContext, Set<String> roles, Set<PrestoPrincipal> grantees, boolean adminOptionFor, PrestoPrincipal grantor)
    {
        verifyRecordingMode();
        delegate.revokeRoles(metastoreContext, roles, grantees, adminOptionFor, grantor);
    }

    @Override
    public Set<RoleGrant> listRoleGrants(MetastoreContext metastoreContext, PrestoPrincipal principal)
    {
        return loadValue(
                roleGrantsCache,
                principal,
                () -> delegate.listRoleGrants(metastoreContext, principal));
    }

    @Override
    public void setPartitionLeases(MetastoreContext metastoreContext, String databaseName, String tableName, Map<String, String> partitionNameToLocation, Duration leaseDuration)
    {
        throw new UnsupportedOperationException("setPartitionLeases is not supported in RecordingHiveMetastore");
    }

    @Override
    public MetastoreOperationResult dropConstraint(MetastoreContext metastoreContext, String databaseName, String tableName, String constraintName)
    {
        verifyRecordingMode();
        return delegate.dropConstraint(metastoreContext, databaseName, tableName, constraintName);
    }

    @Override
    public MetastoreOperationResult addConstraint(MetastoreContext metastoreContext, String databaseName, String tableName, TableConstraint<String> tableConstraint)
    {
        verifyRecordingMode();
        return delegate.addConstraint(metastoreContext, databaseName, tableName, tableConstraint);
    }

    private <K, V> V loadValue(Cache<K, V> cache, K key, Supplier<V> valueSupplier)
    {

View on GitHub (pinned to 55bb57d202)

Solutions

  1. Do not use setPartitionLeases through a RecordingHiveMetastore wrapper; call the underlying metastore directly
  2. Remove or bypass lease-management calls when running with recording/replay enabled
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at presto-hive-metastore/src/main/java/com/facebook/presto/hive/metastore/RecordingHiveMetastore.java:506 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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