Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ at locations that better optimize for object storage.
- The Helm chart now supports Pod Disruption Budgets (PDBs) for Polaris components. This allows users to define
the minimum number of pods that must be available during voluntary disruptions, such as node maintenance.

- Feature configuration `PURGE_VIEW_METADATA_ON_DROP` was added to allow dropping views without purging their metadata files.

### Changes

- Polaris Management API clients must be prepared to deal with new attributes in `AwsStorageConfigInfo` objects.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1199,6 +1199,32 @@ public void testDropViewStatus() {
}
}

@Test
public void testDropViewWithPurge() {
restCatalog.createNamespace(Namespace.of("ns1"));
TableIdentifier id = TableIdentifier.of(Namespace.of("ns1"), "view1");
restCatalog
.buildView(id)
.withSchema(SCHEMA)
.withDefaultNamespace(Namespace.of("ns1"))
.withQuery("spark", VIEW_QUERY)
.create();

Catalog catalog = managementApi.getCatalog(currentCatalogName);
Map<String, String> catalogProps = new HashMap<>(catalog.getProperties().toMap());
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);

catalog = managementApi.getCatalog(currentCatalogName);
catalogProps.put(FeatureConfiguration.PURGE_VIEW_METADATA_ON_DROP.catalogConfig(), "false");
managementApi.updateCatalog(catalog, catalogProps);

assertThatCode(() -> restCatalog.dropView(id)).doesNotThrowAnyException();
}

@Test
public void testRenameViewStatus() {
String tableName = "tbl1";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,15 @@ public static void enforceFeatureEnabledOrThrow(
.defaultValue(false)
.buildFeatureConfiguration();

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();

public static final FeatureConfiguration<Integer> STORAGE_CREDENTIAL_DURATION_SECONDS =
PolarisConfiguration.<Integer>builder()
.key("STORAGE_CREDENTIAL_DURATION_SECONDS")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,13 @@ protected ViewOperations newViewOps(TableIdentifier identifier) {

@Override
public boolean dropView(TableIdentifier identifier) {
return dropTableLike(PolarisEntitySubType.ICEBERG_VIEW, identifier, Map.of(), true).isSuccess();
boolean purge =
callContext
.getRealmConfig()
.getConfig(FeatureConfiguration.PURGE_VIEW_METADATA_ON_DROP, catalogEntity);

return dropTableLike(PolarisEntitySubType.ICEBERG_VIEW, identifier, Map.of(), purge)
.isSuccess();
}

@Override
Expand Down