Skip to content

Conversation

@adnanhemani
Copy link
Contributor

This PR introduces a new event type StageCommitTableEvent, which triggers only in the case of a transactional commit at the time the staged commit is generated (before the commit is actually applied). This allows us to reserve the AfterCommitTableEvent solely for when the commit has been successfully applied.

In order to do this, I've made a slight addition to the TransactionWorkspaceMetaStoreManager class to add the staging of events, mirroring exactly how we stage updates. Noting that there is no unit testing for this class, I've added this as well.

Additionally, E2E testing for the events emissions in the CommitTransaction API has been added, looking both at the happy and sad paths.

Checklist

  • 🛡️ Don't disclose security issues! (contact security@apache.org)
  • 🔗 Clearly explained why the changes are needed, or linked related issues: Fixes PolarisEventListener may produce events that relate to phantom data #2990.
  • 🧪 Added/updated tests with good coverage, or manually tested (and explained how)
  • 💡 Added comments for complex logic
  • [N/A] 🧾 Updated CHANGELOG.md (if needed)
  • [N/A] 📚 Updated documentation in site/content/in-dev/unreleased (if needed)

Closes #2990.

@adnanhemani
Copy link
Contributor Author

cc @dimas-b

Please let me know what you think with regards to your suggestion of needing a README/extended documentation. Also, should we add this to the CHANGELOG? That a new event type has been added?

@adnanhemani adnanhemani force-pushed the ahemani/fix_phantom_events branch from 84626fc to b4ce270 Compare November 18, 2025 09:56
polarisEventListener.onAfterCommitTable(
new IcebergRestCatalogEvents.AfterCommitTableEvent(
catalogName, tableIdentifier, base, metadata));
if (getMetaStoreManager() instanceof TransactionWorkspaceMetaStoreManager) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This if + instanceof looks concerning to me. I do believe the whole events design can and should be done in a way that processing logic does not require knowing specific types of pluggable components.

TransactionalWorkspaceMetaStoreManager in itself has API design concerns from my POV, so I believe this area of the code needs refactoring in general, so adding logic that depends on specific types is both risky and complicates future refactoring.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PolarisEventListener may produce events that relate to phantom data

2 participants