1) merge from asterix_lsm_stabilization 2) added properties to asterix configuration xml following appends to google doc
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
index 1721666..9facf0a 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/driver/EventDriver.java
@@ -41,7 +41,7 @@
public class EventDriver {
public static final String CLIENT_NODE_ID = "client_node";
- public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null, null, null, null, null);
+ public static final Node CLIENT_NODE = new Node(CLIENT_NODE_ID, "127.0.0.1", null, null, null, null);
private static String eventsDir;
private static Events events;
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
index 6d89c88..39e1a2f 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventExecutor.java
@@ -51,19 +51,21 @@
if (p.getKey().equals("JAVA_HOME")) {
String val = node.getJavaHome() == null ? p.getValue() : node.getJavaHome();
envBuffer.append(p.getKey() + "=" + val + " ");
- } else if (p.getKey().equals("JAVA_OPTS")) {
+ } else if (p.getKey().equals("NC_JAVA_OPTS") && !node.getId().equals(cluster.getMasterNode().getId())) {
StringBuilder builder = new StringBuilder();
builder.append("\"");
- String javaOpts = (node.getJavaOpts() == null ? cluster.getJavaOpts() : node.getJavaOpts());
+ String javaOpts = p.getValue();
if (javaOpts != null) {
builder.append(javaOpts);
}
- if (cluster.isDebugEnabled() != null && cluster.isDebugEnabled().booleanValue()) {
- BigInteger debugPort = node.getDebug() == null ? cluster.getDebug() : node.getDebug();
- if (debugPort != null) {
- builder.append("-Xdebug -Xrunjdwp:transport=dt_socket,address=" + debugPort.intValue()
- + "," + "server=y,suspend=n");
- }
+ builder.append("\"");
+ envBuffer.append(p.getKey() + "=" + builder + " ");
+ } else if (p.getKey().equals("CC_JAVA_OPTS") && node.getId().equals(cluster.getMasterNode().getId())) {
+ StringBuilder builder = new StringBuilder();
+ builder.append("\"");
+ String javaOpts = p.getValue();
+ if (javaOpts != null) {
+ builder.append(javaOpts);
}
builder.append("\"");
envBuffer.append(p.getKey() + "=" + builder + " ");
diff --git a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
index 0761c7f..81fabac 100644
--- a/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
+++ b/asterix-events/src/main/java/edu/uci/ics/asterix/event/management/EventUtil.java
@@ -36,251 +36,230 @@
public class EventUtil {
- public static final String EVENTS_DIR = "events";
- public static final String CLUSTER_CONF = "config/cluster.xml";
- public static final String PATTERN_CONF = "config/pattern.xml";
- public static final DateFormat dateFormat = new SimpleDateFormat(
- "yyyy/MM/dd HH:mm:ss");
+ public static final String EVENTS_DIR = "events";
+ public static final String CLUSTER_CONF = "config/cluster.xml";
+ public static final String PATTERN_CONF = "config/pattern.xml";
+ public static final DateFormat dateFormat = new SimpleDateFormat("yyyy/MM/dd HH:mm:ss");
- private static final String IP_LOCATION = "IP_LOCATION";
- private static final String CLUSTER_ENV = "ENV";
- private static final String SCRIPT = "SCRIPT";
- private static final String ARGS = "ARGS";
- private static final String EXECUTE_SCRIPT = "events/execute.sh";
- private static final String LOCALHOST = "localhost";
- private static final String LOCALHOST_IP = "127.0.0.1";
+ private static final String IP_LOCATION = "IP_LOCATION";
+ private static final String CLUSTER_ENV = "ENV";
+ private static final String SCRIPT = "SCRIPT";
+ private static final String ARGS = "ARGS";
+ private static final String EXECUTE_SCRIPT = "events/execute.sh";
+ private static final String LOCALHOST = "localhost";
+ private static final String LOCALHOST_IP = "127.0.0.1";
- public static Cluster getCluster(String clusterConfigurationPath)
- throws JAXBException {
- File file = new File(clusterConfigurationPath);
- JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- Cluster cluster = (Cluster) unmarshaller.unmarshal(file);
- if (cluster.getMasterNode().getClusterIp().equals(LOCALHOST)) {
- cluster.getMasterNode().setClusterIp(LOCALHOST_IP);
- }
- for (Node node : cluster.getNode()) {
- if (node.getClusterIp().equals(LOCALHOST)) {
- node.setClusterIp(LOCALHOST_IP);
- }
- }
- return cluster;
- }
+ public static Cluster getCluster(String clusterConfigurationPath) throws JAXBException {
+ File file = new File(clusterConfigurationPath);
+ JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ Cluster cluster = (Cluster) unmarshaller.unmarshal(file);
+ if (cluster.getMasterNode().getClusterIp().equals(LOCALHOST)) {
+ cluster.getMasterNode().setClusterIp(LOCALHOST_IP);
+ }
+ for (Node node : cluster.getNode()) {
+ if (node.getClusterIp().equals(LOCALHOST)) {
+ node.setClusterIp(LOCALHOST_IP);
+ }
+ }
+ return cluster;
+ }
- public static long parseTimeInterval(ValueType v, String unit)
- throws IllegalArgumentException {
- int val = 0;
- switch (v.getType()) {
- case ABS:
- val = Integer.parseInt(v.getAbsoluteValue());
- break;
- case RANDOM_MIN_MAX:
- val = Randomizer.getInstance().getRandomInt(v.getMin(), v.getMax());
- break;
- case RANDOM_RANGE:
- String[] values = v.getRangeSet();
- val = Integer.parseInt(values[Randomizer.getInstance()
- .getRandomInt(0, values.length - 1)]);
- break;
- }
- return computeInterval(val, unit);
- }
+ public static long parseTimeInterval(ValueType v, String unit) throws IllegalArgumentException {
+ int val = 0;
+ switch (v.getType()) {
+ case ABS:
+ val = Integer.parseInt(v.getAbsoluteValue());
+ break;
+ case RANDOM_MIN_MAX:
+ val = Randomizer.getInstance().getRandomInt(v.getMin(), v.getMax());
+ break;
+ case RANDOM_RANGE:
+ String[] values = v.getRangeSet();
+ val = Integer.parseInt(values[Randomizer.getInstance().getRandomInt(0, values.length - 1)]);
+ break;
+ }
+ return computeInterval(val, unit);
+ }
- public static long parseTimeInterval(String v, String unit)
- throws IllegalArgumentException {
- int value = Integer.parseInt(v);
- return computeInterval(value, unit);
- }
+ public static long parseTimeInterval(String v, String unit) throws IllegalArgumentException {
+ int value = Integer.parseInt(v);
+ return computeInterval(value, unit);
+ }
- private static long computeInterval(int val, String unit) {
- int vmult = 1;
- if ("hr".equalsIgnoreCase(unit)) {
- vmult = 3600 * 1000;
- } else if ("min".equalsIgnoreCase(unit)) {
- vmult = 60 * 1000;
- } else if ("sec".equalsIgnoreCase(unit)) {
- vmult = 1000;
- } else
- throw new IllegalArgumentException(
- " invalid unit value specified for frequency (hr,min,sec)");
- return val * vmult;
+ private static long computeInterval(int val, String unit) {
+ int vmult = 1;
+ if ("hr".equalsIgnoreCase(unit)) {
+ vmult = 3600 * 1000;
+ } else if ("min".equalsIgnoreCase(unit)) {
+ vmult = 60 * 1000;
+ } else if ("sec".equalsIgnoreCase(unit)) {
+ vmult = 1000;
+ } else
+ throw new IllegalArgumentException(" invalid unit value specified for frequency (hr,min,sec)");
+ return val * vmult;
- }
+ }
- public static Event getEvent(Pattern pattern, Events events) {
- for (Event event : events.getEvent()) {
- if (event.getType().equals(pattern.getEvent().getType())) {
- return event;
- }
- }
- throw new IllegalArgumentException(" Unknown event type"
- + pattern.getEvent().getType());
- }
+ public static Event getEvent(Pattern pattern, Events events) {
+ for (Event event : events.getEvent()) {
+ if (event.getType().equals(pattern.getEvent().getType())) {
+ return event;
+ }
+ }
+ throw new IllegalArgumentException(" Unknown event type" + pattern.getEvent().getType());
+ }
- public static Node getEventLocation(Pattern pattern,
- List<Node> candidateLocations, Cluster cluster) {
- ValueType value = new ValueType(pattern.getEvent().getNodeid()
- .getValue());
- Node location = null;
- Type vtype = value.getType();
+ public static Node getEventLocation(Pattern pattern, List<Node> candidateLocations, Cluster cluster) {
+ ValueType value = new ValueType(pattern.getEvent().getNodeid().getValue());
+ Node location = null;
+ Type vtype = value.getType();
- switch (vtype) {
- case ABS:
- location = getNodeFromId(value.getAbsoluteValue(), cluster);
- break;
- case RANDOM_RANGE:
- int nodeIndex = Randomizer.getInstance().getRandomInt(0,
- candidateLocations.size() - 1);
- location = candidateLocations.get(nodeIndex);
- break;
- case RANDOM_MIN_MAX:
- throw new IllegalStateException(
- " Canont configure a min max value range for location");
- }
- return location;
+ switch (vtype) {
+ case ABS:
+ location = getNodeFromId(value.getAbsoluteValue(), cluster);
+ break;
+ case RANDOM_RANGE:
+ int nodeIndex = Randomizer.getInstance().getRandomInt(0, candidateLocations.size() - 1);
+ location = candidateLocations.get(nodeIndex);
+ break;
+ case RANDOM_MIN_MAX:
+ throw new IllegalStateException(" Canont configure a min max value range for location");
+ }
+ return location;
- }
+ }
- public static List<Node> getCandidateLocations(Pattern pattern,
- Cluster cluster) {
- ValueType value = new ValueType(pattern.getEvent().getNodeid()
- .getValue());
- List<Node> candidateList = new ArrayList<Node>();
- switch (value.getType()) {
- case ABS:
- candidateList.add(getNodeFromId(value.getAbsoluteValue(), cluster));
- break;
- case RANDOM_RANGE:
- boolean anyOption = false;
- String[] values = value.getRangeSet();
- for (String v : values) {
- if (v.equalsIgnoreCase("ANY")) {
- anyOption = true;
- }
- }
- if (anyOption) {
- for (Node node : cluster.getNode()) {
- candidateList.add(node);
- }
- } else {
- boolean found = false;
- for (String v : values) {
- for (Node node : cluster.getNode()) {
- if (node.getId().equals(v)) {
- candidateList.add(node);
- found = true;
- break;
- }
- }
- if (!found) {
- throw new IllegalStateException("Unknonw nodeId : " + v);
- }
- found = false;
- }
+ public static List<Node> getCandidateLocations(Pattern pattern, Cluster cluster) {
+ ValueType value = new ValueType(pattern.getEvent().getNodeid().getValue());
+ List<Node> candidateList = new ArrayList<Node>();
+ switch (value.getType()) {
+ case ABS:
+ candidateList.add(getNodeFromId(value.getAbsoluteValue(), cluster));
+ break;
+ case RANDOM_RANGE:
+ boolean anyOption = false;
+ String[] values = value.getRangeSet();
+ for (String v : values) {
+ if (v.equalsIgnoreCase("ANY")) {
+ anyOption = true;
+ }
+ }
+ if (anyOption) {
+ for (Node node : cluster.getNode()) {
+ candidateList.add(node);
+ }
+ } else {
+ boolean found = false;
+ for (String v : values) {
+ for (Node node : cluster.getNode()) {
+ if (node.getId().equals(v)) {
+ candidateList.add(node);
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ throw new IllegalStateException("Unknonw nodeId : " + v);
+ }
+ found = false;
+ }
- }
- String[] excluded = value.getRangeExcluded();
- if (excluded != null && excluded.length > 0) {
- List<Node> markedForRemoval = new ArrayList<Node>();
- for (String exclusion : excluded) {
- for (Node node : candidateList) {
- if (node.getId().equals(exclusion)) {
- markedForRemoval.add(node);
- }
- }
- }
- candidateList.removeAll(markedForRemoval);
- }
- break;
- case RANDOM_MIN_MAX:
- throw new IllegalStateException(
- " Invalid value configured for location");
- }
- return candidateList;
- }
+ }
+ String[] excluded = value.getRangeExcluded();
+ if (excluded != null && excluded.length > 0) {
+ List<Node> markedForRemoval = new ArrayList<Node>();
+ for (String exclusion : excluded) {
+ for (Node node : candidateList) {
+ if (node.getId().equals(exclusion)) {
+ markedForRemoval.add(node);
+ }
+ }
+ }
+ candidateList.removeAll(markedForRemoval);
+ }
+ break;
+ case RANDOM_MIN_MAX:
+ throw new IllegalStateException(" Invalid value configured for location");
+ }
+ return candidateList;
+ }
- private static Node getNodeFromId(String nodeid, Cluster cluster) {
- if (nodeid.equals(EventDriver.CLIENT_NODE.getId())) {
- return EventDriver.CLIENT_NODE;
- }
+ private static Node getNodeFromId(String nodeid, Cluster cluster) {
+ if (nodeid.equals(EventDriver.CLIENT_NODE.getId())) {
+ return EventDriver.CLIENT_NODE;
+ }
- if (nodeid.equals(cluster.getMasterNode().getId())) {
- String javaOpts = cluster.getMasterNode().getJavaOpts() == null ? cluster
- .getJavaOpts() : cluster.getMasterNode().getJavaOpts();
- String logDir = cluster.getMasterNode().getLogdir() == null ? cluster
- .getLogdir() : cluster.getMasterNode().getLogdir();
- String javaHome = cluster.getMasterNode().getJavaHome() == null ? cluster
- .getJavaHome() : cluster.getMasterNode().getJavaHome();
- BigInteger debug = cluster.getMasterNode().getDebug();
- return new Node(cluster.getMasterNode().getId(), cluster
- .getMasterNode().getClusterIp(), javaHome, javaOpts,
- logDir, null, null, debug);
- }
+ if (nodeid.equals(cluster.getMasterNode().getId())) {
+ String logDir = cluster.getMasterNode().getLogdir() == null ? cluster.getLogdir() : cluster.getMasterNode()
+ .getLogdir();
+ String javaHome = cluster.getMasterNode().getJavaHome() == null ? cluster.getJavaHome() : cluster
+ .getMasterNode().getJavaHome();
+ return new Node(cluster.getMasterNode().getId(), cluster.getMasterNode().getClusterIp(), javaHome, logDir,
+ null, null);
+ }
- List<Node> nodeList = cluster.getNode();
- for (Node node : nodeList) {
- if (node.getId().equals(nodeid)) {
- return node;
- }
- }
- StringBuffer buffer = new StringBuffer();
- buffer.append(EventDriver.CLIENT_NODE.getId() + ",");
- buffer.append(cluster.getMasterNode().getId() + ",");
- for (Node v : cluster.getNode()) {
- buffer.append(v.getId() + ",");
- }
- buffer.deleteCharAt(buffer.length() - 1);
- throw new IllegalArgumentException("Unknown node id :" + nodeid
- + " valid ids:" + buffer);
- }
+ List<Node> nodeList = cluster.getNode();
+ for (Node node : nodeList) {
+ if (node.getId().equals(nodeid)) {
+ return node;
+ }
+ }
+ StringBuffer buffer = new StringBuffer();
+ buffer.append(EventDriver.CLIENT_NODE.getId() + ",");
+ buffer.append(cluster.getMasterNode().getId() + ",");
+ for (Node v : cluster.getNode()) {
+ buffer.append(v.getId() + ",");
+ }
+ buffer.deleteCharAt(buffer.length() - 1);
+ throw new IllegalArgumentException("Unknown node id :" + nodeid + " valid ids:" + buffer);
+ }
- public static void executeEventScript(Node node, String script,
- List<String> args, Cluster cluster) throws IOException,
- InterruptedException {
- List<String> pargs = new ArrayList<String>();
- pargs.add("/bin/bash");
- pargs.add(EventDriver.getEventsDir() + "/" + EXECUTE_SCRIPT);
- StringBuffer argBuffer = new StringBuffer();
- String env = EventDriver.getStringifiedEnv(cluster) + " " + IP_LOCATION
- + "=" + node.getClusterIp();
- if (args != null) {
- for (String arg : args) {
- argBuffer.append(arg + " ");
- }
- }
- ProcessBuilder pb = new ProcessBuilder(pargs);
- pb.environment().putAll(EventDriver.getEnvironment());
- pb.environment().put(IP_LOCATION, node.getClusterIp());
- pb.environment().put(CLUSTER_ENV, env);
- pb.environment().put(SCRIPT, script);
- pb.environment().put(ARGS, argBuffer.toString());
- pb.start();
- }
+ public static void executeEventScript(Node node, String script, List<String> args, Cluster cluster)
+ throws IOException, InterruptedException {
+ List<String> pargs = new ArrayList<String>();
+ pargs.add("/bin/bash");
+ pargs.add(EventDriver.getEventsDir() + "/" + EXECUTE_SCRIPT);
+ StringBuffer argBuffer = new StringBuffer();
+ String env = EventDriver.getStringifiedEnv(cluster) + " " + IP_LOCATION + "=" + node.getClusterIp();
+ if (args != null) {
+ for (String arg : args) {
+ argBuffer.append(arg + " ");
+ }
+ }
+ ProcessBuilder pb = new ProcessBuilder(pargs);
+ pb.environment().putAll(EventDriver.getEnvironment());
+ pb.environment().put(IP_LOCATION, node.getClusterIp());
+ pb.environment().put(CLUSTER_ENV, env);
+ pb.environment().put(SCRIPT, script);
+ pb.environment().put(ARGS, argBuffer.toString());
+ pb.start();
+ }
- public static void executeLocalScript(Node node, String script,
- List<String> args) throws IOException, InterruptedException {
- List<String> pargs = new ArrayList<String>();
- pargs.add("/bin/bash");
- pargs.add(script);
- if (args != null) {
- pargs.addAll(args);
- }
- ProcessBuilder pb = new ProcessBuilder(pargs);
- pb.environment().putAll(EventDriver.getEnvironment());
- pb.environment().put(IP_LOCATION, node.getClusterIp());
- pb.start();
- }
+ public static void executeLocalScript(Node node, String script, List<String> args) throws IOException,
+ InterruptedException {
+ List<String> pargs = new ArrayList<String>();
+ pargs.add("/bin/bash");
+ pargs.add(script);
+ if (args != null) {
+ pargs.addAll(args);
+ }
+ ProcessBuilder pb = new ProcessBuilder(pargs);
+ pb.environment().putAll(EventDriver.getEnvironment());
+ pb.environment().put(IP_LOCATION, node.getClusterIp());
+ pb.start();
+ }
- public static List<String> getEventArgs(Pattern pattern) {
- List<String> pargs = new ArrayList<String>();
- if (pattern.getEvent().getPargs() == null) {
- return pargs;
- }
- String[] args = pattern.getEvent().getPargs().split(" ");
- for (String arg : args) {
- pargs.add(arg.trim());
- }
- return pargs;
- }
+ public static List<String> getEventArgs(Pattern pattern) {
+ List<String> pargs = new ArrayList<String>();
+ if (pattern.getEvent().getPargs() == null) {
+ return pargs;
+ }
+ String[] args = pattern.getEvent().getPargs().split(" ");
+ for (String arg : args) {
+ pargs.add(arg.trim());
+ }
+ return pargs;
+ }
}
diff --git a/asterix-events/src/main/resources/events/cc_start/cc_start.sh b/asterix-events/src/main/resources/events/cc_start/cc_start.sh
index 003d9cf..dfc8ad9 100755
--- a/asterix-events/src/main/resources/events/cc_start/cc_start.sh
+++ b/asterix-events/src/main/resources/events/cc_start/cc_start.sh
@@ -3,4 +3,5 @@
mkdir -p $LOG_DIR
fi
cd $WORKING_DIR
+export JAVA_OPTS=$CC_JAVA_OPTS
$ASTERIX_HOME/bin/asterixcc -client-net-ip-address $CLIENT_NET_IP -client-net-port 1098 -cluster-net-ip-address $CLUSTER_NET_IP -cluster-net-port 1099 -http-port 8888 &> $LOG_DIR/cc.log
diff --git a/asterix-events/src/main/resources/events/node_join/nc_join.sh b/asterix-events/src/main/resources/events/node_join/nc_join.sh
index d8bbbd2..2e2cfac 100755
--- a/asterix-events/src/main/resources/events/node_join/nc_join.sh
+++ b/asterix-events/src/main/resources/events/node_join/nc_join.sh
@@ -6,4 +6,5 @@
mkdir -p $LOG_DIR
fi
cd $WORKING_DIR
+export JAVA_OPTS=$NC_JAVA_OPTS
$ASTERIX_HOME/bin/asterixnc -node-id $NC_ID -cc-host $CC_HOST -cc-port 1099 -cluster-net-ip-address $IP_LOCATION -data-ip-address $IP_LOCATION -iodevices $IO_DEVICES -result-ip-address $IP_LOCATION &> $LOG_DIR/${NC_ID}.log
diff --git a/asterix-events/src/main/resources/schema/cluster.xsd b/asterix-events/src/main/resources/schema/cluster.xsd
index 0e1adce..4292418 100644
--- a/asterix-events/src/main/resources/schema/cluster.xsd
+++ b/asterix-events/src/main/resources/schema/cluster.xsd
@@ -1,98 +1,89 @@
<?xml version="1.0" encoding="ISO-8859-1" ?>
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:cl="cluster" targetNamespace="cluster" elementFormDefault="qualified">
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:cl="cluster" targetNamespace="cluster" elementFormDefault="qualified">
-<!-- definition of simple types -->
-<xs:element name="name" type="xs:string"/>
-<xs:element name="java_opts" type="xs:string"/>
-<xs:element name="logdir" 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="debug" type="xs:integer"/>
-<xs:element name="debugEnabled" type="xs:boolean"/>
+ <!-- definition of simple types -->
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="logdir" 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" />
-<!-- definition of complex elements -->
-<xs:element name="workingDir">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl:dir"/>
- <xs:element ref="cl:NFS"/>
- </xs:sequence>
- </xs:complexType>
-</xs:element>
+ <!-- definition of complex elements -->
+ <xs:element name="workingDir">
+ <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:java_opts" minOccurs="0"/>
- <xs:element ref="cl:logdir" minOccurs="0"/>
- <xs:element ref="cl:debug" minOccurs="0"/>
- </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:logdir" 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="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="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:java_opts" minOccurs="0"/>
- <xs:element ref="cl:logdir" minOccurs="0"/>
- <xs:element ref="cl:store" minOccurs="0"/>
- <xs:element ref="cl:iodevices" minOccurs="0"/>
- <xs:element ref="cl:debug" minOccurs="0"/>
- </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:logdir" minOccurs="0" />
+ <xs:element ref="cl:store" minOccurs="0" />
+ <xs:element ref="cl:iodevices" minOccurs="0" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
-<xs:element name="cluster">
- <xs:complexType>
- <xs:sequence>
- <xs:element ref="cl: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:java_opts" minOccurs="0"/>
- <xs:element ref="cl:logdir" minOccurs="0"/>
- <xs:element ref="cl:store" minOccurs="0"/>
- <xs:element ref="cl:iodevices" minOccurs="0"/>
- <xs:element ref="cl:workingDir"/>
- <xs:element ref="cl:debugEnabled" minOccurs="0"/>
- <xs:element ref="cl:debug" minOccurs="0"/>
- <xs:element ref="cl:master-node"/>
- <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: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:logdir" minOccurs="0" />
+ <xs:element ref="cl:store" minOccurs="0" />
+ <xs:element ref="cl:iodevices" minOccurs="0" />
+ <xs:element ref="cl:workingDir" />
+ <xs:element ref="cl:master-node" />
+ <xs:element ref="cl:node" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
</xs:schema>
diff --git a/asterix-installer/pom.xml b/asterix-installer/pom.xml
index 87a73af..e0986d9 100644
--- a/asterix-installer/pom.xml
+++ b/asterix-installer/pom.xml
@@ -63,6 +63,10 @@
<goal>generate</goal>
</goals>
<configuration>
+ <args>
+ <arg>-Xsetters</arg>
+ <arg>-Xvalue-constructor</arg>
+ </args>
<schemaDirectory>src/main/resources/schema</schemaDirectory>
<schemaIncludes>
<include>cluster.xsd</include>
@@ -75,6 +79,24 @@
<generateDirectory>${project.build.directory}/generated-sources/cluster</generateDirectory>
</configuration>
</execution>
+ <execution>
+ <id>asterixconf</id>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ <configuration>
+ <schemaDirectory>src/main/resources/schema</schemaDirectory>
+ <schemaIncludes>
+ <include>asterix-conf.xsd</include>
+ </schemaIncludes>
+ <generatePackage>edu.uci.ics.asterix.installer.schema.asterixconf</generatePackage>
+ <bindingDirectory>src/main/resources/schema</bindingDirectory>
+ <bindingIncludes>
+ <bindingInclude>jaxb-bindings.xjb</bindingInclude>
+ </bindingIncludes>
+ <generateDirectory>${project.build.directory}/generated-sources/asterixconf</generateDirectory>
+ </configuration>
+ </execution>
</executions>
</plugin>
<plugin>
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
index 5ef7449..3a1d641 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/AlterCommand.java
@@ -15,7 +15,6 @@
package edu.uci.ics.asterix.installer.command;
import java.util.Date;
-import java.util.Properties;
import org.kohsuke.args4j.Option;
@@ -23,6 +22,7 @@
import edu.uci.ics.asterix.installer.driver.InstallerUtil;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
+import edu.uci.ics.asterix.installer.schema.asterixconf.AsterixConfiguration;
import edu.uci.ics.asterix.installer.service.ILookupService;
import edu.uci.ics.asterix.installer.service.ServiceProvider;
@@ -35,9 +35,10 @@
InstallerUtil.validateAsterixInstanceExists(instanceName, State.INACTIVE);
ILookupService lookupService = ServiceProvider.INSTANCE.getLookupService();
AsterixInstance instance = lookupService.getAsterixInstance(instanceName);
-
- Properties asterixConfProp = InstallerUtil.getAsterixConfiguration(((AlterConfig) config).confPath);
- instance.setConfiguration(asterixConfProp);
+ InstallerUtil.createClusterProperties(instance.getCluster(), instance.getAsterixConfiguration());
+ AsterixConfiguration asterixConfiguration = InstallerUtil
+ .getAsterixConfiguration(((AlterConfig) config).confPath);
+ instance.setAsterixConfiguration(asterixConfiguration);
instance.setModifiedTimestamp(new Date());
lookupService.updateAsterixInstance(instance);
LOGGER.info("Configuration for Asterix instance: " + instanceName + " has been altered");
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
index e742c4e..129e416 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ConfigureCommand.java
@@ -28,7 +28,6 @@
cluster.setStore("storage");
cluster.setLogdir(workingDir + File.separator + "logs");
cluster.setJavaHome(System.getenv("JAVA_HOME"));
- cluster.setJavaOpts("-Xmx1024m");
JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
Marshaller marshaller = ctx.createMarshaller();
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
index 2de8e53..05d6777 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/CreateCommand.java
@@ -32,12 +32,14 @@
import edu.uci.ics.asterix.installer.events.PatternCreator;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
import edu.uci.ics.asterix.installer.model.AsterixRuntimeState;
+import edu.uci.ics.asterix.installer.schema.asterixconf.AsterixConfiguration;
import edu.uci.ics.asterix.installer.service.ServiceProvider;
public class CreateCommand extends AbstractCommand {
private String asterixInstanceName;
private Cluster cluster;
+ private AsterixConfiguration asterixConfiguration;
@Override
protected void execCommand() throws Exception {
@@ -51,24 +53,12 @@
InstallerUtil.validateAsterixInstanceNotExists(asterixInstanceName);
CreateConfig createConfig = (CreateConfig) config;
cluster = EventUtil.getCluster(createConfig.clusterPath);
- AsterixInstance asterixInstance = InstallerUtil.createAsterixInstance(asterixInstanceName, cluster);
+ asterixConfiguration = InstallerUtil.getAsterixConfiguration(createConfig.asterixConfPath);
+ AsterixInstance asterixInstance = InstallerUtil.createAsterixInstance(asterixInstanceName, cluster,
+ asterixConfiguration);
InstallerUtil.evaluateConflictWithOtherInstances(asterixInstance);
InstallerUtil.createAsterixZip(asterixInstance, true);
- List<Property> clusterProperties = new ArrayList<Property>();
- clusterProperties.add(new Property("ASTERIX_HOME", cluster.getWorkingDir().getDir() + File.separator
- + "asterix"));
- StringBuilder javaOpts = new StringBuilder();
- if (cluster.getJavaOpts() != null) {
- javaOpts.append(cluster.getJavaOpts());
- }
- clusterProperties.add(new Property("JAVA_OPTS", javaOpts.toString()));
- clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
- clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getClientIp()));
- clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
- clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
- clusterProperties.add(new Property("WORKING_DIR", cluster.getWorkingDir().getDir()));
- cluster.setEnv(new Env(clusterProperties));
-
+ InstallerUtil.createClusterProperties(cluster, asterixConfiguration);
EventrixClient eventrixClient = InstallerUtil.getEventrixClient(cluster);
PatternCreator pc = new PatternCreator();
@@ -117,4 +107,7 @@
@Option(name = "-c", required = true, usage = "Path to cluster configuration")
public String clusterPath;
+ @Option(name = "-a", required = false, usage = "Path to asterix configuration")
+ public String asterixConfPath;
+
}
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
index 01fdda4..f5119a5 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/StartCommand.java
@@ -25,8 +25,8 @@
import edu.uci.ics.asterix.installer.error.VerificationUtil;
import edu.uci.ics.asterix.installer.events.PatternCreator;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
-import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
import edu.uci.ics.asterix.installer.model.AsterixRuntimeState;
+import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
import edu.uci.ics.asterix.installer.service.ServiceProvider;
public class StartCommand extends AbstractCommand {
@@ -39,10 +39,10 @@
InstallerUtil.createAsterixZip(instance, false);
PatternCreator pc = new PatternCreator();
EventrixClient client = InstallerUtil.getEventrixClient(instance.getCluster());
- Patterns asterixBinaryTransferPattern = pc.getAsterixBinaryTransferPattern(asterixInstanceName,
- instance.getCluster());
+ Patterns asterixBinaryTransferPattern = pc.getAsterixBinaryTransferPattern(asterixInstanceName, instance
+ .getCluster());
client.submit(asterixBinaryTransferPattern);
-
+ InstallerUtil.createClusterProperties(instance.getCluster(), instance.getAsterixConfiguration());
Patterns patterns = pc.getStartAsterixPattern(asterixInstanceName, instance.getCluster());
client.submit(patterns);
InstallerUtil.deleteDirectory(InstallerDriver.getManagixHome() + File.separator + InstallerDriver.ASTERIX_DIR
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
index 4e6460b..e5700e9 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/command/ValidateCommand.java
@@ -32,7 +32,6 @@
import edu.uci.ics.asterix.event.schema.cluster.Node;
import edu.uci.ics.asterix.installer.driver.InstallerDriver;
import edu.uci.ics.asterix.installer.driver.InstallerUtil;
-import edu.uci.ics.asterix.installer.model.ProcessInfo;
import edu.uci.ics.asterix.installer.schema.conf.Configuration;
import edu.uci.ics.asterix.installer.schema.conf.Zookeeper;
@@ -110,8 +109,8 @@
serverIds.add(cluster.getMasterNode().getId());
MasterNode masterNode = cluster.getMasterNode();
- Node master = new Node(masterNode.getId(), masterNode.getClusterIp(), masterNode.getJavaOpts(),
- masterNode.getJavaHome(), masterNode.getLogdir(), null, null, null);
+ Node master = new Node(masterNode.getId(), masterNode.getClusterIp(), masterNode.getJavaHome(), masterNode
+ .getLogdir(), null, null);
ipAddresses.add(masterNode.getClusterIp());
valid = valid & validateNodeConfiguration(master, cluster);
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
index 3596032..80e522b 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerDriver.java
@@ -34,6 +34,8 @@
public static final String MANAGIX_EVENT_DIR = MANAGIX_INTERNAL_DIR + File.separator + "eventrix";
public static final String MANAGIX_EVENT_SCRIPTS_DIR = MANAGIX_INTERNAL_DIR + File.separator + "eventrix"
+ File.separator + "scripts";
+ public static final String DEFAULT_ASTERIX_CONFIGURATION_PATH = "clusters" + File.separator + "local"
+ + File.separator + "conf" + File.separator + "asterix-conf.xml";
public static final String ASTERIX_DIR = "asterix";
public static final String EVENTS_DIR = "events";
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
index e2be142..484d206 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/driver/InstallerUtil.java
@@ -40,16 +40,23 @@
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
import org.apache.commons.io.IOUtils;
import edu.uci.ics.asterix.event.driver.EventDriver;
import edu.uci.ics.asterix.event.management.EventrixClient;
import edu.uci.ics.asterix.event.schema.cluster.Cluster;
+import edu.uci.ics.asterix.event.schema.cluster.Env;
import edu.uci.ics.asterix.event.schema.cluster.Node;
+import edu.uci.ics.asterix.event.schema.cluster.Property;
import edu.uci.ics.asterix.installer.error.InstallerException;
import edu.uci.ics.asterix.installer.error.OutputHandler;
import edu.uci.ics.asterix.installer.model.AsterixInstance;
import edu.uci.ics.asterix.installer.model.AsterixInstance.State;
+import edu.uci.ics.asterix.installer.schema.asterixconf.AsterixConfiguration;
import edu.uci.ics.asterix.installer.service.ServiceProvider;
public class InstallerUtil {
@@ -57,17 +64,15 @@
public static final String TXN_LOG_DIR = "txnLogs";
public static final String TXN_LOG_DIR_KEY_SUFFIX = "txnLogDir";
- public static AsterixInstance createAsterixInstance(String asterixInstanceName, Cluster cluster)
- throws FileNotFoundException, IOException {
- Properties asterixConfProp = new Properties();
- asterixConfProp.put("output_dir", cluster.getWorkingDir().getDir() + File.separator + "asterix_output");
+ public static AsterixInstance createAsterixInstance(String asterixInstanceName, Cluster cluster,
+ AsterixConfiguration asterixConfiguration) throws FileNotFoundException, IOException {
Node metadataNode = getMetadataNode(cluster);
String asterixZipName = InstallerDriver.getAsterixZip().substring(
InstallerDriver.getAsterixZip().lastIndexOf(File.separator) + 1);
- String asterixVersion = asterixZipName.substring("asterix-server-".length(),
- asterixZipName.indexOf("-binary-assembly"));
- AsterixInstance instance = new AsterixInstance(asterixInstanceName, cluster, asterixConfProp,
- metadataNode.getId(), asterixVersion);
+ String asterixVersion = asterixZipName.substring("asterix-server-".length(), asterixZipName
+ .indexOf("-binary-assembly"));
+ AsterixInstance instance = new AsterixInstance(asterixInstanceName, cluster, asterixConfiguration, metadataNode
+ .getId(), asterixVersion);
return instance;
}
@@ -79,6 +84,31 @@
injectAsterixLogPropertyFile(modifiedZipPath, asterixInstance);
}
+ public static void createClusterProperties(Cluster cluster, AsterixConfiguration asterixConfiguration) {
+ List<Property> clusterProperties = null;
+ if (cluster.getEnv() != null && cluster.getEnv().getProperty() != null) {
+ clusterProperties = cluster.getEnv().getProperty();
+ clusterProperties.clear();
+ } else {
+ clusterProperties = new ArrayList<Property>();
+ }
+ for (edu.uci.ics.asterix.installer.schema.asterixconf.Property property : asterixConfiguration.getProperty()) {
+ if (property.getName().equalsIgnoreCase(AsterixInstance.CC_JAVA_OPTS)) {
+ clusterProperties.add(new Property("CC_JAVA_OPTS", property.getValue()));
+ } else if (property.getName().equalsIgnoreCase(AsterixInstance.NC_JAVA_OPTS)) {
+ clusterProperties.add(new Property("NC_JAVA_OPTS", property.getValue()));
+ }
+ }
+ clusterProperties.add(new Property("ASTERIX_HOME", cluster.getWorkingDir().getDir() + File.separator
+ + "asterix"));
+ clusterProperties.add(new Property("CLUSTER_NET_IP", cluster.getMasterNode().getClusterIp()));
+ clusterProperties.add(new Property("CLIENT_NET_IP", cluster.getMasterNode().getClientIp()));
+ clusterProperties.add(new Property("LOG_DIR", cluster.getLogdir()));
+ clusterProperties.add(new Property("JAVA_HOME", cluster.getJavaHome()));
+ clusterProperties.add(new Property("WORKING_DIR", cluster.getWorkingDir().getDir()));
+ cluster.setEnv(new Env(clusterProperties));
+ }
+
private static String injectAsterixPropertyFile(String origZipFile, AsterixInstance asterixInstance,
boolean newDeployment) throws IOException {
writeAsterixConfigurationFile(asterixInstance, newDeployment);
@@ -190,9 +220,12 @@
conf.append(asterixInstanceName + "_" + node.getId() + ".stores" + "=" + storeDir + "\n");
}
- Properties asterixConfProp = asterixInstance.getConfiguration();
- String outputDir = asterixConfProp.getProperty("output_dir");
- conf.append("OutputDir=" + outputDir);
+ AsterixConfiguration asterixConf = asterixInstance.getAsterixConfiguration();
+ /*for (Property property : asterixConf.getProperty()){
+
+ }*/
+
+ conf.append("OutputDir=" + "dummy");
File asterixConfDir = new File(InstallerDriver.getAsterixDir() + File.separator + asterixInstanceName);
asterixConfDir.mkdirs();
@@ -218,10 +251,17 @@
}
- public static Properties getAsterixConfiguration(String asterixConf) throws FileNotFoundException, IOException {
- Properties prop = new Properties();
- prop.load(new FileInputStream(asterixConf));
- return prop;
+ public static AsterixConfiguration getAsterixConfiguration(String asterixConf) throws FileNotFoundException,
+ IOException, JAXBException {
+ if (asterixConf == null) {
+ asterixConf = InstallerDriver.getManagixHome() + File.separator
+ + InstallerDriver.DEFAULT_ASTERIX_CONFIGURATION_PATH;
+ }
+ File file = new File(asterixConf);
+ JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ AsterixConfiguration asterixConfiguration = (AsterixConfiguration) unmarshaller.unmarshal(file);
+ return asterixConfiguration;
}
public static void unzip(String sourceFile, String destDir) throws IOException {
diff --git a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
index 9a2d43d..d4b2a0b 100644
--- a/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
+++ b/asterix-installer/src/main/java/edu/uci/ics/asterix/installer/model/AsterixInstance.java
@@ -18,15 +18,19 @@
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
-import java.util.Properties;
import edu.uci.ics.asterix.event.schema.cluster.Cluster;
import edu.uci.ics.asterix.event.schema.cluster.Node;
+import edu.uci.ics.asterix.installer.schema.asterixconf.AsterixConfiguration;
+import edu.uci.ics.asterix.installer.schema.asterixconf.Property;
public class AsterixInstance implements Serializable {
private static final long serialVersionUID = 2874439550187520449L;
+ public static final String CC_JAVA_OPTS = "cc_java_opts";
+ public static final String NC_JAVA_OPTS = "nc_java_opts";
+
public enum State {
ACTIVE,
INACTIVE,
@@ -38,7 +42,7 @@
private final Date createdTimestamp;
private Date stateChangeTimestamp;
private Date modifiedTimestamp;
- private Properties configuration;
+ private AsterixConfiguration asterixConfiguration;
private State state;
private final String metadataNodeId;
private final String asterixVersion;
@@ -47,11 +51,11 @@
private AsterixRuntimeState runtimeState;
private State previousState;
- public AsterixInstance(String name, Cluster cluster, Properties configuration, String metadataNodeId,
- String asterixVersion) {
+ public AsterixInstance(String name, Cluster cluster, AsterixConfiguration asterixConfiguration,
+ String metadataNodeId, String asterixVersion) {
this.name = name;
this.cluster = cluster;
- this.configuration = configuration;
+ this.asterixConfiguration = asterixConfiguration;
this.metadataNodeId = metadataNodeId;
this.state = State.ACTIVE;
this.previousState = State.UNUSABLE;
@@ -65,14 +69,6 @@
return stateChangeTimestamp;
}
- public Properties getConfiguration() {
- return configuration;
- }
-
- public void setConfiguration(Properties properties) {
- this.configuration = properties;
- }
-
public State getState() {
return state;
}
@@ -174,9 +170,23 @@
buffer.append(pInfo + "\n");
}
+ buffer.append("\n");
+ buffer.append("Asterix Configuration\n");
+ for (Property property : asterixConfiguration.getProperty()) {
+ buffer.append(property.getName() + ":" + property.getValue() + "\n");
+ }
+
}
public State getPreviousState() {
return previousState;
}
+
+ public AsterixConfiguration getAsterixConfiguration() {
+ return asterixConfiguration;
+ }
+
+ public void setAsterixConfiguration(AsterixConfiguration asterixConfiguration) {
+ this.asterixConfiguration = asterixConfiguration;
+ }
}
diff --git a/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml b/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml
new file mode 100644
index 0000000..b94e491
--- /dev/null
+++ b/asterix-installer/src/main/resources/clusters/local/conf/asterix-conf.xml
@@ -0,0 +1,140 @@
+<asterixConfiguration xmlns="asterixconf">
+
+ <property>
+ <name>nc_java_opts</name>
+ <value>-Xmx1024m</value>
+ <description>JVM parameters for each Node Contoller (NC)</description>
+ </property>
+
+ <property>
+ <name>cc_java_opts</name>
+ <value>-Xmx1024m</value>
+ <description>JVM parameters for each Cluster Contoller (CC)</description>
+ </property>
+
+ <property>
+ <name>size_memory_component</name>
+ <value>512m</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>total_size_memory_component</name>
+ <value>512m</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>log_buffer_num_pages</name>
+ <value>8</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>log_buffer_page_size</name>
+ <value></value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>log_buffer_page_size</name>
+ <value>128m</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>group_commit_interval</name>
+ <value>200ms</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>sort_op_memory</name>
+ <value>200m</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>join_op_memory</name>
+ <value>200ms</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>web_interface_port</name>
+ <value>19001</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>nc_port</name>
+ <value>14601</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>num_pages_buffer_cache</name>
+ <value>8</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>log_level</name>
+ <value>INFO</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>lsn_threshold</name>
+ <value>64m</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>checkpointTermsInSecs</name>
+ <value>120</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>escalate_threshold_entity_to_dataset</name>
+ <value>8</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>num_pages_buffer_cache</name>
+ <value>1000</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>logPageSize</name>
+ <value>131072</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>numLogPages</name>
+ <value>131072</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>logPartitionSize</name>
+ <value>2147483648</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>shrink_timer_threshold</name>
+ <value>120000</value>
+ <description></description>
+ </property>
+
+ <property>
+ <name>numLogPages</name>
+ <value>131072</value>
+ <description></description>
+ </property>
+</asterixConfiguration>
diff --git a/asterix-installer/src/main/resources/clusters/local/conf/asterix.conf b/asterix-installer/src/main/resources/clusters/local/conf/asterix.conf
deleted file mode 100644
index 659b48e..0000000
--- a/asterix-installer/src/main/resources/clusters/local/conf/asterix.conf
+++ /dev/null
@@ -1 +0,0 @@
-output_dir=/tmp/asterix_output/
diff --git a/asterix-installer/src/main/resources/schema/asterix-conf.xsd b/asterix-installer/src/main/resources/schema/asterix-conf.xsd
new file mode 100644
index 0000000..9ebc5ed
--- /dev/null
+++ b/asterix-installer/src/main/resources/schema/asterix-conf.xsd
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:mg="asterixconf" targetNamespace="asterixconf"
+ elementFormDefault="qualified">
+
+ <!-- definition of simple types -->
+
+ <xs:element name="name" type="xs:string" />
+ <xs:element name="value" type="xs:string" />
+ <xs:element name="description" type="xs:string" />
+
+ <!-- definition of complex elements -->
+ <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="asterixConfiguration">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element ref="mg:property" minOccurs="0" maxOccurs="unbounded" />
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>