flyrain commented on code in PR #3195:
URL: https://github.com/apache/polaris/pull/3195#discussion_r2587077084
##########
runtime/service/src/main/java/org/apache/polaris/service/catalog/iceberg/IcebergRestCatalogEventServiceDelegator.java:
##########
@@ -597,11 +598,30 @@ public Response commitTransaction(
polarisEventListener.onBeforeCommitTransaction(
new IcebergRestCatalogEvents.BeforeCommitTransactionEvent(
eventMetadataFactory.create(), catalogName,
commitTransactionRequest));
+ for (UpdateTableRequest req : commitTransactionRequest.tableChanges()) {
+ polarisEventListener.onBeforeUpdateTable(
+ new BeforeUpdateTableEvent(
+ eventMetadataFactory.create(),
+ catalogName,
+ req.identifier().namespace(),
+ req.identifier().name(),
+ req));
+ }
Response resp =
delegate.commitTransaction(prefix, commitTransactionRequest,
realmContext, securityContext);
polarisEventListener.onAfterCommitTransaction(
new IcebergRestCatalogEvents.AfterCommitTransactionEvent(
eventMetadataFactory.create(), catalogName,
commitTransactionRequest));
+ for (UpdateTableRequest req : commitTransactionRequest.tableChanges()) {
+ polarisEventListener.onAfterUpdateTable(
+ new AfterUpdateTableEvent(
+ eventMetadataFactory.create(),
+ catalogName,
+ req.identifier().namespace(),
+ req.identifier().name(),
+ req,
+ (LoadTableResponse) resp.getEntity()));
+ }
Review Comment:
I think this is the right behavior for multi-table transactions. Emitting
AfterUpdateTableEvent only after the entire transaction succeeds ensures the
correct semantics and avoids exposing partial state. Thanks for making this
change.
If there’s interest in finer-grained events for multi-table transactions
(e.g., per-table events that fire even before the full transaction commits), we
could explore that as a follow-up discussion.
Here is the related dev ML discussion:
https://lists.apache.org/thread/5og0qjo8l9rf0kytqjg4gn7d9r81gf79.
Can we add tests for this new logic?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]