Skip to content

Feature: Rollback compaction on conflict #1285

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 17 commits into from
Jun 20, 2025

Conversation

singhpk234
Copy link
Contributor

@singhpk234 singhpk234 commented Mar 31, 2025

About The Change

Intention is make the catalog smarter, to revert the compaction commits in case of crunch to let the writers who are actually adding or removing the data to the table succeed. In a sense treating compaction as always a lower priority process.

Presently the rest catalog client creates the snapshot and asks the Rest Server to apply the snapshot and gives this in a combination of requirement and update.

Polaris could apply some basic inference and generate some updates to metadata given a property is enabled at a table level, by saying that It will revert back the commit which was created by compaction and let the write succeed.
I had this PR in OSS, which was essentially doing this at the client end, but we think its best if we do this as server end. to support more such clients.

How to use this

  1. Enable a catalog level configuration : polaris.config.rollback.compaction.on-conflicts.enabled when this is enabled polaris will apply the intelligence of rollbacking those REPLACE ops snapshot which have the property of polaris.internal.rollback.compaction.on-conflict in their snapshot summary to resolve conflicts at the server end !

a sample use case is there is a deployment of a Polaris where this config is enabled and there is auto compaction (maintenance job) which is updating the table state, it adds the snapshot summary that polaris.internal.rollback.compaction.on-conflict is true now when a backfill process running for 8 hours want to commit but can't because the compaction job committed before so in this case it will reach out to Polaris and Polaris will see if the snapshot of compation aka replace snapshot has this property if yes roll it back and let the writer succeed !

Devlist: https://lists.apache.org/thread/8k8t77dgk1vc124fnb61932bdp9kf1lc

New Scenario :

Screenshot 2025-03-31 at 1 07 29 PM

@github-project-automation github-project-automation bot moved this to PRs In Progress in Basic Kanban Board Mar 31, 2025
@singhpk234 singhpk234 force-pushed the feature/rollback-compac-polaris branch from 468051c to 05f9bad Compare April 3, 2025 06:44
@singhpk234 singhpk234 force-pushed the feature/rollback-compac-polaris branch 2 times, most recently from 01571dc to 285cc29 Compare April 18, 2025 07:30
@singhpk234 singhpk234 marked this pull request as ready for review April 18, 2025 07:32
@singhpk234
Copy link
Contributor Author

cc @RussellSpitzer @flyrain

@singhpk234 singhpk234 force-pushed the feature/rollback-compac-polaris branch from 285cc29 to eb06c77 Compare April 18, 2025 16:24
@singhpk234 singhpk234 force-pushed the feature/rollback-compac-polaris branch 3 times, most recently from 354b12b to f1de46c Compare April 22, 2025 18:36
@singhpk234 singhpk234 force-pushed the feature/rollback-compac-polaris branch from ef58f72 to 480cbf5 Compare June 20, 2025 01:55
@singhpk234 singhpk234 enabled auto-merge (squash) June 20, 2025 03:49
@singhpk234 singhpk234 disabled auto-merge June 20, 2025 03:50
Copy link
Member

@snazy snazy left a comment

Choose a reason for hiding this comment

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

I didn't look into the actual code change, but I saw that there's a global config option to opt-in. Have you thought about making it configurable per table?

@singhpk234
Copy link
Contributor Author

@snazy its even configurable at a snapshot level the writers need to add a property to consider it applicable to the feature, so IMHO its even more granular than table, i initially started with table but eventually based on the feedbacks moved to combination of catalog config (global) and snapshot property

@singhpk234 singhpk234 requested a review from dimas-b June 20, 2025 14:49
@singhpk234 singhpk234 merged commit 793cf08 into apache:main Jun 20, 2025
11 checks passed
@github-project-automation github-project-automation bot moved this from Ready to merge to Done in Basic Kanban Board Jun 20, 2025
@singhpk234
Copy link
Contributor Author

Thank you @eric-maynard @dimas-b @RussellSpitzer @snazy for the reviews !

This feature is gonna be really helpful for Polaris users !

singhpk234 added a commit to singhpk234/polaris that referenced this pull request Jun 20, 2025
Intention is make the catalog smarter, to revert the compaction commits in case of crunch to let the writers who are actually adding or removing the data to the table succeed. In a sense treating compaction as always a lower priority process.

Presently the rest catalog client creates the snapshot and asks the Rest Server to apply the snapshot and gives this in a combination of requirement and update.

Polaris could apply some basic inference and generate some updates to metadata given a property is enabled at a table level, by saying that It will revert back the commit which was created by compaction and let the write succeed.
I had this PR in OSS, which was essentially doing this at the client end, but we think its best if we do this as server end. to support more such clients.

How to use this
Enable a catalog level configuration : polaris.config.rollback.compaction.on-conflicts.enabled when this is enabled polaris will apply the intelligence of rollbacking those REPLACE ops snapshot which have the property of polaris.internal.rollback.compaction.on-conflict in their snapshot summary to resolve conflicts at the server end !
a sample use case is there is a deployment of a Polaris where this config is enabled and there is auto compaction (maintenance job) which is updating the table state, it adds the snapshot summary that polaris.internal.rollback.compaction.on-conflict is true now when a backfill process running for 8 hours want to commit but can't because the compaction job committed before so in this case it will reach out to Polaris and Polaris will see if the snapshot of compation aka replace snapshot has this property if yes roll it back and let the writer succeed !

Devlist: https://lists.apache.org/thread/8k8t77dgk1vc124fnb61932bdp9kf1lc
ke-xu-wex pushed a commit to ke-xu-wex/polaris that referenced this pull request Jun 21, 2025
Intention is make the catalog smarter, to revert the compaction commits in case of crunch to let the writers who are actually adding or removing the data to the table succeed. In a sense treating compaction as always a lower priority process.

Presently the rest catalog client creates the snapshot and asks the Rest Server to apply the snapshot and gives this in a combination of requirement and update.

Polaris could apply some basic inference and generate some updates to metadata given a property is enabled at a table level, by saying that It will revert back the commit which was created by compaction and let the write succeed.
I had this PR in OSS, which was essentially doing this at the client end, but we think its best if we do this as server end. to support more such clients.

How to use this
Enable a catalog level configuration : polaris.config.rollback.compaction.on-conflicts.enabled when this is enabled polaris will apply the intelligence of rollbacking those REPLACE ops snapshot which have the property of polaris.internal.rollback.compaction.on-conflict in their snapshot summary to resolve conflicts at the server end !
a sample use case is there is a deployment of a Polaris where this config is enabled and there is auto compaction (maintenance job) which is updating the table state, it adds the snapshot summary that polaris.internal.rollback.compaction.on-conflict is true now when a backfill process running for 8 hours want to commit but can't because the compaction job committed before so in this case it will reach out to Polaris and Polaris will see if the snapshot of compation aka replace snapshot has this property if yes roll it back and let the writer succeed !

Devlist: https://lists.apache.org/thread/8k8t77dgk1vc124fnb61932bdp9kf1lc
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.

5 participants