-
Notifications
You must be signed in to change notification settings - Fork 250
Introduce reserved-properties setting; reserve "polaris." by default #1417
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
Conversation
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.
LGTM overall with a bunch of minor comments :)
...rc/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java
Show resolved
Hide resolved
CatalogRole okCatalogRole = new CatalogRole("mycatalogrole", Map.of("foo", "bar"), 0L, 0L, 1); | ||
try (Response response = | ||
managementApi | ||
.request("v1/catalogs/{cat}/catalog-roles", Map.of("cat", catalogName)) |
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.
Maybe .createCatalogRole(catalogName, okCatalogRole)
(add new utility method)?
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.
The reason I didn't do this is that the methods in e.g. ManagementApi
have assertThat(response.getStatus()).isEqualTo(CREATED.getStatusCode())
baked into them. The standard in this test and elsewhere seems to be that if you expect a different status code, you don't use a helper method.
See existing test testCreateCatalogWithInvalidName
for an example.
...rvice/src/main/java/org/apache/polaris/service/quarkus/config/QuarkusReservedProperties.java
Outdated
Show resolved
Hide resolved
...kus/service/src/test/java/org/apache/polaris/service/quarkus/admin/PolarisAuthzTestBase.java
Outdated
Show resolved
Hide resolved
service/common/src/main/java/org/apache/polaris/service/config/ReservedProperties.java
Outdated
Show resolved
Hide resolved
for (var entry : updateProperties.entrySet()) { | ||
// If a key was removed from the update, we substitute in the existing value as to not remove | ||
// it | ||
if (!updatePropertiesWithoutReservedProperties.containsKey(entry.getKey())) { |
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.
Would it not be simpler to check isReserved(entry.getKey())
?
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.
This line might be a little more intuitive, but I'm not sure about simpler. We already did the check in removeReservedProperties
, so we don't need to redo it here
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.
ok
throw new IllegalArgumentException(message); | ||
} else { | ||
LOGGER.debug(message); | ||
isReserved = true; |
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.
nit: it would be clearer to move this above line 89 and do a break
here.
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.
Moved the line, but I think we shouldn't break so that multiple logs can be emitted
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.
Fair enough.
Map<String, String> propertyMap = | ||
properties.stream().collect(Collectors.toMap(k -> k, k -> "")); | ||
Map<String, String> filteredMap = removeReservedProperties(propertyMap); | ||
return filteredMap.keySet().stream().toList(); |
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.
If we had an isReserved(name)
method, we could simply filter the original list.
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.
It's a good idea, but I think we'd still want to delegate to the other removeReservedProperties
implementation so that we don't have to duplicate the logic to log/throw
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.
good point
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.
LGTM, but I think the comment about break
in the prefix loop is a good thing to have proactively.
Let's keep it open for another day or so in case other people have opinions on this change. |
Awesome @eric-maynard ! I am gonna rebase the rollback compaction pr to this ! |
* Doc: Add release guide on the website (apache#1539) * main: Update actions/stale digest to f78de97 (apache#1547) * main: Update dependency boto3 to v1.38.12 (apache#1548) * main: Update postgres Docker tag to v17.5 (apache#1549) * main: Update dependency com.adobe.testing:s3mock-testcontainers to v4.2.0 (apache#1551) * main: Update dependency com.nimbusds:nimbus-jose-jwt to v10.3 (apache#1552) * Interface changes for pagination (apache#1528) * add missing apis * more tests, fixes * clean up drop * autolint * changes per review * revert iceberg messages to comply with oss tests * another revert * more iceberg catalog changes * autolint * dependency issues * more wiring * continuing rebase * remaining issues are related to task loading * re-add tests * debugging * fix failing tests * fix another test * changes per review * autolint * some fixes * stable * updates for new persistence * fix * continuing work * more reverts * continue reverts * more reverts * yank tests * autolint * test reverts * try to support limit without real page tokens * autolint * Stable * change comment * autolint * remove catalog config for now * changes per review * more tweaks * simplify types per review * Stable, about to refactor more * re-stable * polish * autolint * more changes per review * stable * Introduce reserved-properties setting; reserve "polaris." by default (apache#1417) * initial commit * initial commit * try to test * quarkus fixes * fix a bunch of callsites * Start applying changes * autolint * chase todos * autolint * bugfix * stable * add one test * stable with more tests * autolint * more tests * autolint * stable tests * clean up * oops * stabilize on main * autolint * more changes per review * Add cleanup support for partition-level statistics files when `DROP TABLE PURGE` (apache#1508) * cleaning up partition stats * update partition stat file extension * update test partition stat write impl * Implement federation to HadoopCatalog (apache#1466) * wip * quarkus fixes * autolint * hadoop impl * autolint * Refactors * refactored * autolint * add config * autolint * stable * Remove breakpoint anchor * add line to application.properties * yank HADOOP * autolint * Spark: Use builder for CreateGenericTableRequest instead of constructor for easier API spec update (apache#1546) * main: Update docker.io/jaegertracing/all-in-one Docker tag to v1.69.0 (apache#1559) * main: Update dependency io.opentelemetry:opentelemetry-bom to v1.50.0 (apache#1558) * main: Update dependency software.amazon.awssdk:bom to v2.31.40 (apache#1567) * main: Update dependency boto3 to v1.38.13 (apache#1556) * Include DISCLAIMER in binary distributions (apache#1568) * NoSQL: merge/rebase-fixes * NoSQL: bump dependencies * fix markdown --------- Co-authored-by: JB Onofré <jbonofre@apache.org> Co-authored-by: Mend Renovate <bot@renovateapp.com> Co-authored-by: Eric Maynard <eric.maynard+oss@snowflake.com> Co-authored-by: danielhumanmod <danieltu.life@gmail.com> Co-authored-by: gh-yzou <167037035+gh-yzou@users.noreply.github.com>
This PR reserves the prefix "polaris." for entity properties and provides a configuration to change the list of reserved prefixes. This is helpful for a few reasons:
polaris.internal.owner=eric
in a metadata.json) that the user can't modify through the REST APIpolaris.virtual.load-duration-ms=1234
) into an object that's being loaded, and we can avoid any potential conflict between these virtual properties and real propertiesallow.overlapping.table.location
) and I plan to fix this in a followup. In the future, these properties can be of a structure likepolaris.config.allow.overlapping.table.location
and we can allowlist the properties through the reserved-properties filter.