Repository navigation
Add basic support of Delta commits for managed tables - #1166
Conversation
6864c9d to
2b51c0f
Compare
2b51c0f to
693c051
Compare
693c051 to
2ec21c0
Compare
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/1127/files) to review incremental changes. - [**commit_api**](#1127) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1127/files)] - [stack/commit_basic](#1166) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1166/files/725c6b686f9f169fb10d7109dfa2c5ea2cd58a4e..2ec21c04831867e54feef742774af6c7b034dea1)] - [stack/commit_backfill_delete_meta](#1169) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1169/files/6d0a2246ce9ded3408587e35355ad46deb22dd2d..711f75644a2ae2559277413d36c8e7118a9bd3ca)] - [stack/commit_get](#1170) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1170/files/333883036048eb3c5fc5defd6ad193849b2286a4..3e5b8dfe047577223b7e9decac67725e5f4d6c76)] --------- **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [x] If there is a related issue, make sure it is linked to this PR. - [ ] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** Add coordinated commits API to the spec Related issue is: #1143 --------- Signed-off-by: Yi Li <[email protected]>
2ec21c0 to
b9f6726
Compare
e583d0f to
6b0e4da
Compare
| } | ||
|
|
||
| protected TableInfo createAndVerifyTable() throws IOException, ApiException { | ||
| protected TableInfo createAndVerifyExternalTable() throws IOException, ApiException { |
There was a problem hiding this comment.
Here is a little cross over from the staging table CLI&test PR. But it's essential to make the test pass. This change should be gone if the PR is merged first.
There was a problem hiding this comment.
the staging table PR is merged. can you update this?
| } | ||
|
|
||
| public TableInfo createTable(CreateTable createTableRequest) throws ApiException { | ||
| if (createTableRequest.getTableType() == TableType.MANAGED) { |
There was a problem hiding this comment.
Here is a little cross over from the staging table CLI&test PR. But it's essential to make the test pass. This change should be gone if the PR is merged first.
There was a problem hiding this comment.
please update the PR since that one is merged
| import org.junit.jupiter.api.BeforeEach; | ||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| public class SdkCoordinatedCommitsCRUDTest extends BaseTableCRUDTestEnv { |
There was a problem hiding this comment.
Only SDK test. No CLI test. Because commits will not be part of CLI operation.
There was a problem hiding this comment.
Renamed to SdkDeltaCommitsCRUDTest
56cc175 to
d7f2459
Compare
bf74c72 to
f2c7b0d
Compare
| import org.hibernate.query.Query; | ||
|
|
||
| /** Repository for managing coordinated commits for managed Delta tables in Unity Catalog. */ | ||
| public class CommitRepository { |
There was a problem hiding this comment.
can you name these specifically with Delta?
these are related to Delta tables only.. lets make that explicit in all these new classes.
| @Builder | ||
| @AllArgsConstructor | ||
| @NoArgsConstructor | ||
| public class CommitDAO { |
| * REST API service for coordinated commits to Delta tables in Unity Catalog. | ||
| */ | ||
| @ExceptionHandler(GlobalExceptionHandler.class) | ||
| public class CoordinatedCommitsService extends AuthorizedService { |
| @@ -0,0 +1,213 @@ | |||
| package io.unitycatalog.server.sdk.coordinatedcommits; | |||
There was a problem hiding this comment.
can we put this in the package deltacommits
i am trying to delta explicitly to make it clear that its for delta.
| @Override | ||
| public void setUp() { | ||
| super.setUp(); | ||
| coordinatedCommitsApi = new CoordinatedCommitsApi(TestUtils.createApiClient(serverConfig)); |
There was a problem hiding this comment.
is this CoordinatedCommitsApi what is generated from the REST spec? if so, can the generated class name be changed to DeltaCommits (by changing the write annotation in the spec) while making sure the REST protocol is not changed?
There was a problem hiding this comment.
does not have to be in this PR.. but please make a follow up PR for this.
There was a problem hiding this comment.
Yes it's from the rest spec. Will do a follow up PR.
| assertThat(ex.getCode()).isEqualTo(ErrorCode.ALREADY_EXISTS.getHttpStatus().code()); | ||
| assertThat(ex.getMessage()).contains("Commit version already accepted."); |
There was a problem hiding this comment.
this pattern seems to repeat a lot. cant we make this less verbose by defining utils that can be used across test suites?
This commit adds API support for committing Delta table versions to Unity Catalog with coordinated commit semantics. When multiple clients attempt to commit the same version simultaneously, UC guarantees that only one will succeed. Key features: - POST endpoint at /delta/preview/commits for committing new table versions - Strict sequential version validation (version N+1 must follow version N) - Onboarding flow for tables with no existing commits - Comprehensive validation of commit metadata and table properties - Only managed delta tables are supported Known limitations (documented in code): - Table metadata updates not yet implemented - Backfill of commits not yet supported - Cleanup of commits when deleting tables not yet implemented - RPC support for reading commit lists not yet implemented Signed-off-by: Yi Li <[email protected]>
Signed-off-by: Yi Li <[email protected]>
Signed-off-by: Yi Li <[email protected]>
Signed-off-by: Yi Li <[email protected]>
- renamed to Delta* - added util function assertApiException Signed-off-by: Yi Li <[email protected]>
f2c7b0d to
8c6992a
Compare
|
|
||
| @Entity | ||
| @Table( | ||
| name = "uc_commits", |
There was a problem hiding this comment.
shouldnt the table name have delta as well then!
There was a problem hiding this comment.
tdas
left a comment
There was a problem hiding this comment.
LGTM. just a few more comments.. but can be resolved in the follow up PR as well. i am inclined to merge this to unblock your follow up PRs. but please dont forget to address these comments in follow up PR.
|
@tdas Thank you! Please go ahead with merging. I'll address the remaining comments in following PRs. |
| handleOnboardingCommit(session, tableId, tableInfoDAO, commit); | ||
| } else { | ||
| DeltaCommitDAO firstCommit = firstAndLastCommits.get(0); | ||
| DeltaCommitDAO lastCommit = firstAndLastCommits.get(1); |
There was a problem hiding this comment.
What if there is only one record in the TableInfoDao, then the firstAndLastCommits should only have one record, which will produce a out of bound error , right ?
There was a problem hiding this comment.
No. This query always returns two records (or empty list). If there's only one record, it returns that same record twice.
There was a problem hiding this comment.
Adding a comment here in the follow up PR: https://github.com/unitycatalog/unitycatalog/pull/1169/files/d0d4f606101bc705a6a79514a2b4ba31b2b19b19..93dc85893930d1594b3a974cc48228c767f826ab#diff-df349b58b0a893abbc64af5ae060645fdd0d5175308fefdc4ff7336a93d3dec1R365
## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/1127/files) to review incremental changes. - [**commit_api**](unitycatalog#1127) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1127/files)] - [stack/commit_basic](unitycatalog#1166) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1166/files/725c6b686f9f169fb10d7109dfa2c5ea2cd58a4e..2ec21c04831867e54feef742774af6c7b034dea1)] - [stack/commit_backfill_delete_meta](unitycatalog#1169) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1169/files/6d0a2246ce9ded3408587e35355ad46deb22dd2d..711f75644a2ae2559277413d36c8e7118a9bd3ca)] - [stack/commit_get](unitycatalog#1170) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1170/files/333883036048eb3c5fc5defd6ad193849b2286a4..3e5b8dfe047577223b7e9decac67725e5f4d6c76)] --------- **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [x] If there is a related issue, make sure it is linked to this PR. - [ ] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** Add coordinated commits API to the spec Related issue is: unitycatalog#1143 --------- Signed-off-by: Yi Li <[email protected]>
) Use this [link](https://github.com/unitycatalog/unitycatalog/pull/1166/files) to review incremental changes. - [**stack/commit_basic**](unitycatalog#1166) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1166/files)] - [stack/commit_api_2](unitycatalog#1199) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1199/files/8c6992aaad6b981ef38a4fb468ef700f083ad49a..d0d4f606101bc705a6a79514a2b4ba31b2b19b19)] - [stack/commit_backfill_delete_meta](unitycatalog#1169) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1169/files/d0d4f606101bc705a6a79514a2b4ba31b2b19b19..93dc85893930d1594b3a974cc48228c767f826ab)] - [stack/commit_get](unitycatalog#1170) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1170/files/93dc85893930d1594b3a974cc48228c767f826ab..0e7306a1c14f5476eeef78953b948fd2f7ba0453)] - [stack/commit_access_test](unitycatalog#1178) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1178/files/0e7306a1c14f5476eeef78953b948fd2f7ba0453..6042111d1b885fc5a9cf687b670c98b95ade14d7)] - [stack/ccv2_spark](unitycatalog#1186) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/1186/files/6042111d1b885fc5a9cf687b670c98b95ade14d7..cc09752cb91d6c9e6bf474ebc05c82f7a0da95cc)] --------- **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [x] If there is a related issue, make sure it is linked to this PR. - [ ] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** This commit adds API support for committing Delta table versions to Unity Catalog with coordinated commit semantics. When multiple clients attempt to commit the same version simultaneously, UC guarantees that only one will succeed. Key features: - POST endpoint at /delta/preview/commits for committing new table versions - Strict sequential version validation (version N+1 must follow version N) - Onboarding flow for tables with no existing commits - Comprehensive validation of commit metadata and table properties - Only managed delta tables are supported Known limitations (documented in code): - Table metadata updates not yet implemented - Backfill of commits not yet supported - Cleanup of commits when deleting tables not yet implemented - RPC support for reading commit lists not yet implemented **Related issue** unitycatalog#1143 --------- Signed-off-by: Yi Li <[email protected]>
🥞 Stacked PR
Use this link to review incremental changes.
PR Checklist
docsis updatedDescription of changes
This commit adds API support for committing Delta table versions to Unity Catalog
with coordinated commit semantics. When multiple clients attempt to commit the
same version simultaneously, UC guarantees that only one will succeed.
Key features:
Known limitations (documented in code):
Related issue
#1143