apache / polaris

Apache Polaris, the interoperable, open source catalog for Apache Iceberg
https://polaris.apache.org/
Apache License 2.0
1.17k stars 130 forks source link

Treat missing default-base-location in UpdateCatalogRequest as no-change to default-base-location #440

Closed dennishuo closed 2 weeks ago

dennishuo commented 2 weeks ago

The way the API model for Catalogs splits out the default-base-location as a required field separate from "additionalProperties" makes it easy for client libraries to forget to forget to "echo" an existing default-base-location when trying to set new properties.

Since the default-base-location is required during catalog creation, it definitely wasn't correct to allow silently clobbering it in an update. So the only possibilities are:

  1. Throw explicit error if it's missing
  2. Treat it the same as when an UpdateCatalogRequest doesn't specify a StorageConfigInfo, which is to assume that the unspecified portion of the request should be unaltered

Given the structure of the API making it easy to miss this fact, I'd say the most correct semantic here is to treat the same as unspecified StorageConfigInfo, and just leave default-base-location unchanged if it's missing from the UpdateCatalogRequest.

Description

Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.

Fixes # (issue)

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration

Test Configuration:

Checklist:

Please delete options that are not relevant.

eric-maynard commented 2 weeks ago

With this change, it looks like calls to updateCatalog won't overwrite properties that aren't specified in the request. This behavior makes sense to me, but can you add a short blurb to the spec clarifying this?

sfc-gh-dhuo commented 2 weeks ago

With this change, it looks like calls to updateCatalog won't overwrite properties that aren't specified in the request. This behavior makes sense to me, but can you add a short blurb to the spec clarifying this?

Done.

jbonofre commented 2 weeks ago

Sorry, I'm late on this PR.

Even if it can be seen as a breaking change, I think it makes sense to do it because the catalog could be in a inconsistent state. So, I agree with the PR.

Thanks !