diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d90a7ff03..066cb02c8e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -35,6 +35,7 @@ request adding CHANGELOG notes for breaking (!) changes and possibly other secti ### Breaking changes +- The (Before/After)CommitViewEvent has been removed. - The (Before/After)CommitTableEvent has been removed. - The `PolarisMetricsReporter.reportMetric()` method signature has been extended to include a `receivedTimestamp` parameter of type `java.time.Instant`. diff --git a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java index c375180b93..8de9687a83 100644 --- a/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java +++ b/runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergCatalog.java @@ -1852,16 +1852,6 @@ public void doRefresh() { } public void doCommit(ViewMetadata base, ViewMetadata metadata) { - polarisEventListener.onEvent( - new PolarisEvent( - PolarisEventType.BEFORE_COMMIT_VIEW, - eventMetadataFactory.create(), - new AttributeMap() - .put(EventAttributes.CATALOG_NAME, catalogName) - .put(EventAttributes.VIEW_IDENTIFIER, identifier) - .put(EventAttributes.VIEW_METADATA_BEFORE, base) - .put(EventAttributes.VIEW_METADATA_AFTER, metadata))); - // TODO: Maybe avoid writing metadata if there's definitely a transaction conflict LOGGER.debug( "doCommit for view {} with metadataBefore {}, metadataAfter {}", @@ -1959,16 +1949,6 @@ public void doCommit(ViewMetadata base, ViewMetadata metadata) { } else { updateTableLike(identifier, entity); } - - polarisEventListener.onEvent( - new PolarisEvent( - PolarisEventType.AFTER_COMMIT_VIEW, - eventMetadataFactory.create(), - new AttributeMap() - .put(EventAttributes.CATALOG_NAME, catalogName) - .put(EventAttributes.VIEW_IDENTIFIER, identifier) - .put(EventAttributes.VIEW_METADATA_BEFORE, base) - .put(EventAttributes.VIEW_METADATA_AFTER, metadata))); } protected String writeNewMetadataIfRequired(ViewMetadata metadata) { diff --git a/runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventType.java b/runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventType.java index 949b9cb24e..36d06595db 100644 --- a/runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventType.java +++ b/runtime/service/src/main/java/org/apache/polaris/service/events/PolarisEventType.java @@ -145,8 +145,8 @@ public enum PolarisEventType { AFTER_RENAME_VIEW, BEFORE_REPLACE_VIEW, AFTER_REPLACE_VIEW, - BEFORE_COMMIT_VIEW, - AFTER_COMMIT_VIEW, + BEFORE_COMMIT_VIEW, // REMOVED FROM SOURCE CODE + AFTER_COMMIT_VIEW, // REMOVED FROM SOURCE CODE BEFORE_REFRESH_VIEW, AFTER_REFRESH_VIEW, diff --git a/runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogViewTest.java b/runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogViewTest.java index b5a6c4a248..0648ed3431 100644 --- a/runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogViewTest.java +++ b/runtime/service/src/test/java/org/apache/polaris/service/catalog/iceberg/AbstractIcebergCatalogViewTest.java @@ -267,41 +267,5 @@ public void testEventsAreEmitted() { Assertions.assertThat( afterRefreshEvent.attributes().getRequired(EventAttributes.VIEW_IDENTIFIER)) .isEqualTo(TestData.TABLE); - - PolarisEvent beforeCommitEvent = - testPolarisEventListener.getLatest(PolarisEventType.BEFORE_COMMIT_VIEW); - Assertions.assertThat( - beforeCommitEvent.attributes().getRequired(EventAttributes.VIEW_IDENTIFIER)) - .isEqualTo(TestData.TABLE); - Assertions.assertThat( - beforeCommitEvent - .attributes() - .get(EventAttributes.VIEW_METADATA_BEFORE) - .map(m -> m.properties().get(key))) - .hasValue(valOld); - Assertions.assertThat( - beforeCommitEvent - .attributes() - .get(EventAttributes.VIEW_METADATA_AFTER) - .map(m -> m.properties().get(key))) - .hasValue(valNew); - - PolarisEvent afterCommitEvent = - testPolarisEventListener.getLatest(PolarisEventType.AFTER_COMMIT_VIEW); - Assertions.assertThat( - afterCommitEvent.attributes().getRequired(EventAttributes.VIEW_IDENTIFIER)) - .isEqualTo(TestData.TABLE); - Assertions.assertThat( - afterCommitEvent - .attributes() - .get(EventAttributes.VIEW_METADATA_BEFORE) - .map(m -> m.properties().get(key))) - .hasValue(valOld); - Assertions.assertThat( - afterCommitEvent - .attributes() - .get(EventAttributes.VIEW_METADATA_AFTER) - .map(m -> m.properties().get(key))) - .hasValue(valNew); } }