dimas-b commented on code in PR #3755:
URL: https://github.com/apache/polaris/pull/3755#discussion_r2823047073
##########
polaris-core/src/main/java/org/apache/polaris/core/config/PolarisConfiguration.java:
##########
@@ -55,33 +59,33 @@ public abstract class PolarisConfiguration<T> {
* configs.
*/
private static void registerConfiguration(PolarisConfiguration<?>
configuration) {
- for (PolarisConfiguration<?> existingConfiguration : allConfigurations) {
- if (existingConfiguration.key.equals(configuration.key)) {
+ if (ALL_CONFIGURATIONS.putIfAbsent(configuration.key(), configuration) !=
null) {
+ throw new IllegalArgumentException(
+ String.format("Config '%s' is already in use", configuration.key));
+ }
+ if (configuration.hasCatalogConfig()) {
+ if (!ALL_CATALOG_CONFIGS.add(configuration.catalogConfig())) {
Review Comment:
nit: I think this is still a bit racy if we want to be strict. A
configuration may be added `ALL_CONFIGURATIONS`, but fail the catalog property
checks, which will lead to inconsistent entries.
Not a big deal, since failures are likely to break the whole runtime in the
current state of the code... but the intent of this PR is to ensure
multi-threaded correctness, so I wonder if it is worth the trouble to use async
collections compared to a simple `synchronized` methods? (not a blocker)
--
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]