http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm index e8f018e..53d6563 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1/cluster_state_1.1.regexadm @@ -21,11 +21,15 @@ "metadata\.listen\.port" : 0, "metadata\.node" : "asterix_nc1", "metadata\.registration\.timeout\.secs" : 60, + "replication\.enabled" : false, + "replication\.factor" : 3, "replication\.log\.batchsize" : 4096, "replication\.log\.buffer\.numpages" : 8, "replication\.log\.buffer\.pagesize" : 131072, "replication\.max\.remote\.recovery\.attempts" : 5, - "replication\.timeout" : 30, + "replication\.port" : 2000, + "replication\.strategy" : "chained_declustering", + "replication\.timeout" : 15, "txn\.commitprofiler\.enabled" : false, "txn\.commitprofiler\.reportinterval" : 5, "txn\.job\.recovery\.memorysize" : 67108864,
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm index e099835..941c8bb 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_full/cluster_state_1_full.1.regexadm @@ -21,11 +21,15 @@ "metadata\.listen\.port" : 0, "metadata\.node" : "asterix_nc1", "metadata\.registration\.timeout\.secs" : 60, + "replication\.enabled" : false, + "replication\.factor" : 3, "replication\.log\.batchsize" : 4096, "replication\.log\.buffer\.numpages" : 8, "replication\.log\.buffer\.pagesize" : 131072, "replication\.max\.remote\.recovery\.attempts" : 5, - "replication\.timeout" : 30, + "replication\.port" : 2000, + "replication\.strategy" : "chained_declustering", + "replication\.timeout" : 15, "txn\.commitprofiler\.enabled" : false, "txn\.commitprofiler\.reportinterval" : 5, "txn\.job\.recovery\.memorysize" : 67108864, http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm index b3fe5cc..bb495cd 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/api/cluster_state_1_less/cluster_state_1_less.1.regexadm @@ -21,11 +21,15 @@ "metadata\.listen\.port" : 0, "metadata\.node" : "asterix_nc1", "metadata\.registration\.timeout\.secs" : 60, + "replication\.enabled" : false, + "replication\.factor" : 3, "replication\.log\.batchsize" : 4096, "replication\.log\.buffer\.numpages" : 8, "replication\.log\.buffer\.pagesize" : 131072, "replication\.max\.remote\.recovery\.attempts" : 5, - "replication\.timeout" : 30, + "replication\.port" : 2000, + "replication\.strategy" : "chained_declustering", + "replication\.timeout" : 15, "txn\.commitprofiler\.enabled" : false, "txn\.commitprofiler\.reportinterval" : 5, "txn\.job\.recovery\.memorysize" : 67108864, http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/add_replica/add_replica.2.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/add_replica/add_replica.2.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/add_replica/add_replica.2.adm index 6836f71..e48cbcf 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/add_replica/add_replica.2.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/add_replica/add_replica.2.adm @@ -1,7 +1,7 @@ [ { "partition" : 0, "replicas" : [ { - "location" : "127.0.0.1:2017", + "location" : "127.0.0.1:2002", "status" : "IN_SYNC" } ] -} ] \ No newline at end of file +} ] http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.2.adm ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.2.adm b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.2.adm index 6836f71..7e92c87 100644 --- a/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.2.adm +++ b/asterixdb/asterix-app/src/test/resources/runtimets/results/replication/metadata_failover/metadata_failover.2.adm @@ -1,7 +1,7 @@ [ { "partition" : 0, "replicas" : [ { - "location" : "127.0.0.1:2017", + "location" : "127.0.0.1:2002", "status" : "IN_SYNC" } ] } ] \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java index 7616aed..5b7e5a7 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/cluster/IClusterStateManager.java @@ -25,7 +25,6 @@ import java.util.concurrent.TimeUnit; import org.apache.asterix.common.api.IClusterManagementWork.ClusterState; import org.apache.asterix.common.dataflow.ICcApplicationContext; import org.apache.asterix.common.exceptions.AsterixException; -import org.apache.asterix.event.schema.cluster.Node; import org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint; import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException; import org.apache.hyracks.api.config.IOption; @@ -210,11 +209,6 @@ public interface IClusterStateManager { void notifyNodeFailure(String deadNode) throws HyracksException; /** - * @return a substitution node or null - */ - Node getAvailableSubstitutionNode(); - - /** * Add node to the list of nodes pending removal * * @param nodeId @@ -228,4 +222,6 @@ public interface IClusterStateManager { * @return */ boolean cancelRemovePending(String nodeId); + + Map<String, Map<IOption, Object>> getActiveNcConfiguration(); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java deleted file mode 100644 index cc3291d..0000000 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.asterix.common.config; - -import java.io.InputStream; -import java.util.Optional; -import java.util.stream.Collectors; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; - -import org.apache.asterix.common.replication.IReplicationStrategy; -import org.apache.asterix.common.replication.ReplicationStrategyFactory; -import org.apache.asterix.event.schema.cluster.Cluster; -import org.apache.asterix.event.schema.cluster.Node; -import org.apache.asterix.event.schema.cluster.Replica; -import org.apache.commons.lang3.StringUtils; -import org.apache.hyracks.api.exceptions.HyracksDataException; - -public class ClusterProperties { - - public static final ClusterProperties INSTANCE = new ClusterProperties(); - public static final String CLUSTER_CONFIGURATION_FILE = "cluster.xml"; - private String nodeNamePrefix = StringUtils.EMPTY; - private Cluster cluster; - - private ClusterProperties() { - InputStream is = this.getClass().getClassLoader().getResourceAsStream(CLUSTER_CONFIGURATION_FILE); - if (is != null) { - try { - JAXBContext ctx = JAXBContext.newInstance(Cluster.class); - Unmarshaller unmarshaller = ctx.createUnmarshaller(); - cluster = (Cluster) unmarshaller.unmarshal(is); - nodeNamePrefix = cluster.getInstanceName() + "_"; - updateNodeIdToFullName(); - } catch (JAXBException e) { - throw new IllegalStateException("Failed to read configuration file " + CLUSTER_CONFIGURATION_FILE, e); - } - } - } - - public Cluster getCluster() { - return cluster; - } - - public Node getNodeById(String nodeId) { - Optional<Node> matchingNode = cluster.getNode().stream().filter(node -> node.getId().equals(nodeId)).findAny(); - return matchingNode.isPresent() ? matchingNode.get() : null; - } - - public int getNodeIndex(String nodeId) { - for (int i = 0; i < cluster.getNode().size(); i++) { - Node node = cluster.getNode().get(i); - if (node.getId().equals(nodeId)) { - return i; - } - } - return -1; - } - - public IReplicationStrategy getReplicationStrategy() throws HyracksDataException { - return ReplicationStrategyFactory.create(cluster); - } - - private String getNodeFullName(String nodeId) { - if (nodeId.startsWith(nodeNamePrefix)) { - return nodeId; - } - return nodeNamePrefix + nodeId; - } - - private void updateNodeIdToFullName() { - cluster.getNode().forEach(node -> node.setId(getNodeFullName(node.getId()))); - if (cluster.getMetadataNode() != null) { - cluster.setMetadataNode(getNodeFullName(cluster.getMetadataNode())); - } - if (cluster.getHighAvailability() != null && cluster.getHighAvailability().getFaultTolerance() != null - && cluster.getHighAvailability().getFaultTolerance().getReplica() != null) { - Replica replicas = cluster.getHighAvailability().getFaultTolerance().getReplica(); - replicas.setNodeId(replicas.getNodeId().stream().map(this::getNodeFullName).collect(Collectors.toList())); - } - } -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/NodeProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/NodeProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/NodeProperties.java index 2e25e34..1443b8e 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/NodeProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/NodeProperties.java @@ -112,4 +112,12 @@ public class NodeProperties extends AbstractProperties { public boolean isVirtualNc() { return accessor.getInt(NCConfig.Option.NCSERVICE_PORT) == NCConfig.NCSERVICE_PORT_DISABLED; } + + public String getTxnLogDir() { + return accessor.getString(Option.TXN_LOG_DIR); + } + + public String getStorageSubdir() { + return accessor.getString(Option.STORAGE_SUBDIR); + } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java index 467e877..150705e 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/PropertiesAccessor.java @@ -18,23 +18,17 @@ */ package org.apache.asterix.common.config; -import static org.apache.asterix.common.config.MetadataProperties.Option.INSTANCE_NAME; -import static org.apache.asterix.common.config.MetadataProperties.Option.METADATA_NODE; import static org.apache.asterix.common.config.NodeProperties.Option.STORAGE_SUBDIR; import static org.apache.hyracks.control.common.controllers.NCConfig.Option.IODEVICES; import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; -import java.util.Objects; import java.util.Properties; import java.util.Set; import java.util.SortedMap; @@ -43,23 +37,10 @@ import java.util.concurrent.ConcurrentHashMap; import java.util.function.Predicate; import java.util.logging.Level; import java.util.logging.Logger; -import java.util.stream.Stream; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.Unmarshaller; import org.apache.asterix.common.cluster.ClusterPartition; -import org.apache.asterix.common.configuration.AsterixConfiguration; -import org.apache.asterix.common.configuration.Coredump; -import org.apache.asterix.common.configuration.Extension; -import org.apache.asterix.common.configuration.Property; -import org.apache.asterix.common.configuration.Store; -import org.apache.asterix.common.configuration.TransactionLogDir; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.common.exceptions.ErrorCode; -import org.apache.asterix.common.utils.ConfigUtil; -import org.apache.asterix.event.schema.cluster.Node; import org.apache.commons.lang3.mutable.MutableInt; import org.apache.hyracks.algebricks.common.utils.Pair; import org.apache.hyracks.api.config.IApplicationConfig; @@ -68,8 +49,6 @@ import org.apache.hyracks.api.config.IOptionType; import org.apache.hyracks.api.config.Section; import org.apache.hyracks.control.common.application.ConfigManagerApplicationConfig; import org.apache.hyracks.control.common.config.ConfigManager; -import org.apache.hyracks.control.common.controllers.ControllerConfig; -import org.apache.hyracks.control.common.controllers.NCConfig; public class PropertiesAccessor implements IApplicationConfig { private static final Logger LOGGER = Logger.getLogger(PropertiesAccessor.class.getName()); @@ -93,142 +72,21 @@ public class PropertiesAccessor implements IApplicationConfig { nodePartitionsMap = new ConcurrentHashMap<>(); clusterPartitions = Collections.synchronizedSortedMap(new TreeMap<>()); extensions = new ArrayList<>(); - // Determine whether to use old-style asterix-configuration.xml or new-style configuration. - // QQQ strip this out eventually - // QQQ this is NOT a good way to determine whether to use config file ConfigManager configManager = ((ConfigManagerApplicationConfig) cfg).getConfigManager(); - boolean usingConfigFile = Stream - .of((IOption) ControllerConfig.Option.CONFIG_FILE, ControllerConfig.Option.CONFIG_FILE_URL) - .map(configManager::get).anyMatch(Objects::nonNull); - AsterixConfiguration asterixConfiguration = null; - try { - asterixConfiguration = configure( - System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY, GlobalConfig.DEFAULT_CONFIG_FILE_NAME)); - } catch (Exception e) { - // cannot load config file, assume new-style config + MutableInt uniquePartitionId = new MutableInt(0); + // Iterate through each configured NC. + for (String ncName : cfg.getNCNames()) { + configureNc(configManager, ncName, uniquePartitionId); } - - if (!usingConfigFile && asterixConfiguration != null) { - LOGGER.info("using old-style configuration: " + System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY)); - if (asterixConfiguration.getInstanceName() != null) { - configManager.set(INSTANCE_NAME, asterixConfiguration.getInstanceName()); - } - if (asterixConfiguration.getMetadataNode() != null) { - configManager.set(METADATA_NODE, asterixConfiguration.getMetadataNode()); - } - List<Store> configuredStores = asterixConfiguration.getStore(); - - int uniquePartitionId = 0; - // Here we iterate through all <store> elements in asterix-configuration.xml. - // For each one, we create an array of ClusterPartitions and store this array - // in nodePartitionsMap, keyed by the node name. The array is the same length - // as the comma-separated <storeDirs> child element, because Managix will have - // arranged for that element to be populated with the full paths to each - // partition directory (as formed by appending the <store> subdirectory to - // each <iodevices> path from the user's original cluster.xml). - for (Store store : configuredStores) { - configManager.set(store.getNcId(), NodeProperties.Option.STARTING_PARTITION_ID, uniquePartitionId); - String trimmedStoreDirs = store.getStoreDirs().trim(); - String[] nodeStores = trimmedStoreDirs.split(","); - ClusterPartition[] nodePartitions = new ClusterPartition[nodeStores.length]; - for (int i = 0; i < nodePartitions.length; i++) { - ClusterPartition partition = new ClusterPartition(uniquePartitionId++, store.getNcId(), i); - clusterPartitions.put(partition.getPartitionId(), partition); - nodePartitions[i] = partition; - } - stores.put(store.getNcId(), nodeStores); - nodePartitionsMap.put(store.getNcId(), nodePartitions); - // push the store info to the config manager - configManager.set(store.getNcId(), NCConfig.Option.IODEVICES, nodeStores); - // marking node as virtual, as we're not using NCServices with old-style config - configManager.set(store.getNcId(), NCConfig.Option.NCSERVICE_PORT, NCConfig.NCSERVICE_PORT_DISABLED); - } - // populate nc api port from cluster properties - final ExternalProperties.Option ncApiPort = ExternalProperties.Option.NC_API_PORT; - for (Node node : ClusterProperties.INSTANCE.getCluster().getNode()) { - configManager.set(node.getId(), ncApiPort, node.getNcApiPort().intValue()); - } - // Get extensions - if (asterixConfiguration.getExtensions() != null) { - for (Extension ext : asterixConfiguration.getExtensions().getExtension()) { - extensions.add(ConfigUtil.toAsterixExtension(ext)); - } - } - for (Property p : asterixConfiguration.getProperty()) { - IOption option = null; - for (Section section : Arrays.asList(Section.COMMON, Section.CC, Section.NC)) { - IOption optionTemp = cfg.lookupOption(section.sectionName(), p.getName()); - if (optionTemp == null) { - continue; - } - if (option != null) { - throw new IllegalStateException( - "ERROR: option found in multiple sections: " + Arrays.asList(option, optionTemp)); - } - option = optionTemp; - } - if (option == null) { - LOGGER.warning("Ignoring unknown property: " + p.getName()); - } else { - configManager.set(option, option.type().parse(p.getValue())); - } - } - for (Coredump cd : asterixConfiguration.getCoredump()) { - coredumpConfig.put(cd.getNcId(), cd.getCoredumpPath()); - } - for (TransactionLogDir txnLogDir : asterixConfiguration.getTransactionLogDir()) { - transactionLogDirs.put(txnLogDir.getNcId(), txnLogDir.getTxnLogDirPath()); - } - } else { - LOGGER.info("using new-style configuration"); - MutableInt uniquePartitionId = new MutableInt(0); - // Iterate through each configured NC. - for (String ncName : cfg.getNCNames()) { - configureNc(configManager, ncName, uniquePartitionId); - } - for (String section : cfg.getSectionNames()) { - if (section.startsWith(AsterixProperties.SECTION_PREFIX_EXTENSION)) { - String className = AsterixProperties.getSectionId(AsterixProperties.SECTION_PREFIX_EXTENSION, - section); - configureExtension(className, section); - } + for (String section : cfg.getSectionNames()) { + if (section.startsWith(AsterixProperties.SECTION_PREFIX_EXTENSION)) { + String className = AsterixProperties.getSectionId(AsterixProperties.SECTION_PREFIX_EXTENSION, section); + configureExtension(className, section); } } loadAsterixBuildProperties(); } - private AsterixConfiguration configure(String fileName) throws IOException, AsterixException { - try (InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName)) { - if (is != null) { - return configure(is, fileName); - } - } - try (FileInputStream is = new FileInputStream(fileName)) { - return configure(is, fileName); - } catch (FileNotFoundException fnf1) { - LOGGER.warning( - "Failed to get configuration file " + fileName + " as FileInputStream. FileNotFoundException"); - LOGGER.warning("Attempting to get default configuration file " + GlobalConfig.DEFAULT_CONFIG_FILE_NAME - + " as FileInputStream"); - try (FileInputStream fis = new FileInputStream(GlobalConfig.DEFAULT_CONFIG_FILE_NAME)) { - return configure(fis, GlobalConfig.DEFAULT_CONFIG_FILE_NAME); - } catch (FileNotFoundException fnf2) { - fnf1.addSuppressed(fnf2); - throw new AsterixException("Could not find configuration file " + fileName, fnf1); - } - } - } - - private AsterixConfiguration configure(InputStream is, String fileName) throws AsterixException { - try { - JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class); - Unmarshaller unmarshaller = ctx.createUnmarshaller(); - return (AsterixConfiguration) unmarshaller.unmarshal(is); - } catch (JAXBException e) { - throw new AsterixException("Failed to read configuration file " + fileName, e); - } - } - private void configureExtension(String className, String section) { Set<String> keys = cfg.getKeys(section); List<Pair<String, String>> kvs = new ArrayList<>(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java index 1e79a26..6e7d58b 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java @@ -18,37 +18,43 @@ */ package org.apache.asterix.common.config; -import static org.apache.hyracks.control.common.config.OptionTypes.INTEGER; -import static org.apache.hyracks.control.common.config.OptionTypes.INTEGER_BYTE_UNIT; - -import java.util.Set; -import java.util.stream.Collectors; - -import org.apache.asterix.common.replication.IReplicationStrategy; -import org.apache.asterix.common.replication.Replica; -import org.apache.asterix.event.schema.cluster.Cluster; -import org.apache.asterix.event.schema.cluster.Node; +import java.util.List; import org.apache.hyracks.api.config.IApplicationConfig; import org.apache.hyracks.api.config.IOption; import org.apache.hyracks.api.config.IOptionType; import org.apache.hyracks.api.config.Section; import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.control.common.controllers.NCConfig; import org.apache.hyracks.util.StorageUtil; import org.apache.hyracks.util.StorageUtil.StorageUnit; +import static org.apache.hyracks.control.common.config.OptionTypes.*; + public class ReplicationProperties extends AbstractProperties { public enum Option implements IOption { - REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS(INTEGER, 5, + REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS( + INTEGER, + 5, "The maximum number of times to attempt to recover from a replica on failure before giving up"), - REPLICATION_LOG_BUFFER_PAGESIZE(INTEGER_BYTE_UNIT, StorageUtil.getIntSizeInBytes(128, - StorageUnit.KILOBYTE), "The size in bytes of each log buffer page"), + REPLICATION_LOG_BUFFER_PAGESIZE( + INTEGER_BYTE_UNIT, + StorageUtil.getIntSizeInBytes(128, StorageUnit.KILOBYTE), + "The size in bytes of each log buffer page"), REPLICATION_LOG_BUFFER_NUMPAGES(INTEGER, 8, "The number of log buffer pages"), - REPLICATION_LOG_BATCHSIZE(INTEGER_BYTE_UNIT, StorageUtil.getIntSizeInBytes(4, StorageUnit.KILOBYTE), + REPLICATION_LOG_BATCHSIZE( + INTEGER_BYTE_UNIT, + StorageUtil.getIntSizeInBytes(4, StorageUnit.KILOBYTE), "The size in bytes to replicate in each batch"), - REPLICATION_TIMEOUT(INTEGER, REPLICATION_TIME_OUT_DEFAULT, + REPLICATION_TIMEOUT( + INTEGER, + REPLICATION_TIME_OUT_DEFAULT, "The time in seconds to timeout when trying to contact a replica, before assuming it is dead"), - ; + + REPLICATION_ENABLED(BOOLEAN, false, "Whether or not data replication is enabled"), + REPLICATION_FACTOR(INTEGER, 3, "Number of node controller faults to tolerate with replication"), + REPLICATION_STRATEGY(STRING, "chained_declustering", "Replication strategy to choose"), + REPLICATION_PORT(INTEGER, 2000, "port on which to run replication related communications"),; private final IOptionType type; private final Object defaultValue; @@ -84,13 +90,6 @@ public class ReplicationProperties extends AbstractProperties { public Object get(IApplicationConfig config) { switch (this) { case REPLICATION_TIMEOUT: - final Cluster cluster = ClusterProperties.INSTANCE.getCluster(); - if (cluster != null - && cluster.getHighAvailability() != null - && cluster.getHighAvailability().getDataReplication() != null - && cluster.getHighAvailability().getDataReplication().getReplicationTimeOut() != null) { - return cluster.getHighAvailability().getDataReplication().getReplicationTimeOut().intValue(); - } return REPLICATION_TIME_OUT_DEFAULT; default: return config.getStatic(this); @@ -98,23 +97,28 @@ public class ReplicationProperties extends AbstractProperties { } } - private static final int REPLICATION_DATAPORT_DEFAULT = 2000; + public boolean isReplicationEnabled() { + return accessor.getBoolean(Option.REPLICATION_ENABLED); + } private static final int REPLICATION_TIME_OUT_DEFAULT = 15; - private static final String NODE_IP_ADDRESS_DEFAULT = "127.0.0.1"; - - private final IReplicationStrategy repStrategy; - public ReplicationProperties(PropertiesAccessor accessor) throws HyracksDataException { super(accessor); - this.repStrategy = ClusterProperties.INSTANCE.getReplicationStrategy(); } public int getMaxRemoteRecoveryAttempts() { return accessor.getInt(Option.REPLICATION_MAX_REMOTE_RECOVERY_ATTEMPTS); } + public int getReplicationFactor() { + return accessor.getInt(Option.REPLICATION_FACTOR); + } + + public List<String> getNodeIds() { + return accessor.getNCNames(); + } + public int getLogBufferPageSize() { return accessor.getInt(Option.REPLICATION_LOG_BUFFER_PAGESIZE); } @@ -127,53 +131,20 @@ public class ReplicationProperties extends AbstractProperties { return accessor.getInt(Option.REPLICATION_LOG_BATCHSIZE); } - public String getReplicaIPAddress(String nodeId) { - Node node = ClusterProperties.INSTANCE.getNodeById(nodeId); - return node != null ? node.getClusterIp() : NODE_IP_ADDRESS_DEFAULT; + public String getNodeIpFromId(String id) { + return accessor.getNCEffectiveConfig(id).getString(NCConfig.Option.PUBLIC_ADDRESS); } - public int getDataReplicationPort(String nodeId) { - final Cluster cluster = ClusterProperties.INSTANCE.getCluster(); - Node node = ClusterProperties.INSTANCE.getNodeById(nodeId); - if (node != null) { - return node.getReplicationPort() != null ? node.getReplicationPort().intValue() - : cluster.getHighAvailability().getDataReplication().getReplicationPort().intValue(); - } - return REPLICATION_DATAPORT_DEFAULT; - } - - public Replica getReplicaById(String nodeId) { - Node node = ClusterProperties.INSTANCE.getNodeById(nodeId); - if (node != null) { - return new Replica(node); - } - return null; - } - - public Set<String> getRemoteReplicasIds(String nodeId) { - return repStrategy.getRemoteReplicas(nodeId).stream().map(Replica::getId).collect(Collectors.toSet()); - } - - public Set<String> getRemotePrimaryReplicasIds(String nodeId) { - return repStrategy.getRemotePrimaryReplicas(nodeId).stream().map(Replica::getId).collect(Collectors.toSet()); - } - - public Set<String> getNodeReplicasIds(String nodeId) { - Set<String> remoteReplicasIds = getRemoteReplicasIds(nodeId); - // This includes the node itself - remoteReplicasIds.add(nodeId); - return remoteReplicasIds; + public String getReplicationStrategy() { + return accessor.getString(Option.REPLICATION_STRATEGY); } public int getReplicationTimeOut() { return accessor.getInt(Option.REPLICATION_TIMEOUT); } - public boolean isParticipant(String nodeId) { - return repStrategy.isParticipant(nodeId); + public MetadataProperties getMetadataProperties() { + return new MetadataProperties(accessor); } - public IReplicationStrategy getReplicationStrategy() { - return repStrategy; - } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java index dc69383..1ef798c 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ChainedDeclusteringReplicationStrategy.java @@ -24,16 +24,18 @@ import java.util.Set; import java.util.logging.Level; import java.util.logging.Logger; -import org.apache.asterix.common.config.ClusterProperties; -import org.apache.asterix.common.exceptions.ErrorCode; -import org.apache.asterix.common.exceptions.RuntimeDataException; -import org.apache.asterix.event.schema.cluster.Cluster; +import org.apache.asterix.common.config.ReplicationProperties; +import org.apache.hyracks.api.config.IConfigManager; import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.control.common.config.ConfigManager; +import org.apache.hyracks.control.common.controllers.NCConfig; public class ChainedDeclusteringReplicationStrategy implements IReplicationStrategy { private static final Logger LOGGER = Logger.getLogger(ChainedDeclusteringReplicationStrategy.class.getName()); private int replicationFactor; + private ReplicationProperties repProp; + private ConfigManager configManager; @Override public boolean isMatch(int datasetId) { @@ -43,9 +45,8 @@ public class ChainedDeclusteringReplicationStrategy implements IReplicationStrat @Override public Set<Replica> getRemoteReplicas(String nodeId) { Set<Replica> remoteReplicas = new HashSet<>(); - Cluster cluster = ClusterProperties.INSTANCE.getCluster(); int numberOfRemoteReplicas = replicationFactor - 1; - int nodeIndex = ClusterProperties.INSTANCE.getNodeIndex(nodeId); + int nodeIndex = repProp.getNodeIds().indexOf(nodeId); if (nodeIndex == -1) { if (LOGGER.isLoggable(Level.WARNING)) { @@ -56,35 +57,49 @@ public class ChainedDeclusteringReplicationStrategy implements IReplicationStrat //find nodes to the right of this node while (remoteReplicas.size() != numberOfRemoteReplicas) { - remoteReplicas.add(new Replica(cluster.getNode().get(++nodeIndex % cluster.getNode().size()))); + String replica = repProp.getNodeIds().get(++nodeIndex % repProp.getNodeIds().size()); + remoteReplicas.add(new Replica(replica, + configManager.getNodeEffectiveConfig(replica).getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS), + configManager.getNodeEffectiveConfig(replica).getInt(NCConfig.Option.REPLICATION_LISTEN_PORT))); } return remoteReplicas; } @Override + public Set<Replica> getRemoteReplicasAndSelf(String nodeId) { + Set<Replica> replicas = getRemoteReplicas(nodeId); + replicas.add(new Replica(nodeId, + configManager.getNodeEffectiveConfig(nodeId).getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS), + configManager.getNodeEffectiveConfig(nodeId).getInt(NCConfig.Option.REPLICATION_LISTEN_PORT))); + return replicas; + + } + + @Override public Set<Replica> getRemotePrimaryReplicas(String nodeId) { Set<Replica> clientReplicas = new HashSet<>(); - Cluster cluster = ClusterProperties.INSTANCE.getCluster(); final int remotePrimaryReplicasCount = replicationFactor - 1; - - int nodeIndex = ClusterProperties.INSTANCE.getNodeIndex(nodeId); + int nodeIndex = repProp.getNodeIds().indexOf(nodeId); //find nodes to the left of this node while (clientReplicas.size() != remotePrimaryReplicasCount) { - clientReplicas.add(new Replica(cluster.getNode().get(Math.abs(--nodeIndex % cluster.getNode().size())))); + String replica = repProp.getNodeIds().get(Math.abs(--nodeIndex % repProp.getNodeIds().size())); + clientReplicas.add(new Replica(replica, + configManager.getNodeEffectiveConfig(replica).getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS), + configManager.getNodeEffectiveConfig(replica).getInt(NCConfig.Option.REPLICATION_LISTEN_PORT))); } return clientReplicas; } @Override - public ChainedDeclusteringReplicationStrategy from(Cluster cluster) throws HyracksDataException { - if (cluster.getHighAvailability().getDataReplication().getReplicationFactor() == null) { - throw new RuntimeDataException(ErrorCode.INVALID_CONFIGURATION, "Replication factor must be specified."); - } + public ChainedDeclusteringReplicationStrategy from(ReplicationProperties repProp, IConfigManager configManager) + throws HyracksDataException { ChainedDeclusteringReplicationStrategy cd = new ChainedDeclusteringReplicationStrategy(); - cd.replicationFactor = cluster.getHighAvailability().getDataReplication().getReplicationFactor().intValue(); + cd.repProp = repProp; + cd.replicationFactor = repProp.getReplicationFactor(); + cd.configManager = (ConfigManager) configManager; return cd; } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java index 04c4437..07076cf 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationManager.java @@ -56,8 +56,8 @@ public interface IReplicationManager extends IIOReplicationManager { * a list of already existing files on the requester * @throws IOException */ - public void requestReplicaFiles(String remoteReplicaId, Set<Integer> partitionsToRecover, - Set<String> existingFiles) throws IOException; + public void requestReplicaFiles(String remoteReplicaId, Set<Integer> partitionsToRecover, Set<String> existingFiles) + throws IOException; /** * Requests current maximum LSN from remote replicas. @@ -128,6 +128,8 @@ public interface IReplicationManager extends IIOReplicationManager { */ public void replicateTxnLogBatch(ByteBuffer buffer); + IReplicationStrategy getReplicationStrategy(); + /** * Registers {@code replica}. After registration, the replica will be included in all replication events * http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java index b3f1701..93ccfbe 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/IReplicationStrategy.java @@ -20,7 +20,8 @@ package org.apache.asterix.common.replication; import java.util.Set; -import org.apache.asterix.event.schema.cluster.Cluster; +import org.apache.asterix.common.config.ReplicationProperties; +import org.apache.hyracks.api.config.IConfigManager; import org.apache.hyracks.api.exceptions.HyracksDataException; public interface IReplicationStrategy { @@ -31,6 +32,8 @@ public interface IReplicationStrategy { */ boolean isMatch(int datasetId); + Set<Replica> getRemoteReplicasAndSelf(String nodeId); + /** * @param nodeId * @return The set of nodes that replicate data on {@code nodeId}. @@ -52,8 +55,8 @@ public interface IReplicationStrategy { } /** - * @param cluster + * @param p * @return A replication strategy based on the passed configurations. */ - IReplicationStrategy from(Cluster cluster) throws HyracksDataException; + IReplicationStrategy from(ReplicationProperties p, IConfigManager configManager) throws HyracksDataException; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java index f0bba41..2262437 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/MetadataOnlyReplicationStrategy.java @@ -22,20 +22,22 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.Set; +import java.util.stream.Collectors; -import org.apache.asterix.common.config.ClusterProperties; -import org.apache.asterix.common.exceptions.ErrorCode; -import org.apache.asterix.common.exceptions.RuntimeDataException; +import org.apache.asterix.common.config.MetadataProperties; +import org.apache.asterix.common.config.ReplicationProperties; import org.apache.asterix.common.metadata.MetadataIndexImmutableProperties; -import org.apache.asterix.event.schema.cluster.Cluster; -import org.apache.asterix.event.schema.cluster.Node; +import org.apache.hyracks.api.config.IConfigManager; import org.apache.hyracks.api.exceptions.HyracksDataException; +import org.apache.hyracks.control.common.config.ConfigManager; +import org.apache.hyracks.control.common.controllers.NCConfig; public class MetadataOnlyReplicationStrategy implements IReplicationStrategy { - private String metadataNodeId; + private String metadataPrimaryReplicaId; private Replica metadataPrimaryReplica; private Set<Replica> metadataNodeReplicas; + MetadataProperties metadataProperties; @Override public boolean isMatch(int datasetId) { @@ -44,13 +46,25 @@ public class MetadataOnlyReplicationStrategy implements IReplicationStrategy { @Override public Set<Replica> getRemoteReplicas(String nodeId) { - if (nodeId.equals(metadataNodeId)) { + if (nodeId.equals(metadataPrimaryReplicaId)) { return metadataNodeReplicas; } return Collections.emptySet(); } @Override + public Set<Replica> getRemoteReplicasAndSelf(String nodeId) { + + if (nodeId.equals(metadataPrimaryReplicaId)) { + Set<Replica> replicasAndSelf = new HashSet<>(); + replicasAndSelf.addAll(metadataNodeReplicas); + replicasAndSelf.add(metadataPrimaryReplica); + return replicasAndSelf; + } + return Collections.emptySet(); + } + + @Override public Set<Replica> getRemotePrimaryReplicas(String nodeId) { if (metadataNodeReplicas.stream().map(Replica::getId).filter(replicaId -> replicaId.equals(nodeId)) .count() != 0) { @@ -60,29 +74,29 @@ public class MetadataOnlyReplicationStrategy implements IReplicationStrategy { } @Override - public MetadataOnlyReplicationStrategy from(Cluster cluster) throws HyracksDataException { - if (cluster.getMetadataNode() == null) { - throw new RuntimeDataException(ErrorCode.INVALID_CONFIGURATION, "Metadata node must be specified."); - } - - Node metadataNode = ClusterProperties.INSTANCE.getNodeById(cluster.getMetadataNode()); - if (metadataNode == null) { - throw new IllegalStateException("Invalid metadata node specified"); - } + public MetadataOnlyReplicationStrategy from(ReplicationProperties p, IConfigManager configManager) + throws HyracksDataException { + MetadataOnlyReplicationStrategy st = new MetadataOnlyReplicationStrategy(); + st.metadataProperties = p.getMetadataProperties(); + st.metadataPrimaryReplicaId = st.metadataProperties.getMetadataNodeName(); + st.metadataPrimaryReplica = new Replica(st.metadataPrimaryReplicaId, + ((ConfigManager) configManager).getNodeEffectiveConfig(st.metadataPrimaryReplicaId) + .getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS), + ((ConfigManager) configManager).getNodeEffectiveConfig(st.metadataPrimaryReplicaId) + .getInt(NCConfig.Option.REPLICATION_LISTEN_PORT)); final Set<Replica> replicas = new HashSet<>(); - if (cluster.getHighAvailability().getFaultTolerance().getReplica() != null) { - for (String nodeId : cluster.getHighAvailability().getFaultTolerance().getReplica().getNodeId()) { - Node node = ClusterProperties.INSTANCE.getNodeById(nodeId); - if (node == null) { - throw new RuntimeDataException(ErrorCode.INVALID_CONFIGURATION, - "Invalid replica specified: " + nodeId); - } - replicas.add(new Replica(node)); - } + Set<String> candidateSet = new HashSet<>(); + candidateSet.addAll(((ConfigManager) (configManager)).getNodeNames()); + candidateSet.remove(st.metadataPrimaryReplicaId); + String[] candidateAry = new String[candidateSet.size()]; + candidateSet.toArray(candidateAry); + for (int i = 0; i < candidateAry.length && i < p.getReplicationFactor(); i++) { + replicas.add(new Replica(candidateAry[i], + ((ConfigManager) configManager).getNodeEffectiveConfig(candidateAry[i]) + .getString(NCConfig.Option.REPLICATION_LISTEN_ADDRESS), + ((ConfigManager) configManager).getNodeEffectiveConfig(candidateAry[i]) + .getInt(NCConfig.Option.REPLICATION_LISTEN_PORT))); } - MetadataOnlyReplicationStrategy st = new MetadataOnlyReplicationStrategy(); - st.metadataNodeId = cluster.getMetadataNode(); - st.metadataPrimaryReplica = new Replica(metadataNode); st.metadataNodeReplicas = replicas; return st; } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/NoReplicationStrategy.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/NoReplicationStrategy.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/NoReplicationStrategy.java index 43347f6..c32ee3c 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/NoReplicationStrategy.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/NoReplicationStrategy.java @@ -21,7 +21,10 @@ package org.apache.asterix.common.replication; import java.util.Collections; import java.util.Set; -import org.apache.asterix.event.schema.cluster.Cluster; +import org.apache.asterix.common.config.ReplicationProperties; +import org.apache.hyracks.api.config.IConfigManager; +import org.apache.hyracks.control.common.config.ConfigManager; +import org.apache.hyracks.control.common.controllers.NCConfig; public class NoReplicationStrategy implements IReplicationStrategy { @@ -45,8 +48,12 @@ public class NoReplicationStrategy implements IReplicationStrategy { return Collections.emptySet(); } + public Set<Replica> getRemoteReplicasAndSelf(String nodeId) { + return Collections.emptySet(); + } + @Override - public NoReplicationStrategy from(Cluster cluster) { + public NoReplicationStrategy from(ReplicationProperties p, IConfigManager configManager) { return new NoReplicationStrategy(); } } \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/Replica.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/Replica.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/Replica.java index 267a22d..52dbd25 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/Replica.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/Replica.java @@ -23,10 +23,6 @@ import java.io.DataOutput; import java.io.DataOutputStream; import java.io.IOException; import java.io.OutputStream; -import java.net.InetSocketAddress; - -import org.apache.asterix.common.config.ReplicationProperties; -import org.apache.asterix.event.schema.cluster.Node; public class Replica { @@ -36,13 +32,15 @@ public class Replica { UNKNOWN } - private final Node node; private ReplicaState state = ReplicaState.UNKNOWN; + String nodeId; + String ipAddr; + int port; - public Replica(Node node) { - this.node = new Node(); - this.node.setId(node.getId()); - this.node.setClusterIp(node.getClusterIp()); + public Replica(String id, String ip, int port) { + nodeId = id; + ipAddr = ip; + this.port = port; } public ReplicaState getState() { @@ -53,41 +51,62 @@ public class Replica { this.state = state; } - public Node getNode() { - return node; - } - - public String getId() { - return node.getId(); - } - - public InetSocketAddress getAddress(ReplicationProperties asterixReplicationProperties) { - String replicaIPAddress = node.getClusterIp(); - int replicationPort = asterixReplicationProperties.getDataReplicationPort(node.getId()); - return InetSocketAddress.createUnresolved(replicaIPAddress, replicationPort); - } - public static Replica create(DataInput input) throws IOException { - Node node = new Node(); - Replica replica = new Replica(node); + Replica replica = new Replica(null, null, -1); replica.readFields(input); return replica; } + public String getId() { + return nodeId; + } + public void writeFields(DataOutput output) throws IOException { - output.writeUTF(node.getId()); - output.writeUTF(node.getClusterIp()); + output.writeUTF(nodeId); + output.writeUTF(ipAddr); + output.writeInt(port); output.writeInt(state.ordinal()); } public void readFields(DataInput input) throws IOException { - this.node.setId(input.readUTF()); - this.node.setClusterIp(input.readUTF()); + this.nodeId = input.readUTF(); + this.ipAddr = input.readUTF(); + this.port = input.readInt(); this.state = ReplicaState.values()[input.readInt()]; } + public String getClusterIp() { + return ipAddr; + } + + public void setClusterIp(String ip) { + ipAddr = ip; + } + + public int getPort() { + return port; + } + + public void setPort(int port) { + this.port = port; + } + public void serialize(OutputStream out) throws IOException { DataOutputStream dos = new DataOutputStream(out); writeFields(dos); } + + @Override + public boolean equals(Object o) { + if (!(o instanceof Replica)) { + return false; + } + Replica other = (Replica) o; + return nodeId.equals(other.getId()); + } + + @Override + public int hashCode() { + return nodeId.hashCode(); + } } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ReplicationStrategyFactory.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ReplicationStrategyFactory.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ReplicationStrategyFactory.java index 703ddcc..e6b6445 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ReplicationStrategyFactory.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/replication/ReplicationStrategyFactory.java @@ -21,15 +21,16 @@ package org.apache.asterix.common.replication; import java.util.HashMap; import java.util.Map; +import org.apache.asterix.common.config.ReplicationProperties; import org.apache.asterix.common.exceptions.ErrorCode; import org.apache.asterix.common.exceptions.RuntimeDataException; -import org.apache.asterix.event.schema.cluster.Cluster; +import org.apache.hyracks.api.config.IConfigManager; import org.apache.hyracks.api.exceptions.HyracksDataException; public class ReplicationStrategyFactory { - private static final Map<String, Class<? extends IReplicationStrategy>> - BUILT_IN_REPLICATION_STRATEGY = new HashMap<>(); + private static final Map<String, Class<? extends IReplicationStrategy>> BUILT_IN_REPLICATION_STRATEGY = + new HashMap<>(); static { BUILT_IN_REPLICATION_STRATEGY.put("no_replication", NoReplicationStrategy.class); @@ -41,24 +42,16 @@ public class ReplicationStrategyFactory { throw new AssertionError(); } - public static IReplicationStrategy create(Cluster cluster) throws HyracksDataException { - boolean highAvailabilityEnabled = cluster.getHighAvailability() != null - && cluster.getHighAvailability().getEnabled() != null - && Boolean.valueOf(cluster.getHighAvailability().getEnabled()); - - if (!highAvailabilityEnabled || cluster.getHighAvailability().getDataReplication() == null - || cluster.getHighAvailability().getDataReplication().getStrategy() == null) { - return new NoReplicationStrategy(); - } - String strategyName = cluster.getHighAvailability().getDataReplication().getStrategy().toLowerCase(); + public static IReplicationStrategy create(String name, ReplicationProperties repProp, IConfigManager ncConfig) + throws HyracksDataException { + String strategyName = name.toLowerCase(); if (!BUILT_IN_REPLICATION_STRATEGY.containsKey(strategyName)) { - throw new RuntimeDataException(ErrorCode.UNSUPPORTED_REPLICATION_STRATEGY, - String.format("%s. Available strategies: %s", strategyName, - BUILT_IN_REPLICATION_STRATEGY.keySet().toString())); + throw new RuntimeDataException(ErrorCode.UNSUPPORTED_REPLICATION_STRATEGY, String.format( + "%s. Available strategies: %s", strategyName, BUILT_IN_REPLICATION_STRATEGY.keySet().toString())); } Class<? extends IReplicationStrategy> clazz = BUILT_IN_REPLICATION_STRATEGY.get(strategyName); try { - return clazz.newInstance().from(cluster); + return clazz.newInstance().from(repProp, ncConfig); } catch (InstantiationException | IllegalAccessException e) { throw new RuntimeDataException(ErrorCode.INSTANTIATION_ERROR, e, clazz.getName()); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/ConfigUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/ConfigUtil.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/ConfigUtil.java deleted file mode 100644 index 5db1693..0000000 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/utils/ConfigUtil.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.asterix.common.utils; - -import java.util.ArrayList; - -import org.apache.asterix.common.config.AsterixExtension; -import org.apache.asterix.common.configuration.Extension; -import org.apache.asterix.common.configuration.Property; -import org.apache.hyracks.algebricks.common.utils.Pair; - -public class ConfigUtil { - - private ConfigUtil() { - } - - public static AsterixExtension toAsterixExtension(Extension ext) { - String className = ext.getExtensionClassName(); - ArrayList<Pair<String, String>> args = new ArrayList<>(); - for (Property property : ext.getProperty()) { - args.add(new Pair<>(property.getName(), property.getValue())); - } - return new AsterixExtension(className, args); - } -} http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/resources/schema/asterix-conf.xsd ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/resources/schema/asterix-conf.xsd b/asterixdb/asterix-common/src/main/resources/schema/asterix-conf.xsd deleted file mode 100644 index d6a35cd..0000000 --- a/asterixdb/asterix-common/src/main/resources/schema/asterix-conf.xsd +++ /dev/null @@ -1,157 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - -<!-- - ! 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. - !--> - -<xs:schema - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:mg="asterixconf" - targetNamespace="asterixconf" - elementFormDefault="qualified"> - - <!-- definition of simple types --> - <xs:element - name="instanceName" - type="xs:string" /> - <xs:element - name="version" - type="xs:string" /> - <xs:element - name="metadataNode" - type="xs:string" /> - <xs:element - name="coredumpPath" - type="xs:string" /> - <xs:element - name="storeDirs" - type="xs:string" /> - <xs:element - name="ncId" - type="xs:string" /> - <xs:element - name="name" - type="xs:string" /> - <xs:element - name="value" - type="xs:string" /> - <xs:element - name="description" - type="xs:string" /> - <xs:element - name="txnLogDirPath" - type="xs:string" /> - <xs:element - name="extensionClassName" - type="xs:string" /> - - <!-- definition of complex elements --> - <xs:element name="store"> - <xs:complexType> - <xs:sequence> - <xs:element ref="mg:ncId" /> - <xs:element ref="mg:storeDirs" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="coredump"> - <xs:complexType> - <xs:sequence> - <xs:element ref="mg:ncId" /> - <xs:element ref="mg:coredumpPath" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="transactionLogDir"> - <xs:complexType> - <xs:sequence> - <xs:element ref="mg:ncId" /> - <xs:element ref="mg:txnLogDirPath" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="property"> - <xs:complexType> - <xs:sequence> - <xs:element ref="mg:name" /> - <xs:element ref="mg:value" /> - <xs:element ref="mg:description" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="extension"> - <xs:complexType> - <xs:sequence> - <xs:element ref="mg:extensionClassName" - maxOccurs="1" - minOccurs="1"/> - <xs:element ref="mg:property" - minOccurs="0" - maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="extensions"> - <xs:complexType> - <xs:sequence> - <xs:element ref="mg:extension" - minOccurs="0" - maxOccurs="unbounded"> - </xs:element> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="asterixConfiguration"> - <xs:complexType> - <xs:sequence> - <xs:element - ref="mg:instanceName" - minOccurs="0" /> - <xs:element - ref="mg:version" - minOccurs="0" /> - <xs:element - ref="mg:metadataNode" - minOccurs="0" /> - <xs:element - ref="mg:store" - maxOccurs="unbounded" /> - <xs:element - ref="mg:coredump" - maxOccurs="unbounded" /> - <xs:element - ref="mg:transactionLogDir" - maxOccurs="unbounded" /> - <xs:element ref="mg:extensions" - minOccurs="0" - maxOccurs="1" /> - <xs:element - ref="mg:property" - minOccurs="0" - maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - -</xs:schema> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/resources/schema/cluster.xsd ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/resources/schema/cluster.xsd b/asterixdb/asterix-common/src/main/resources/schema/cluster.xsd deleted file mode 100644 index be189e3..0000000 --- a/asterixdb/asterix-common/src/main/resources/schema/cluster.xsd +++ /dev/null @@ -1,197 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - -<!-- - ! 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. - !--> - -<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:cl="cluster" targetNamespace="cluster" elementFormDefault="qualified"> - - <!-- definition of simple types --> - <xs:element name="instance_name" type="xs:string" /> - <xs:element name="cluster_name" type="xs:string" /> - <xs:element name="log_dir" type="xs:string" /> - <xs:element name="txn_log_dir" type="xs:string" /> - <xs:element name="id" type="xs:string" /> - <xs:element name="client_ip" type="xs:string" /> - <xs:element name="cluster_ip" type="xs:string" /> - <xs:element name="key" type="xs:string" /> - <xs:element name="value" type="xs:string" /> - <xs:element name="dir" type="xs:string" /> - <xs:element name="NFS" type="xs:boolean" /> - <xs:element name="store" type="xs:string" /> - <xs:element name="iodevices" type="xs:string" /> - <xs:element name="java_home" type="xs:string" /> - <xs:element name="username" type="xs:string" /> - <xs:element name="web_port" type="xs:string" /> - <xs:element name="client_port" type="xs:integer" /> - <xs:element name="cluster_port" type="xs:integer" /> - <xs:element name="http_port" type="xs:integer" /> - <xs:element name="debug_port" type="xs:integer" /> - <xs:element name="metadata_node" type="xs:string" /> - <xs:element name="enabled" type="xs:string" /> - <xs:element name="replication_port" type="xs:integer" /> - <xs:element name="replication_factor" type="xs:integer" /> - <xs:element name="auto_failover" type="xs:boolean" /> - <xs:element name="replication_time_out" type="xs:integer" /> - <xs:element name="heartbeat_period" type="xs:integer" /> - <xs:element name="max_heartbeat_lapse_periods" type="xs:integer" /> - <xs:element name="profile_dump_period" type="xs:integer" /> - <xs:element name="job_history_size" type="xs:integer" /> - <xs:element name="result_time_to_live" type="xs:long" /> - <xs:element name="result_sweep_threshold" type="xs:long" /> - <xs:element name="cc_root" type="xs:string" /> - <xs:element name="strategy" type="xs:string" /> - <xs:element name="node_id" type="xs:string" /> - <xs:element name="nc_api_port" type="xs:integer" /> - - <!-- definition of complex elements --> - <xs:element name="working_dir"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:dir" /> - <xs:element ref="cl:NFS" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="master_node"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:id" /> - <xs:element ref="cl:client_ip" /> - <xs:element ref="cl:cluster_ip" /> - <xs:element ref="cl:java_home" minOccurs="0" /> - <xs:element ref="cl:log_dir" minOccurs="0" /> - <xs:element ref="cl:client_port" /> - <xs:element ref="cl:cluster_port" /> - <xs:element ref="cl:http_port" /> - <xs:element ref="cl:debug_port" minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="data_replication"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:strategy" /> - <xs:element ref="cl:replication_port" /> - <xs:element ref="cl:replication_factor" /> - <xs:element ref="cl:replication_time_out" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="fault_tolerance"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:strategy" /> - <xs:element ref="cl:replica" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="high_availability"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:enabled" minOccurs="0"/> - <xs:element ref="cl:data_replication" minOccurs="0"/> - <xs:element ref="cl:fault_tolerance" minOccurs="0"/> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="property"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:key" /> - <xs:element ref="cl:value" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="env"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:property" minOccurs="0" maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="node"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:id" /> - <xs:element ref="cl:cluster_ip" /> - <xs:element ref="cl:java_home" minOccurs="0" /> - <xs:element ref="cl:log_dir" minOccurs="0" /> - <xs:element ref="cl:txn_log_dir" minOccurs="0" /> - <xs:element ref="cl:iodevices" minOccurs="0" /> - <xs:element ref="cl:debug_port" minOccurs="0" /> - <xs:element ref="cl:replication_port" minOccurs="0" /> - <xs:element ref="cl:nc_api_port" minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="substitute_nodes"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:node" maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="replica"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:node_id" maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="cluster"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:instance_name" /> - <xs:element ref="cl:cluster_name" /> - <xs:element ref="cl:username" /> - <xs:element ref="cl:env" minOccurs="0" /> - <xs:element ref="cl:java_home" minOccurs="0" /> - <xs:element ref="cl:log_dir" minOccurs="0" /> - <xs:element ref="cl:txn_log_dir" minOccurs="0" /> - <xs:element ref="cl:store" minOccurs="0" /> - <xs:element ref="cl:iodevices" minOccurs="0" /> - <xs:element ref="cl:working_dir" /> - <xs:element ref="cl:metadata_node" /> - <xs:element ref="cl:high_availability" minOccurs="0" /> - <xs:element ref="cl:master_node" /> - <xs:element ref="cl:node" maxOccurs="unbounded" /> - <xs:element ref="cl:substitute_nodes" /> - <xs:element ref="cl:heartbeat_period" minOccurs="0" /> - <xs:element ref="cl:max_heartbeat_lapse_periods" minOccurs="0" /> - <xs:element ref="cl:profile_dump_period" minOccurs="0" /> - <xs:element ref="cl:job_history_size" minOccurs="0" /> - <xs:element ref="cl:result_time_to_live" minOccurs="0" /> - <xs:element ref="cl:result_sweep_threshold" minOccurs="0" /> - <xs:element ref="cl:cc_root" minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - -</xs:schema> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/resources/schema/jaxb-bindings.xjb ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/resources/schema/jaxb-bindings.xjb b/asterixdb/asterix-common/src/main/resources/schema/jaxb-bindings.xjb deleted file mode 100644 index 0b191a6..0000000 --- a/asterixdb/asterix-common/src/main/resources/schema/jaxb-bindings.xjb +++ /dev/null @@ -1,28 +0,0 @@ -<!-- - ! 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. - !--> - -<jxb:bindings version="1.0" -xmlns:jxb="http://java.sun.com/xml/ns/jaxb" -xmlns:xs="http://www.w3.org/2001/XMLSchema"> - -<jxb:globalBindings> - <jxb:serializable uid="1"/> -</jxb:globalBindings> - -</jxb:bindings> http://git-wip-us.apache.org/repos/asf/asterixdb/blob/5dcf139e/asterixdb/asterix-common/src/main/resources/schema/yarn_cluster.xsd ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/resources/schema/yarn_cluster.xsd b/asterixdb/asterix-common/src/main/resources/schema/yarn_cluster.xsd deleted file mode 100644 index 4292509..0000000 --- a/asterixdb/asterix-common/src/main/resources/schema/yarn_cluster.xsd +++ /dev/null @@ -1,211 +0,0 @@ -<?xml version="1.0" encoding="ISO-8859-1" ?> - -<!-- - ! 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. - !--> - -<xs:schema - xmlns:xs="http://www.w3.org/2001/XMLSchema" - xmlns:cl="yarn_cluster" - targetNamespace="yarn_cluster" - elementFormDefault="qualified"> - - <!-- definition of simple types --> - <xs:element - name="instance_name" - type="xs:string" /> - <xs:element - name="cluster_name" - type="xs:string" /> - <xs:element - name="log_dir" - type="xs:string" /> - <xs:element - name="txn_log_dir" - type="xs:string" /> - <xs:element - name="id" - type="xs:string" /> - <xs:element - name="client_ip" - type="xs:string" /> - <xs:element - name="cluster_ip" - type="xs:string" /> - <xs:element - name="key" - type="xs:string" /> - <xs:element - name="value" - type="xs:string" /> - <xs:element - name="store" - type="xs:string" /> - <xs:element - name="iodevices" - type="xs:string" /> - <xs:element - name="web_port" - type="xs:string" /> - <xs:element - name="client_port" - type="xs:integer" /> - <xs:element - name="cluster_port" - type="xs:integer" /> - <xs:element - name="http_port" - type="xs:integer" /> - <xs:element - name="debug_port" - type="xs:integer" /> - <xs:element - name="metadata_node" - type="xs:string" /> - <xs:element - name="cc_container_mem" - type="xs:string" /> - <xs:element - name="nc_container_mem" - type="xs:string" /> - <xs:element name="heartbeat_period" type="xs:integer" /> - <xs:element name="max_heartbeat_lapse_periods" type="xs:integer" /> - <xs:element name="profile_dump_period" type="xs:integer" /> - <xs:element name="default_max_job_attempts" type="xs:integer" /> - <xs:element name="job_history_size" type="xs:integer" /> - <xs:element name="result_time_to_live" type="xs:long" /> - <xs:element name="result_sweep_threshold" type="xs:long" /> - <xs:element name="cc_root" type="xs:string" /> - - <!-- definition of complex elements --> - - <xs:element name="master_node"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:id" /> - <xs:element ref="cl:client_ip" /> - <xs:element ref="cl:cluster_ip" /> - <xs:element - ref="cl:log_dir" - minOccurs="0" /> - <xs:element ref="cl:client_port" /> - <xs:element ref="cl:cluster_port" /> - <xs:element ref="cl:http_port" /> - <xs:element - ref="cl:debug_port" - minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="property"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:key" /> - <xs:element ref="cl:value" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="env"> - <xs:complexType> - <xs:sequence> - <xs:element - ref="cl:property" - minOccurs="0" - maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="node"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:id" /> - <xs:element ref="cl:cluster_ip" /> - <xs:element - ref="cl:log_dir" - minOccurs="0" /> - <xs:element - ref="cl:txn_log_dir" - minOccurs="0" /> - <xs:element - ref="cl:iodevices" - minOccurs="0" /> - <xs:element - ref="cl:debug_port" - minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="substitute_nodes"> - <xs:complexType> - <xs:sequence> - <xs:element - ref="cl:node" - maxOccurs="unbounded" /> - </xs:sequence> - </xs:complexType> - </xs:element> - - <xs:element name="cluster"> - <xs:complexType> - <xs:sequence> - <xs:element ref="cl:instance_name" /> - <xs:element ref="cl:cluster_name" /> - <xs:element - ref="cl:cc_container_mem" - minOccurs="0" /> - <xs:element - ref="cl:nc_container_mem" - minOccurs="0" /> - <xs:element - ref="cl:env" - minOccurs="0" /> - <xs:element - ref="cl:log_dir" - minOccurs="0" /> - <xs:element - ref="cl:txn_log_dir" - minOccurs="0" /> - <xs:element - ref="cl:store" - minOccurs="0" /> - <xs:element - ref="cl:iodevices" - minOccurs="0" /> - <xs:element ref="cl:metadata_node" /> - <xs:element ref="cl:master_node" /> - <xs:element - ref="cl:node" - maxOccurs="unbounded" /> - <xs:element ref="cl:substitute_nodes" /> - <xs:element ref="cl:heartbeat_period" minOccurs="0" /> - <xs:element ref="cl:max_heartbeat_lapse_periods" minOccurs="0" /> - <xs:element ref="cl:profile_dump_period" minOccurs="0" /> - <xs:element ref="cl:default_max_job_attempts" minOccurs="0" /> - <xs:element ref="cl:job_history_size" minOccurs="0" /> - <xs:element ref="cl:result_time_to_live" minOccurs="0" /> - <xs:element ref="cl:result_sweep_threshold" minOccurs="0" /> - <xs:element ref="cl:cc_root" minOccurs="0" /> - </xs:sequence> - </xs:complexType> - </xs:element> - -</xs:schema>
