You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This change enables multiple datasources in Polaris, with possibility of **runtime** activation of the desired datasource.
This is achieved by:
1) Introducing a new enabler property: `polaris.persistence.relational.jdbc.datasource`, which points to a named datasource to activate.
2) Declaring, **at build time**, one named datasource for each JDBC driver shipped with the application.
3) Introducing a new `DataSourceActivator` config interceptor that will, at runtime, change the `active` setting of the target datasource to `true`, and all others to `false` (`active` is a runtime setting, contrary to `db-kind`).
This change also makes the server ship with the H2 driver by default, since that's the pre-condition for an H2 datasource to be selected at runtime.
This change will further enable **as future improvements**:
- Using to JDBC + H2 by default for server images, while still allowing users to switch to PostgreSQL *without having to rebuild Polaris*.
- Enabling the persistence to "plug" into not one, but many datasources, e.g. a specific datasource for main persistence, and a separate datasource for metrics. This was outlined in #3960 – but the machinery to make that happen was missing.
Copy file name to clipboardExpand all lines: helm/polaris/values.schema.json
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1001,6 +1001,10 @@
1001
1001
"relationalJdbc": {
1002
1002
"type": "object",
1003
1003
"properties": {
1004
+
"datasource": {
1005
+
"description": "The name of the Quarkus named datasource to use for relational persistence. Must match one of the built-in named datasources (h2, postgresql), or a custom datasource configured via extraEnv / extraConfig (in this case, you must use a custom Polaris server image including the custom datasource). Polaris will activate this datasource automatically.",
Copy file name to clipboardExpand all lines: persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/JdbcMetaStoreManagerFactory.java
Copy file name to clipboardExpand all lines: persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/RelationalJdbcConfiguration.java
+6-3Lines changed: 6 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -21,18 +21,21 @@
21
21
importjava.util.Optional;
22
22
23
23
publicinterfaceRelationalJdbcConfiguration {
24
-
// max retries before giving up
24
+
/** The maximum number of retries before giving up the operation. */
25
25
Optional<Integer> maxRetries();
26
26
27
-
// max retry duration
27
+
/** The maximum retry duration in milliseconds. */
28
28
Optional<Long> maxDurationInMs();
29
29
30
-
// initial delay
30
+
/** The initial retry delay. */
31
31
Optional<Long> initialDelayInMs();
32
32
33
33
/**
34
34
* Explicitly configured database type. If not specified, the database type will be inferred from
35
35
* the JDBC connection metadata. Supported values: "postgresql", "cockroachdb", "h2"
Copy file name to clipboardExpand all lines: persistence/relational-jdbc/src/main/java/org/apache/polaris/persistence/relational/jdbc/RelationalJdbcProductionReadinessChecks.java
+1-1Lines changed: 1 addition & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -40,7 +40,7 @@ public ProductionReadinessCheck checkRelationalJdbc(
40
40
returnProductionReadinessCheck.of(
41
41
ProductionReadinessCheck.Error.of(
42
42
"The current persistence (jdbc:h2) is intended for tests only.",
Copy file name to clipboardExpand all lines: persistence/relational-jdbc/src/test/java/org/apache/polaris/persistence/relational/jdbc/JdbcGrantRecordsIdempotencyTest.java
+5Lines changed: 5 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -154,5 +154,10 @@ public Optional<Long> initialDelayInMs() {
0 commit comments