Skip to content

Views can not be dropped under default configurations #5293

Description

@ayushtkn

Describe the bug

Dropping a view on a catalog with no purge-related configuration set fails with a 403:

ForbiddenException: Unable to purge entity: view1. To enable this feature, set the Polaris
configuration DROP_WITH_PURGE_ENABLED or the catalog configuration
polaris.config.drop-with-purge.enabled

The cause is the interaction of two defaults:

  • DROP_WITH_PURGE_ENABLED defaults to false

    public static final FeatureConfiguration<Boolean> DROP_WITH_PURGE_ENABLED =
    PolarisConfiguration.<Boolean>builder()
    .key("DROP_WITH_PURGE_ENABLED")
    .catalogConfig("polaris.config.drop-with-purge.enabled")
    .legacyCatalogConfig("drop-with-purge.enabled")
    .description(
    "If set to true, allows tables to be dropped with the purge parameter set to true.")
    .defaultValue(false)
    .buildFeatureConfiguration();

  • PURGE_VIEW_METADATA_ON_DROP defaults to true

    public static final FeatureConfiguration<Boolean> PURGE_VIEW_METADATA_ON_DROP =
    PolarisConfiguration.<Boolean>builder()
    .key("PURGE_VIEW_METADATA_ON_DROP")
    .catalogConfig("polaris.config.purge-view-metadata-on-drop")
    .description(
    "If set to true, Polaris will attempt to delete view metadata files when a view is dropped.")
    .defaultValue(true)
    .buildFeatureConfiguration();

LocalIcebergCatalog.dropView derives purge from the first and passes it to dropTableLike, whose guard rejects purge=true unless the second is enabled. So the shipped defaults are exactly the combination that fails.

PolarisRestCatalogIntegrationBase.testDropViewWithPurge explicitly pins the behaviour when both properties are set (DROP_WITH_PURGE_ENABLED=false + PURGE_VIEW_METADATA_ON_DROP=trueForbiddenException)

catalogProps.put(FeatureConfiguration.DROP_WITH_PURGE_ENABLED.catalogConfig(), "false");
catalogProps.put(FeatureConfiguration.PURGE_VIEW_METADATA_ON_DROP.catalogConfig(), "true");
managementApi.updateCatalog(catalog, catalogProps);
assertThatThrownBy(() -> restCatalog.dropView(id)).isInstanceOf(ForbiddenException.class);

If we want to make it work under default conditions. I see two options here: Change the default value of PURGE_VIEW_METADATA_ON_DROP or make it independent of DROP_WITH_PURGE_ENABLED and let the later gaurd only tables not Views

To Reproduce

No response

Actual Behavior

No response

Expected Behavior

No response

Additional context

No response

System information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions