support for coredump: checkpoint 1
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixThreadExecutor.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixThreadExecutor.java
new file mode 100644
index 0000000..519e222
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixThreadExecutor.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2009-2013 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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 edu.uci.ics.asterix.common.api;
+
+import java.util.concurrent.Executor;
+
+import edu.uci.ics.hyracks.api.lifecycle.ApplicationThreadExecutor;
+
+public class AsterixThreadExecutor implements Executor {
+
+ private static ApplicationThreadExecutor threadExecutor = new ApplicationThreadExecutor(
+ AsterixThreadFactory.INSTANCE);
+
+ public static AsterixThreadExecutor INSTANCE = new AsterixThreadExecutor();
+
+ private AsterixThreadExecutor() {
+
+ }
+
+ @Override
+ public void execute(Runnable command) {
+ threadExecutor.execute(command);
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixThreadFactory.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixThreadFactory.java
new file mode 100644
index 0000000..8a668cd
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixThreadFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed 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 from
+ *
+ * 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 edu.uci.ics.asterix.common.api;
+
+import java.util.concurrent.ThreadFactory;
+
+public class AsterixThreadFactory implements ThreadFactory {
+
+ public static AsterixThreadFactory INSTANCE = new AsterixThreadFactory();
+
+ private AsterixThreadFactory() {
+
+ }
+
+ @Override
+ public Thread newThread(Runnable r) {
+ Thread t;
+ if ((r instanceof Thread)) {
+ t = (Thread) r;
+ } else {
+ t = new Thread(r);
+ }
+ return t;
+ }
+
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixProperties.java
index 20a0d11..a2340b1 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixProperties.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixProperties.java
@@ -30,9 +30,10 @@
import javax.xml.bind.Unmarshaller;
import edu.uci.ics.asterix.common.configuration.AsterixConfiguration;
+import edu.uci.ics.asterix.common.configuration.Coredump;
import edu.uci.ics.asterix.common.configuration.Property;
import edu.uci.ics.asterix.common.configuration.Store;
-import edu.uci.ics.hyracks.algebricks.common.exceptions.AlgebricksException;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
/**
* Holder for Asterix properties values typically set as Java Properties.
@@ -44,6 +45,7 @@
private static String metadataNodeName;
private static HashSet<String> nodeNames;
private static Map<String, String[]> stores;
+ private static Map<String, String> coredumpDirs;
private static Map<String, String> asterixConfigurationParams;
public static AsterixProperties INSTANCE = new AsterixProperties();
@@ -103,6 +105,9 @@
public static final String SHRINK_TIMER_THRESHOLD = "shrink_timer_threshold";
public static final String SHRINK_TIMER_THRESHOLD_DEFAULT = "120000";
+ public static final String COREDUMP_PATH = "core_dump_dir";
+ public static final String COREDUMP_PATH_DEFAULT = System.getProperty("user.dir");
+
}
private AsterixProperties() {
@@ -117,7 +122,7 @@
fileName = GlobalConfig.DEFAULT_CONFIG_FILE_NAME;
is = new FileInputStream(fileName);
} catch (FileNotFoundException fnf) {
- throw new AlgebricksException("Could not find the configuration file " + fileName);
+ throw new AsterixException("Could not find the configuration file " + fileName);
}
}
@@ -133,11 +138,17 @@
stores.put(store.getNcId(), trimmedStoreDirs.split(","));
nodeNames.add(store.getNcId());
}
+
+ coredumpDirs = new HashMap<String, String>();
+ List<Coredump> configuredCoredumps = asterixConfiguration.getCoredump();
+ for (Coredump coredump : configuredCoredumps) {
+ coredumpDirs.put(coredump.getNcId(), coredump.getCoredumpPath().trim());
+ }
+
asterixConfigurationParams = new HashMap<String, String>();
for (Property p : asterixConfiguration.getProperty()) {
asterixConfigurationParams.put(p.getName(), p.getValue());
}
-
initializeLogLevel(getProperty(AsterixConfigurationKeys.LOG_LEVEL));
} catch (Exception e) {
throw new IllegalStateException(e);
@@ -160,6 +171,10 @@
return nodeNames;
}
+ public String getCoredumpPath(String ncId) {
+ return coredumpDirs.get(ncId);
+ }
+
public String getProperty(String property) {
String propValue = asterixConfigurationParams.get(property);
if (propValue == null) {
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java
index 5070938..6f7c29c 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/context/AsterixAppRuntimeContext.java
@@ -16,6 +16,7 @@
import edu.uci.ics.hyracks.api.application.INCApplicationContext;
import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
import edu.uci.ics.hyracks.api.io.IIOManager;
+import edu.uci.ics.hyracks.api.lifecycle.LifeCycleComponentManager;
import edu.uci.ics.hyracks.storage.am.common.api.IIndex;
import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManager;
import edu.uci.ics.hyracks.storage.am.common.dataflow.IndexLifecycleManager;
@@ -79,7 +80,7 @@
IPageCleanerPolicy pcp = new DelayPageCleanerPolicy(600000);
bufferCache = new BufferCache(ioManager, allocator, prs, pcp, fileMapManager, pageSize, numPages,
DEFAULT_MAX_OPEN_FILES);
-
+ LifeCycleComponentManager.INSTANCE.register(bufferCache);
lsmIOScheduler = SynchronousScheduler.INSTANCE;
mergePolicy = new ConstantMergePolicy(3, this);
lsmBTreeOpTrackerFactory = new IndexOperationTrackerFactory(LSMBTreeIOOperationCallbackFactory.INSTANCE);
diff --git a/asterix-common/src/main/resources/schema/asterix-conf.xsd b/asterix-common/src/main/resources/schema/asterix-conf.xsd
index f53fb4b..5aefdbd 100644
--- a/asterix-common/src/main/resources/schema/asterix-conf.xsd
+++ b/asterix-common/src/main/resources/schema/asterix-conf.xsd
@@ -7,6 +7,7 @@
<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" />
@@ -23,6 +24,15 @@
</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="property">
<xs:complexType>
<xs:sequence>
@@ -39,6 +49,7 @@
<xs:sequence>
<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:property" minOccurs="0" maxOccurs="unbounded" />
</xs:sequence>
</xs:complexType>