ASTERIXDB-1340: fix node group nodes order
Change-Id: I6e93aedb6cdc57d98f83991ab910476b82bacb15
Reviewed-on: https://asterix-gerrit.ics.uci.edu/708
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>
diff --git a/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java b/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
index be9452b..a568464 100644
--- a/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
+++ b/asterix-app/src/main/java/org/apache/asterix/api/common/AsterixHyracksIntegrationUtil.java
@@ -20,7 +20,7 @@
import java.io.File;
import java.util.EnumSet;
-import java.util.Set;
+import java.util.List;
import org.apache.asterix.common.config.AsterixPropertiesAccessor;
import org.apache.asterix.common.config.GlobalConfig;
@@ -72,7 +72,7 @@
// Starts ncs.
int n = 0;
- Set<String> nodes = propertiesAccessor.getNodeNames();
+ List<String> nodes = propertiesAccessor.getNodeNames();
for (String ncName : nodes) {
NCConfig ncConfig1 = new NCConfig();
ncConfig1.ccHost = "localhost";
diff --git a/asterix-app/src/main/java/org/apache/asterix/aql/translator/QueryTranslator.java b/asterix-app/src/main/java/org/apache/asterix/aql/translator/QueryTranslator.java
index 00bc254..362be2e 100644
--- a/asterix-app/src/main/java/org/apache/asterix/aql/translator/QueryTranslator.java
+++ b/asterix-app/src/main/java/org/apache/asterix/aql/translator/QueryTranslator.java
@@ -26,16 +26,15 @@
import java.io.InputStreamReader;
import java.rmi.RemoteException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;
import java.util.Random;
-import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
@@ -771,11 +770,8 @@
} else {
nodegroupCardinality = Integer.parseInt(dd.getHints().get(DatasetNodegroupCardinalityHint.NAME));
}
- Set<String> nodeNames = AsterixAppContextInfo.getInstance().getMetadataProperties().getNodeNames();
- Set<String> nodeNamesClone = new HashSet<String>();
- for (String node : nodeNames) {
- nodeNamesClone.add(node);
- }
+ List<String> nodeNames = AsterixAppContextInfo.getInstance().getMetadataProperties().getNodeNames();
+ List<String> nodeNamesClone = new ArrayList<String>(nodeNames);
String metadataNodeName = AsterixAppContextInfo.getInstance().getMetadataProperties().getMetadataNodeName();
List<String> selectedNodes = new ArrayList<String>();
selectedNodes.add(metadataNodeName);
diff --git a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java
index 473a163..9a8fba4 100644
--- a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java
+++ b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixMetadataProperties.java
@@ -18,8 +18,8 @@
*/
package org.apache.asterix.common.config;
+import java.util.List;
import java.util.Map;
-import java.util.Set;
import java.util.SortedMap;
import org.apache.asterix.common.cluster.ClusterPartition;
@@ -46,7 +46,7 @@
return accessor.getStores();
}
- public Set<String> getNodeNames() {
+ public List<String> getNodeNames() {
return accessor.getNodeNames();
}
diff --git a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
index 13ce403..77a290d 100644
--- a/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
+++ b/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixPropertiesAccessor.java
@@ -22,12 +22,11 @@
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
+import java.util.ArrayList;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Properties;
-import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import java.util.logging.Level;
@@ -50,7 +49,7 @@
private final String instanceName;
private final String metadataNodeName;
- private final Set<String> nodeNames;
+ private final List<String> nodeNames;
private final Map<String, String[]> stores;
private final Map<String, String> coredumpConfig;
private final Map<String, Property> asterixConfigurationParams;
@@ -87,7 +86,7 @@
metadataNodeName = asterixConfiguration.getMetadataNode();
stores = new HashMap<String, String[]>();
List<Store> configuredStores = asterixConfiguration.getStore();
- nodeNames = new HashSet<String>();
+ nodeNames = new ArrayList<String>();
nodePartitionsMap = new HashMap<>();
clusterPartitions = new TreeMap<>();
int uniquePartitionId = 0;
@@ -137,7 +136,7 @@
return stores;
}
- public Set<String> getNodeNames() {
+ public List<String> getNodeNames() {
return nodeNames;
}
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
index ec0d21f..b83f2f3 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -115,7 +115,7 @@
private static IIOManager ioManager;
private static String metadataNodeName;
- private static Set<String> nodeNames;
+ private static List<String> nodeNames;
private static String outputDir;
private static IMetadataIndex[] primaryIndexes;