iceberg icon indicating copy to clipboard operation
iceberg copied to clipboard

Iceberg-specific JDBC catalog properties should not be passed to driver

Open patricklucas opened this issue 1 year ago • 6 comments

Apache Iceberg version

1.9.2 (latest release)

Query engine

None

Please describe the bug 🐞

Iceberg uses a number of config options prefixed with jdbc. internally, of which jdbc.schema-version is effectively mandatory, as you get a warning without it and need to set it in order for JdbcCatalog to support views.

The comment on SCHEMA_VERSION_PROPERTY, "property to control if view support is added to the existing database", is a bit misleading, because it also has to be set for view support to be added to newly-created tables, since it defaults to running V0_CREATE_CATALOG_SQL.

The problem is that Iceberg passes all properties prefixed with jdbc. to the driver when creating a new connection, stripping the prefix, and some JDBC drivers fail when they encounter unknown properties.

In JdbcClientPool.java:

  @Override
  protected Connection newClient() {
    try {
      Properties dbProps = JdbcUtil.filterAndRemovePrefix(properties, JdbcCatalog.PROPERTY_PREFIX);
      return DriverManager.getConnection(dbUrl, dbProps);
    } catch (SQLException e) {
      throw new UncheckedSQLException(e, "Failed to connect: %s", dbUrl);
    }
  }

Ideally, there would be separate prefixes to distinguish properties meant to configure Iceberg's JdbcCatalog from those meant to be passed through to the driver.

To (mostly) maintain backwards compatibility, though, a compromise could be to filter out those Iceberg-specific properties from the set passed to the driver.

I believe there are just three:

  • jdbc.strict-mode
  • jdbc.schema-version
  • jdbc.init-catalog-tables

I can't think of a reason these would need to be passed to the driver.

Willingness to contribute

  • [x] I can contribute a fix for this bug independently
  • [ ] I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • [ ] I cannot contribute a fix for this bug at this time

patricklucas avatar Jul 25 '25 10:07 patricklucas

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Jan 22 '26 00:01 github-actions[bot]

I'm still seeking a review for this.

patricklucas avatar Jan 22 '26 09:01 patricklucas

This issue has been automatically marked as stale because it has been open for 180 days with no activity. It will be closed in next 14 days if no further activity occurs. To permanently prevent this issue from being considered stale, add the label 'not-stale', but commenting on the issue is preferred when possible.

github-actions[bot] avatar Jul 22 '26 00:07 github-actions[bot]

At least a single reply to this longstanding issue would be appreciated. Does the project have no triage/review process?

patricklucas avatar Jul 22 '26 07:07 patricklucas

#13673 by @patricklucas fixed this, but the stale bot closed it in January before it got a review. @patricklucas, if you'd like to open it again as a new PR, please go ahead; otherwise I'd like to pick it up and credit your work. The plan is to exclude Iceberg's own jdbc. catalog properties (strict-mode, schema-version, init-catalog-tables and the newer metadata-refresh-max-retries) from the properties passed to the JDBC driver.

binarybrain-009 avatar Oct 29 '26 14:10 binarybrain-009

@binarybrain-009 you're welcome to take it over, thanks.

patricklucas avatar Nov 03 '26 10:11 patricklucas