You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by GitBox <gi...@apache.org> on 2021/04/19 06:53:01 UTC

[GitHub] [ignite-3] vldpyatkov commented on a change in pull request #96: IGNITE-14411 Define minimal set of cluster components and their lifecycle

vldpyatkov commented on a change in pull request #96:
URL: https://github.com/apache/ignite-3/pull/96#discussion_r615573553



##########
File path: modules/api/src/main/java/org/apache/ignite/app/Ignite.java
##########
@@ -15,7 +15,18 @@
  * limitations under the License.
  */
 
+package org.apache.ignite.app;
+
+import org.apache.ignite.table.manager.TableManager;
+
 /**
- * Contains internal tests or test related classes and interfaces.
+ * Ignite node interface. Main entry-point for all Ignite APIs.
  */
-package org.apache.ignite.internal.testframework;
+public interface Ignite extends AutoCloseable {

Review comment:
       It needs to add also a configuration manager here.

##########
File path: modules/api/src/main/java/org/apache/ignite/configuration/schemas/network/NetworkConfigurationSchema.java
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.configuration.schemas.network;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.Value;
+import org.apache.ignite.configuration.storage.ConfigurationType;
+
+/**
+ * Configuration schema for network endpoint subtree.
+ */
+@ConfigurationRoot(rootName = "network", type = ConfigurationType.LOCAL)
+public class NetworkConfigurationSchema {
+    /** */
+    @Min(1024)
+    @Max(0xFFFF)
+    @Value
+    public int port;
+
+    /** */
+    @Value
+    public String[] netMembersNames;
+}

Review comment:
       Add new line.

##########
File path: modules/baseline/src/main/java/org/apache/ignite/internal/baseline/BaselineManager.java
##########
@@ -0,0 +1,58 @@
+/*
+ * 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.baseline;
+
+import org.apache.ignite.configuration.internal.ConfigurationManager;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.network.ClusterService;
+
+/**
+ * Baseline manager is responsible for handling baseline related logic.
+ */
+// TODO: IGNITE-14586 Remove @SuppressWarnings when implementation provided.
+@SuppressWarnings({"FieldCanBeLocal", "unused"}) public class BaselineManager {
+    /** Configuration manager in order to handle and listen baseline specific configuration.*/
+    private final ConfigurationManager configurationMgr;
+
+    /**
+     * MetaStorage manager in order to watch private distributed baseline specific configuration,
+     * cause ConfigurationManger handles only public configuration.
+     */
+    private final MetaStorageManager metastorageMgr;
+
+    /** Cluster network service in order to retrieve information about current network members. */

Review comment:
       Get rid of mention the term: network member.

##########
File path: modules/api/src/main/java/org/apache/ignite/configuration/schemas/network/NetworkConfigurationSchema.java
##########
@@ -0,0 +1,40 @@
+/*
+ * 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.configuration.schemas.network;
+
+import javax.validation.constraints.Max;
+import javax.validation.constraints.Min;
+import org.apache.ignite.configuration.annotation.ConfigurationRoot;
+import org.apache.ignite.configuration.annotation.Value;
+import org.apache.ignite.configuration.storage.ConfigurationType;
+
+/**
+ * Configuration schema for network endpoint subtree.
+ */
+@ConfigurationRoot(rootName = "network", type = ConfigurationType.LOCAL)
+public class NetworkConfigurationSchema {
+    /** */
+    @Min(1024)
+    @Max(0xFFFF)
+    @Value
+    public int port;
+
+    /** */
+    @Value
+    public String[] netMembersNames;

Review comment:
       Rename to netClusterNodes

##########
File path: modules/api/src/main/java/org/apache/ignite/app/Ignition.java
##########
@@ -0,0 +1,33 @@
+/*
+ * 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.app;
+
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Entry point for handling grid lifecycle.
+ */
+@SuppressWarnings("UnnecessaryInterfaceModifier")
+public interface Ignition {
+    /**
+     * Starts Ignite node with optional bootstrap configuration in json format.
+     * @param jsonStrBootstrapCfg Node configuration in json format.
+     * @return Started Ignite node.
+     */
+    public Ignite start(@Nullable String jsonStrBootstrapCfg);

Review comment:
       It looks like a temporary solution, because I think we will be bootstraped this cluster through file or some configuration Object.

##########
File path: modules/runner/src/main/java/org/apache/ignite/runner/internal/app/IgnitionImpl.java
##########
@@ -0,0 +1,179 @@
+/*
+ * 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.runner.internal.app;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.stream.Collectors;
+import org.apache.ignite.app.Ignite;
+import org.apache.ignite.app.Ignition;
+import org.apache.ignite.internal.baseline.BaselineManager;
+import org.apache.ignite.configuration.RootKey;
+import org.apache.ignite.configuration.internal.ConfigurationManager;
+import org.apache.ignite.configuration.schemas.network.NetworkConfiguration;
+import org.apache.ignite.configuration.schemas.network.NetworkView;
+import org.apache.ignite.internal.affinity.AffinityManager;
+import org.apache.ignite.configuration.storage.ConfigurationStorage;
+import org.apache.ignite.internal.table.distributed.TableManagerImpl;
+import org.apache.ignite.internal.vault.VaultManager;
+import org.apache.ignite.internal.metastorage.MetaStorageManager;
+import org.apache.ignite.network.ClusterLocalConfiguration;
+import org.apache.ignite.network.ClusterService;
+import org.apache.ignite.network.message.MessageSerializationRegistry;
+import org.apache.ignite.network.scalecube.ScaleCubeClusterServiceFactory;
+import org.apache.ignite.raft.internal.Loza;
+import org.apache.ignite.runner.internal.storage.DistributedConfigurationStorage;
+import org.apache.ignite.runner.internal.storage.LocalConfigurationStorage;
+import org.apache.ignite.internal.schema.SchemaManager;
+import org.apache.ignite.table.manager.TableManager;
+import org.apache.ignite.utils.IgniteProperties;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Implementation of an entry point for handling grid lifecycle.
+ */
+public class IgnitionImpl implements Ignition {
+    /** */
+    private static final String[] BANNER = new String[] {
+        "",
+        "           #              ___                         __",
+        "         ###             /   |   ____   ____ _ _____ / /_   ___",
+        "     #  #####           / /| |  / __ \\ / __ `// ___// __ \\ / _ \\",
+        "   ###  ######         / ___ | / /_/ // /_/ // /__ / / / // ___/",
+        "  #####  #######      /_/  |_|/ .___/ \\__,_/ \\___//_/ /_/ \\___/",
+        "  #######  ######            /_/",
+        "    ########  ####        ____               _  __           _____",
+        "   #  ########  ##       /  _/____ _ ____   (_)/ /_ ___     |__  /",
+        "  ####  #######  #       / / / __ `// __ \\ / // __// _ \\     /_ <",
+        "   #####  #####        _/ / / /_/ // / / // // /_ / ___/   ___/ /",
+        "     ####  ##         /___/ \\__, //_/ /_//_/ \\__/ \\___/   /____/",
+        "       ##                  /____/\n"
+    };
+
+    /** */
+    private static final String VER_KEY = "version";
+
+    /** */
+    private static final Logger log = LoggerFactory.getLogger(IgnitionImpl.class);
+
+    /** {@inheritDoc} */
+    @Override public synchronized Ignite start(String jsonStrBootstrapCfg) {
+        ackBanner();
+
+        // Vault Component startup.
+        VaultManager vaultMgr = new VaultManager();
+
+        boolean cfgBootstrappedFromPds = vaultMgr.bootstrapped();
+
+        List<RootKey<?, ?>> rootKeys = new ArrayList<>(Collections.singletonList(NetworkConfiguration.KEY));
+
+        List<ConfigurationStorage> configurationStorages =
+            new ArrayList<>(Collections.singletonList(new LocalConfigurationStorage(vaultMgr)));
+
+        // Bootstrap local configuration manager.
+        ConfigurationManager locConfigurationMgr = new ConfigurationManager(rootKeys, configurationStorages);
+
+        if (!cfgBootstrappedFromPds)
+            try {
+                locConfigurationMgr.bootstrap(jsonStrBootstrapCfg);
+            }
+            catch (Exception e) {
+                log.warn("Unable to parse user specific configuration, default configuration will be used", e);
+            }
+        else if (jsonStrBootstrapCfg != null)
+            log.warn("User specific configuration will be ignored, cause vault was bootstrapped with pds configuration");
+
+        NetworkView netConfigurationView =
+            locConfigurationMgr.configurationRegistry().getConfiguration(NetworkConfiguration.KEY).value();
+
+        var serializationRegistry = new MessageSerializationRegistry();
+
+        // Network startup.
+        ClusterService clusterNetSvc = new ScaleCubeClusterServiceFactory().createClusterService(
+            new ClusterLocalConfiguration(
+                "Node" + netConfigurationView.port(),
+                netConfigurationView.port(),
+                Arrays.asList(netConfigurationView.netMembersNames()),

Review comment:
       Get rid of mention the term: network member.




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org