sashapolo commented on code in PR #2065:
URL: https://github.com/apache/ignite-3/pull/2065#discussion_r1197502693
##########
modules/cluster-management/src/main/java/org/apache/ignite/internal/cluster/management/ClusterManagementGroupManager.java:
##########
@@ -331,7 +337,8 @@ private void handleInit(CmgInitMessage msg, String
senderConsistentId, long corr
}
private CompletableFuture<CmgRaftService> doInit(CmgRaftService service,
CmgInitMessage msg) {
- return service.initClusterState(createClusterState(msg))
+ return CompletableFuture.runAsync(() ->
validateConfiguration(msg.clusterConfigurationToApply()))
Review Comment:
Again, this looks like an abuse, what's the point of dispatching this call
on a default executor, when its instead should be executed in the current
thread?
##########
modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerConfigurationChangesTest.java:
##########
@@ -91,13 +93,21 @@ public class
DistributionZoneManagerConfigurationChangesTest extends IgniteAbstr
@BeforeEach
public void setUp() throws Exception {
- clusterCfgMgr = new ConfigurationManager(
+ ConfigurationTreeGenerator generator = new ConfigurationTreeGenerator(
List.of(DistributionZonesConfiguration.KEY),
- Set.of(),
- new TestConfigurationStorage(DISTRIBUTED),
List.of(),
List.of(TestPersistStorageConfigurationSchema.class)
);
+ clusterCfgMgr = new ConfigurationManager(
+ List.of(DistributionZonesConfiguration.KEY),
+ new TestConfigurationStorage(DISTRIBUTED),
+ new ConfigurationTreeGenerator(
Review Comment:
you already have a `generator` above, why do you need a new one?
##########
modules/distribution-zones/src/test/java/org/apache/ignite/internal/distributionzones/DistributionZoneManagerTest.java:
##########
@@ -74,13 +78,21 @@ class DistributionZoneManagerTest extends
IgniteAbstractTest {
@BeforeEach
public void setUp() {
- registry = new ConfigurationRegistry(
+ generator = new ConfigurationTreeGenerator(
List.of(DistributionZonesConfiguration.KEY),
- Set.of(FilterValidator.INSTANCE),
- new TestConfigurationStorage(DISTRIBUTED),
List.of(),
List.of(TestPersistStorageConfigurationSchema.class)
);
+ registry = new ConfigurationRegistry(
+ List.of(DistributionZonesConfiguration.KEY),
+ new TestConfigurationStorage(DISTRIBUTED),
+ new ConfigurationTreeGenerator(
Review Comment:
Same issue
##########
modules/rest/src/main/java/org/apache/ignite/internal/rest/cluster/ClusterManagementController.java:
##########
@@ -70,17 +84,27 @@ public CompletableFuture<Void> init(@Body InitCommand
initCommand) {
initCommand.cmgNodes());
}
- return clusterInitializer.initCluster(
+ return CompletableFuture.runAsync(() ->
validateConfiguration(initCommand.clusterConfiguration()))
Review Comment:
Same issue with `runAsync`
##########
modules/configuration/src/main/java/org/apache/ignite/internal/configuration/validation/DefaultValidators.java:
##########
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.configuration.validation;
+
+import java.util.Set;
+import org.apache.ignite.configuration.validation.Validator;
+
+/**
+ * Collection of default configuration validators.
+ */
+final class DefaultValidators {
Review Comment:
What I meant in my original comment is that I think that this class is
redundant, you can simply move the field to a different class
##########
modules/configuration/src/main/java/org/apache/ignite/internal/configuration/validation/ConfigurationValidator.java:
##########
@@ -0,0 +1,62 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.ignite.internal.configuration.validation;
+
+import java.util.List;
+import org.apache.ignite.configuration.validation.ValidationIssue;
+import org.apache.ignite.internal.configuration.SuperRoot;
+import org.apache.ignite.internal.configuration.tree.ConfigurationSource;
+
+/**
+ * Configuration validator.
+ */
+public interface ConfigurationValidator {
+
+ /**
+ * Validate configuration.
+ *
+ * @param cfg configuration in HOCON format.
+ * @return List of validation results.
+ */
+ List<ValidationIssue> validateHocon(String cfg);
+
+ /**
+ * Validate configuration.
+ *
+ * @param src configuration.
+ * @return List of validation results.
+ */
+ List<ValidationIssue> validate(ConfigurationSource src);
+
+ /**
+ * Validate configuration changes.
Review Comment:
What do you mean by "changes" here?
##########
modules/runner/src/integrationTest/java/org/apache/ignite/internal/runner/app/ItIgniteNodeRestartTest.java:
##########
@@ -333,14 +335,23 @@ private List<IgniteComponent> startPartialNode(
var cfgStorage = new DistributedConfigurationStorage(metaStorageMgr,
vault);
- var clusterCfgMgr = new ConfigurationManager(
+ ConfigurationTreeGenerator distributedConfigurationGenerator = new
ConfigurationTreeGenerator(
modules.distributed().rootKeys(),
- modules.distributed().validators(),
- cfgStorage,
modules.distributed().internalSchemaExtensions(),
modules.distributed().polymorphicSchemaExtensions()
);
+ var clusterCfgMgr = new ConfigurationManager(
+ modules.distributed().rootKeys(),
+ cfgStorage,
+ new ConfigurationTreeGenerator(
Review Comment:
You should use `distributedConfigurationGenerator` here
--
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]