-
Notifications
You must be signed in to change notification settings - Fork 468
Add handler-level Idempotency-Key support for createTableDirect #4269
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
Closed
Closed
Changes from 4 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
74559ae
Add handler-level Idempotency-Key support for createTableDirect
huaxingao 7a33c8b
Fix invalid Duration default for idempotency in-progress poll interval
huaxingao 9d3be53
fix test failure
huaxingao e4a1a91
Trigger CI
huaxingao 5a606e1
Include principal roles and properties in idempotency hash
huaxingao de532e2
address comments
huaxingao bc0a02c
fix test
huaxingao 66f7418
regenerate idempotency config docs
huaxingao 628f07f
address comments
huaxingao 97c3207
fix
huaxingao de037f1
address comments
huaxingao 94a439d
Move idempotency settings to IdempotencyConfiguration
huaxingao 1453eb8
spotlessApply
huaxingao 7feb581
Regenerate config docs
huaxingao d2a404f
Decouple IdempotencyPersistence from BasePersistence
huaxingao File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
...laris/persistence/relational/jdbc/idempotency/RelationalJdbcIdempotencyStoreProducer.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one or more | ||
| * contributor license agreements. See the NOTICE file distributed with | ||
| * this work for additional information regarding copyright ownership. | ||
| * The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| * (the "License"); you may not use this file except in compliance with | ||
| * the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.polaris.persistence.relational.jdbc.idempotency; | ||
|
|
||
| import io.smallrye.common.annotation.Identifier; | ||
| import jakarta.enterprise.context.ApplicationScoped; | ||
| import jakarta.enterprise.inject.Instance; | ||
| import jakarta.enterprise.inject.Produces; | ||
| import jakarta.inject.Inject; | ||
| import javax.sql.DataSource; | ||
| import org.apache.polaris.core.persistence.IdempotencyStore; | ||
| import org.apache.polaris.persistence.relational.jdbc.RelationalJdbcConfiguration; | ||
| import org.slf4j.Logger; | ||
| import org.slf4j.LoggerFactory; | ||
|
|
||
| /** | ||
| * Produces an {@link IdempotencyStore} backed by the JDBC datasource. Qualified with | ||
| * {@code @Identifier("relational-jdbc")} so the runtime can select it based on {@code | ||
| * polaris.persistence.type}. | ||
| */ | ||
| @ApplicationScoped | ||
| public class RelationalJdbcIdempotencyStoreProducer { | ||
|
|
||
| private static final Logger LOGGER = | ||
| LoggerFactory.getLogger(RelationalJdbcIdempotencyStoreProducer.class); | ||
|
|
||
| @Inject Instance<DataSource> dataSource; | ||
| @Inject RelationalJdbcConfiguration relationalJdbcConfiguration; | ||
|
|
||
| @Produces | ||
| @ApplicationScoped | ||
| @Identifier("relational-jdbc") | ||
| IdempotencyStore idempotencyStore() { | ||
| if (dataSource.isUnsatisfied()) { | ||
| throw new IllegalStateException( | ||
| "relational-jdbc IdempotencyStore requested but no DataSource is wired"); | ||
| } | ||
| try { | ||
| LOGGER.info("Wiring RelationalJdbcIdempotencyStore"); | ||
| return new RelationalJdbcIdempotencyStore(dataSource.get(), relationalJdbcConfiguration); | ||
| } catch (Exception e) { | ||
| throw new IllegalStateException("Failed to construct RelationalJdbcIdempotencyStore", e); | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding
principal_hash TEXT NOT NULLin-place is only safe if schema-v4 has not been released. Given v4 is already released with 1.4.0. This feature is not enabled, however, users should already create the table, I'd suggest to bump toschema-v5.sqlwithALTER TABLE idempotency_records ADD COLUMN principal_hash TEXT, thenALTER COLUMN ... SET NOT NULL. Same applies toh2/schema-v4.sql:150andcockroachdb/schema-v4.sql:153. Backfill isn't needed as the feature is not available in 1.4.0.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, this applies to removal of
response_headers TEXTas well.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Reverted schema-v4.sql (Postgres / H2 / CockroachDB), and added schema-v5.sql.