eric-maynard commented on code in PR #1557:
URL: https://github.com/apache/polaris/pull/1557#discussion_r2082981222
##########
polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfiguration.java:
##########
@@ -92,27 +103,51 @@ public Builder<T> defaultValue(T defaultValue) {
return this;
}
- public Builder<T> catalogConfig(String catalogConfig) {
- this.catalogConfig = Optional.of(catalogConfig);
+ public Builder<T> addCatalogConfig(String catalogConfig) {
+ if (!catalogConfig.startsWith(catalogConfigPrefix)) {
+ throw new IllegalArgumentException(
+ "Catalog configs are expected to start with " +
catalogConfigPrefix);
+ }
+ if (allCatalogConfigs.contains(catalogConfig)) {
+ throw new IllegalArgumentException("Catalog config already exists: " +
catalogConfig);
+ }
+ this.catalogConfigs.add(catalogConfig);
+ allCatalogConfigs.add(catalogConfig);
+ return this;
+ }
+
+ /**
+ * Used to support backwards compatability before there were reserved
properties. Usage of this
+ * method should be removed over time.
+ */
+ @Deprecated
+ public Builder<T> addCatalogConfigUnsafe(String catalogConfig) {
+ LOGGER.info("catalogConfigUnsafe is deprecated! Use catalogConfig()
instead.");
+ if (allCatalogConfigs.contains(catalogConfig)) {
+ throw new IllegalArgumentException("Catalog config already exists: " +
catalogConfig);
+ }
+ this.catalogConfigs.add(catalogConfig);
+ allCatalogConfigs.add(catalogConfig);
Review Comment:
Good idea, I'll do that. The second part of this idea did add a bit of
complexity to `ReservedProperties::allowlist`, but I think it's worth it.
If it's okay with you, I think I might keep tracking the
`unsafeCatalogConfigs` in the original way though -- the alternative would be
to add an `unsafeCatalogConfigs` member to the `PolarisConfiguration`
instances, which seems like a lot for code that's essentially just there to
warn users about using a deprecated config and that's intended to be ripped
out.
I don't feel strongly about this point though, we can take that approach if
you prefer.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]