Merge branch 'master' of https://code.google.com/p/asterixdb
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java
index 49ca5ba..48f9e36 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/algebra/operators/physical/InvertedIndexPOperator.java
@@ -3,7 +3,8 @@
import java.util.ArrayList;
import java.util.List;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
import edu.uci.ics.asterix.metadata.MetadataException;
@@ -196,20 +197,22 @@
IBinaryTokenizerFactory queryTokenizerFactory = InvertedIndexAccessMethod.getBinaryTokenizerFactory(
searchModifierType, searchKeyType, secondaryIndex);
IIndexDataflowHelperFactory dataflowHelperFactory;
+
+ AsterixStorageProperties storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
if (!isPartitioned) {
dataflowHelperFactory = new LSMInvertedIndexDataflowHelperFactory(
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
} else {
dataflowHelperFactory = new PartitionedLSMInvertedIndexDataflowHelperFactory(
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
}
LSMInvertedIndexSearchOperatorDescriptor invIndexSearchOp = new LSMInvertedIndexSearchOperatorDescriptor(
jobSpec, queryField, appContext.getStorageManagerInterface(), secondarySplitsAndConstraint.first,
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
index 5cff07b..1f242b8 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/optimizer/rules/IntroduceDynamicTypeCastRule.java
@@ -109,8 +109,7 @@
inputRecordVar = usedVariables.get(0);
}
IVariableTypeEnvironment env = oldAssignOperator.computeInputTypeEnvironment(context);
- ARecordType inputRecordType = (ARecordType) env.getVarType(inputRecordVar);
-
+ IAType inputRecordType = (IAType) env.getVarType(inputRecordVar);
boolean needCast = !requiredRecordType.equals(inputRecordType);
if (!needCast)
return false;
diff --git a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
index 09fc2b9..f769db3 100644
--- a/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
+++ b/asterix-algebra/src/main/java/edu/uci/ics/asterix/translator/AqlExpressionToPlanTranslator.java
@@ -71,7 +71,8 @@
import edu.uci.ics.asterix.aql.expression.WriteStatement;
import edu.uci.ics.asterix.aql.expression.visitor.IAqlExpressionVisitor;
import edu.uci.ics.asterix.aql.util.FunctionUtils;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.common.functions.FunctionConstants;
@@ -288,7 +289,8 @@
String outputDir = System.getProperty("java.io.tmpDir");
String filePath = outputDir + System.getProperty("file.separator") + OUTPUT_FILE_PREFIX
+ outputFileID.incrementAndGet();
- return new FileSplit(AsterixProperties.INSTANCE.getMetadataNodeName(), new FileReference(new File(filePath)));
+ AsterixMetadataProperties metadataProperties = AsterixAppContextInfo.getInstance().getMetadataProperties();
+ return new FileSplit(metadataProperties.getMetadataNodeName(), new FileReference(new File(filePath)));
}
@Override
diff --git a/asterix-app/data/fbu-dml-insert-shuffled.adm b/asterix-app/data/fbu-dml-insert-shuffled.adm
new file mode 100644
index 0000000..5e42fd2
--- /dev/null
+++ b/asterix-app/data/fbu-dml-insert-shuffled.adm
@@ -0,0 +1,29 @@
+{"id":11381089,"id-copy":11381089,"alias":"Earlene","name":"EarleneAmmons","user-since":datetime("2010-03-24T05:25:35"),"user-since-copy":datetime("2010-03-24T05:25:35"),"friend-ids":{{25392364,36996951,16110083,9799716,22893553,28551996,7706432,14225386,15633254,39395931,46707062,37226919,8532306,3765988,20939685,31136325,45222021,15355741,8760941,12045616,6890610,13560532,44914868,37744233}},"employment":[{"organization-name":"Roundhex","start-date":date("2000-06-10")}]}
+{"id":10495420,"id-copy":10495420,"alias":"Wendy","name":"WendyMcloskey","user-since":datetime("2011-04-26T23:38:24"),"user-since-copy":datetime("2011-04-26T23:38:24"),"friend-ids":{{16762653,46262691,12313140,20481262,347993,23105127,1680519,20880265,45611347,21907223,46615281,17188244,44019800,46943250,28647738,16792673,29406270,42714079}},"employment":[{"organization-name":"Qvohouse","start-date":date("2008-08-27")}]}
+{"id":10957867,"id-copy":10957867,"alias":"Zach","name":"ZachOppenheimer","user-since":datetime("2012-01-01T14:40:11"),"user-since-copy":datetime("2012-01-01T14:40:11"),"friend-ids":{{27759480,2112389,8560433,10052851,37714587,16717012,36648956,44803993,36030695,5359496,32302980,27143894,19287706}},"employment":[{"organization-name":"Tanzumbam","start-date":date("2003-05-14"),"end-date":date("2004-02-23")}]}
+{"id":9988417,"id-copy":9988417,"alias":"Coline","name":"ColineLane","user-since":datetime("2010-01-01T00:12:39"),"user-since-copy":datetime("2010-01-01T00:12:39"),"friend-ids":{{17656229,42804152}},"employment":[{"organization-name":"Fax-fax","start-date":date("2012-05-01")}]}
+{"id":10272571,"id-copy":10272571,"alias":"Jarrett","name":"JarrettGoldvogel","user-since":datetime("2010-04-28T23:24:22"),"user-since-copy":datetime("2010-04-28T23:24:22"),"friend-ids":{{47024505,36647273,32152567,28239957,11739703,47515825,17408763,41224279,41487670,43339913}},"employment":[{"organization-name":"Transhigh","start-date":date("2004-04-06"),"end-date":date("2010-02-14")}]}
+{"id":11307946,"id-copy":11307946,"alias":"Helga","name":"HelgaStough","user-since":datetime("2007-01-12T21:50:11"),"user-since-copy":datetime("2007-01-12T21:50:11"),"friend-ids":{{22768365}},"employment":[{"organization-name":"subtam","start-date":date("2007-01-04"),"end-date":date("2009-06-25")}]}
+{"id":11061631,"id-copy":11061631,"alias":"Maxene","name":"MaxeneKellogg","user-since":datetime("2005-11-13T01:09:31"),"user-since-copy":datetime("2005-11-13T01:09:31"),"friend-ids":{{31578394,39466620,35741359,14244925,3000582,39031643,5008430,18315325,30440631,37868108,12014032,32314102,42887702,1853960,28022174,2024670,38864358,42073112,16259942,34693959,25315399,37475597,33599283}},"employment":[{"organization-name":"Unijobam","start-date":date("2008-05-13")}]}
+{"id":10874791,"id-copy":10874791,"alias":"Haydee","name":"HaydeeGarratt","user-since":datetime("2007-04-14T00:19:00"),"user-since-copy":datetime("2007-04-14T00:19:00"),"friend-ids":{{12247794,10306863,33161811,43877113,37745696}},"employment":[{"organization-name":"Opeelectronics","start-date":date("2008-03-07"),"end-date":date("2011-12-27")}]}
+{"id":11570326,"id-copy":11570326,"alias":"Linden","name":"LindenFilby","user-since":datetime("2007-08-16T03:11:11"),"user-since-copy":datetime("2007-08-16T03:11:11"),"friend-ids":{{6549689,15243636,3147666}},"employment":[{"organization-name":"Solfix","start-date":date("2010-02-23"),"end-date":date("2010-04-22")}]}
+{"id":10498285,"id-copy":10498285,"alias":"Kiley","name":"KileyBridger","user-since":datetime("2006-05-14T21:55:34"),"user-since-copy":datetime("2006-05-14T21:55:34"),"friend-ids":{{38780484,46190003,905670,35609390,46621151,5099226,24328595,16340411,13326485,13872400,35896828,9196151,8525875,7461206,28379538,46461267,45270205,35718577,5310596,7080391}},"employment":[{"organization-name":"Newcom","start-date":date("2009-11-11"),"end-date":date("2009-06-23")}]}
+{"id":9629395,"id-copy":9629395,"alias":"Julius","name":"JuliusWire","user-since":datetime("2008-03-22T13:36:24"),"user-since-copy":datetime("2008-03-22T13:36:24"),"friend-ids":{{}},"employment":[{"organization-name":"Tranzap","start-date":date("2006-11-19")}]}
+{"id":11447332,"id-copy":11447332,"alias":"Sherisse","name":"SherisseMaugham","user-since":datetime("2012-02-09T14:21:08"),"user-since-copy":datetime("2012-02-09T14:21:08"),"friend-ids":{{}},"employment":[{"organization-name":"Tripplelane","start-date":date("2011-09-16")}]}
+{"id":10179538,"id-copy":10179538,"alias":"Orlando","name":"OrlandoBaxter","user-since":datetime("2006-02-06T08:33:07"),"user-since-copy":datetime("2006-02-06T08:33:07"),"friend-ids":{{6233497,33888281,44259464,19279042,22534429,13084190,38886041,41675566,3155617}},"employment":[{"organization-name":"Ontohothex","start-date":date("2009-07-06")}]}
+{"id":10001080,"id-copy":10001080,"alias":"Garrett","name":"GarrettBode","user-since":datetime("2005-10-25T18:07:35"),"user-since-copy":datetime("2005-10-25T18:07:35"),"friend-ids":{{35858744,16426061,11473961,4769664,29038930,33070686,46271872,42593454,36202882,46642640,22243678,20222041,29014540,7389258,7172909,12787979,146736,21081030,21615179,2936936,44934891}},"employment":[{"organization-name":"Tanzimcare","start-date":date("2007-06-24")}]}
+{"id":11675221,"id-copy":11675221,"alias":"Calanthe","name":"CalantheGearhart","user-since":datetime("2007-06-08T02:44:20"),"user-since-copy":datetime("2007-06-08T02:44:20"),"friend-ids":{{19185575}},"employment":[{"organization-name":"Vivaace","start-date":date("2010-05-21")}]}
+{"id":11140213,"id-copy":11140213,"alias":"Montgomery","name":"MontgomeryWhittier","user-since":datetime("2007-06-19T17:46:13"),"user-since-copy":datetime("2007-06-19T17:46:13"),"friend-ids":{{32831460,6030454,30437362,21866470,17388602,40815157,20000967,47555494,5818137,40634742,21692148,2365521,33290069,46471164,9192561,35768343,7552168,3577338,5346012,31129868}},"employment":[{"organization-name":"Y-geohex","start-date":date("2008-02-24")}]}
+{"id":11954992,"id-copy":11954992,"alias":"Caitlin","name":"CaitlinLangston","user-since":datetime("2007-01-02T01:50:34"),"user-since-copy":datetime("2007-01-02T01:50:34"),"friend-ids":{{23355687,22474136,28513847,32515387,44041844,33706721,10874992,36341753,34431157,16146113,15462591,18188151,29554174,44940738,25888018,42795884,14382632,12734889,11724519,15830341,25725320,37580394,24124411,47984339}},"employment":[{"organization-name":"Kanelectrics","start-date":date("2010-05-26"),"end-date":date("2010-03-28")}]}
+{"id":9510451,"id-copy":9510451,"alias":"Chuck","name":"ChuckFinck","user-since":datetime("2011-09-10T08:27:31"),"user-since-copy":datetime("2011-09-10T08:27:31"),"friend-ids":{{5559039,8997599,8311284,20478562,13734713,21511695,30393493}},"employment":[{"organization-name":"Inchdox","start-date":date("2001-10-12")}]}
+{"id":11068231,"id-copy":11068231,"alias":"Dinah","name":"DinahSwink","user-since":datetime("2012-05-02T04:24:33"),"user-since-copy":datetime("2012-05-02T04:24:33"),"friend-ids":{{31542440,17451543,32642661,27867264,32718667,43042567,7921827}},"employment":[{"organization-name":"highfax","start-date":date("2003-04-10"),"end-date":date("2003-10-03")}]}
+{"id":10361965,"id-copy":10361965,"alias":"Arlen","name":"ArlenFlick","user-since":datetime("2011-07-14T18:38:37"),"user-since-copy":datetime("2011-07-14T18:38:37"),"friend-ids":{{34249140,2887282,47622716,3897801,33692288,14374380,14183995,41311739,6378075,17721901,20807501,8908974,41080464,26497672}},"employment":[{"organization-name":"Medflex","start-date":date("2008-05-18"),"end-date":date("2011-09-18")}]}
+{"id":10423588,"id-copy":10423588,"alias":"Shirlene","name":"ShirleneRuch","user-since":datetime("2006-04-09T05:52:24"),"user-since-copy":datetime("2006-04-09T05:52:24"),"friend-ids":{{15418780,12724265,27282306,13592995,24753166,32824252,40619106,27563604,12337625,45387219,27749581,44912564,37470078,19663516}},"employment":[{"organization-name":"Newphase","start-date":date("2003-06-17")}]}
+{"id":11951098,"id-copy":11951098,"alias":"Tera","name":"TeraByers","user-since":datetime("2012-08-03T19:41:26"),"user-since-copy":datetime("2012-08-03T19:41:26"),"friend-ids":{{15537238,13699967,10587728,23542817,12703626,25024772,19223339,5547239,42576945,27351017,22726496,25268071,4361323,24631578,38669047,44781738,34646381}},"employment":[{"organization-name":"Sublamdox","start-date":date("2008-01-04"),"end-date":date("2011-01-14")}]}
+{"id":9594523,"id-copy":9594523,"alias":"Tam","name":"TamWillcox","user-since":datetime("2011-12-23T11:41:58"),"user-since-copy":datetime("2011-12-23T11:41:58"),"friend-ids":{{27383896,20745988,10063024,8241427,40299998,32408463,25171835,22380586,15344194,25951348,28733234,45421004,2273747,2229862,6241144,6704115,8659430,47431991,47929530,24393021}},"employment":[{"organization-name":"Keytech","start-date":date("2001-07-27")}]}
+{"id":9478720,"id-copy":9478720,"alias":"Angelia","name":"AngeliaKettlewell","user-since":datetime("2005-05-27T06:29:30"),"user-since-copy":datetime("2005-05-27T06:29:30"),"friend-ids":{{42556433,20033025,38112512,19420757,31822717,7116081,39544900,19203395,46787205,32303456,4509345,45558040,42616291,6929369,9272653,37459048,37113569,38942369,47741031,46761451,14163845}},"employment":[{"organization-name":"Alphadax","start-date":date("2012-03-28"),"end-date":date("2012-03-04")}]}
+{"id":9142198,"id-copy":9142198,"alias":"Sherry","name":"SherryFea","user-since":datetime("2011-03-28T23:09:22"),"user-since-copy":datetime("2011-03-28T23:09:22"),"friend-ids":{{6835080,34471872,30942941,34858577,5996593,47293442,43097072,44809621,33969893,26410931,6628186,29944391,35957320,20326929,40284077,11681583,43878314,40265961,16871274,28406169,1349311}},"employment":[{"organization-name":"Mathtech","start-date":date("2004-07-28")}]}
+{"id":9313492,"id-copy":9313492,"alias":"Tera","name":"TeraWolfe","user-since":datetime("2010-12-20T12:47:25"),"user-since-copy":datetime("2010-12-20T12:47:25"),"friend-ids":{{45424983,18345704,14849759,31638064,38670515,48015953,36114769}},"employment":[{"organization-name":"Redelectronics","start-date":date("2001-04-26"),"end-date":date("2004-12-06")}]}
+{"id":10307032,"id-copy":10307032,"alias":"Quentin","name":"QuentinSauter","user-since":datetime("2012-07-11T07:16:43"),"user-since-copy":datetime("2012-07-11T07:16:43"),"friend-ids":{{1926278,42211794,1508832,14973540,6721046,28872485,5047722,7805271,31508326,20891455,38735410,13190567,18209753,44468536,34640135,47290587,25576626}},"employment":[{"organization-name":"Zamcorporation","start-date":date("2012-02-13")}]}
+{"id":10733617,"id-copy":10733617,"alias":"Leonardo","name":"LeonardoKight","user-since":datetime("2008-10-20T17:30:29"),"user-since-copy":datetime("2008-10-20T17:30:29"),"friend-ids":{{39687903,7235506,34696496,25995345,18435380,47473591,15710408,44232442,39520147,36384026,25160887,245860,1195579,4587411,536916,47052672,33953823,13203710}},"employment":[{"organization-name":"tresline","start-date":date("2007-07-12"),"end-date":date("2010-03-16")}]}
+{"id":10394488,"id-copy":10394488,"alias":"Oswald","name":"OswaldRay","user-since":datetime("2006-02-12T17:39:23"),"user-since-copy":datetime("2006-02-12T17:39:23"),"friend-ids":{{14370372,14174983,7749259,39375970,1755409,9056913}},"employment":[{"organization-name":"Canline","start-date":date("2011-12-04"),"end-date":date("2011-06-08")}]}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
index 862c701..438bc74 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/api/common/APIFramework.java
@@ -26,8 +26,8 @@
import edu.uci.ics.asterix.aql.expression.Query;
import edu.uci.ics.asterix.aql.expression.visitor.AQLPrintVisitor;
import edu.uci.ics.asterix.aql.rewrites.AqlRewriter;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfoImpl;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixCompilerProperties;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.common.AqlExpressionTypeComputer;
@@ -258,7 +258,8 @@
}
}
- int frameSize = GlobalConfig.getFrameSize();
+ AsterixCompilerProperties compilerProperties = AsterixAppContextInfo.getInstance().getCompilerProperties();
+ int frameSize = compilerProperties.getFrameSize();
HeuristicCompilerFactoryBuilder builder = new HeuristicCompilerFactoryBuilder(
AqlOptimizationContextFactory.INSTANCE);
@@ -342,7 +343,7 @@
IJobletEventListenerFactory jobEventListenerFactory = new JobEventListenerFactory(asterixJobId,
isWriteTransaction);
- JobSpecification spec = compiler.createJob(AsterixAppContextInfoImpl.getInstance(), jobEventListenerFactory);
+ JobSpecification spec = compiler.createJob(AsterixAppContextInfo.getInstance(), jobEventListenerFactory);
if (pc.isPrintJob()) {
switch (pdf) {
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
index b9b9524..25a2551 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/DatasetOperations.java
@@ -22,6 +22,8 @@
import java.util.logging.Logger;
import edu.uci.ics.asterix.api.common.Job;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.GlobalConfig;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
@@ -118,14 +120,15 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = metadataProvider
.splitProviderAndPartitionConstraintsForInternalOrFeedDataset(dataset.getDataverseName(), datasetName,
datasetName);
+ AsterixStorageProperties storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
IndexDropOperatorDescriptor primaryBtreeDrop = new IndexDropOperatorDescriptor(specPrimary,
AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER, AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER,
splitsAndConstraint.first, new LSMBTreeDataflowHelperFactory(
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES));
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()));
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(specPrimary, primaryBtreeDrop,
splitsAndConstraint.second);
@@ -163,10 +166,11 @@
}
LOGGER.info("CREATING File Splits: " + sb.toString());
+ AsterixStorageProperties storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
//prepare a LocalResourceMetadata which will be stored in NC's local resource repository
ILocalResourceMetadata localResourceMetadata = new LSMBTreeLocalResourceMetadata(typeTraits,
- comparatorFactories, blooFilterKeyFields, true, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ comparatorFactories, blooFilterKeyFields, true, storageProperties.getMemoryComponentPageSize(),
+ storageProperties.getMemoryComponentNumPages());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMBTreeResource);
@@ -176,9 +180,9 @@
new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES), localResourceFactoryProvider,
- NoOpOperationCallbackFactory.INSTANCE);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
+ localResourceFactoryProvider, NoOpOperationCallbackFactory.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, indexCreateOp,
splitsAndConstraint.second);
spec.addRoot(indexCreateOp);
@@ -258,15 +262,17 @@
numElementsHint = Long.parseLong(dataset.getHints().get("CARDINALITY"));
}
+ AsterixStorageProperties storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
TreeIndexBulkLoadOperatorDescriptor btreeBulkLoad = new TreeIndexBulkLoadOperatorDescriptor(spec,
AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER, AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER,
splitsAndConstraint.first, typeTraits, comparatorFactories, blooFilterKeyFields, fieldPermutation,
- GlobalConfig.DEFAULT_BTREE_FILL_FACTOR, false, numElementsHint, new LSMBTreeDataflowHelperFactory(
+ GlobalConfig.DEFAULT_BTREE_FILL_FACTOR, false, numElementsHint,
+ new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES), NoOpOperationCallbackFactory.INSTANCE);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
+ NoOpOperationCallbackFactory.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, btreeBulkLoad,
splitsAndConstraint.second);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
index dbbbe44..cec97ad 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/IndexOperations.java
@@ -1,6 +1,7 @@
package edu.uci.ics.asterix.file;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.OptimizationConfUtil;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
@@ -48,14 +49,15 @@
Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint = metadataProvider
.splitProviderAndPartitionConstraintsForInternalOrFeedDataset(dataverseName, datasetName, indexName);
+ AsterixStorageProperties storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
IndexDropOperatorDescriptor btreeDrop = new IndexDropOperatorDescriptor(spec,
AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER, AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER,
splitsAndConstraint.first, new LSMBTreeDataflowHelperFactory(
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES));
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()));
AlgebricksPartitionConstraintHelper
.setPartitionConstraintInJobSpec(spec, btreeDrop, splitsAndConstraint.second);
spec.addRoot(btreeDrop);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java
index 2a1349b..958f8d1 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryBTreeCreator.java
@@ -1,6 +1,7 @@
package edu.uci.ics.asterix.file;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.transaction.management.resource.ILocalResourceMetadata;
@@ -26,31 +27,33 @@
public class SecondaryBTreeCreator extends SecondaryIndexCreator {
- protected SecondaryBTreeCreator(PhysicalOptimizationConfig physOptConf) {
- super(physOptConf);
+ protected SecondaryBTreeCreator(PhysicalOptimizationConfig physOptConf,
+ IAsterixPropertiesProvider propertiesProvider) {
+ super(physOptConf, propertiesProvider);
}
@Override
public JobSpecification buildCreationJobSpec() throws AsterixException, AlgebricksException {
JobSpecification spec = new JobSpecification();
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
//prepare a LocalResourceMetadata which will be stored in NC's local resource repository
ILocalResourceMetadata localResourceMetadata = new LSMBTreeLocalResourceMetadata(
secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories, secondaryBloomFilterKeyFields, false,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMBTreeResource);
TreeIndexCreateOperatorDescriptor secondaryIndexCreateOp = new TreeIndexCreateOperatorDescriptor(spec,
AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER, AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER,
secondaryFileSplitProvider, secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories,
- secondaryBloomFilterKeyFields, new LSMBTreeDataflowHelperFactory(
+ secondaryBloomFilterKeyFields,
+ new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES), localResourceFactoryProvider,
- NoOpOperationCallbackFactory.INSTANCE);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
+ localResourceFactoryProvider, NoOpOperationCallbackFactory.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, secondaryIndexCreateOp,
secondaryPartitionConstraint);
spec.addRoot(secondaryIndexCreateOp);
@@ -80,13 +83,17 @@
// Sort by secondary keys.
ExternalSortOperatorDescriptor sortOp = createSortOp(spec, secondaryComparatorFactories, secondaryRecDesc);
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
// Create secondary BTree bulk load op.
- TreeIndexBulkLoadOperatorDescriptor secondaryBulkLoadOp = createTreeIndexBulkLoadOp(spec, numSecondaryKeys,
+ TreeIndexBulkLoadOperatorDescriptor secondaryBulkLoadOp = createTreeIndexBulkLoadOp(
+ spec,
+ numSecondaryKeys,
new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES), BTree.DEFAULT_FILL_FACTOR);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
+ BTree.DEFAULT_FILL_FACTOR);
// Connect the operators.
spec.connect(new OneToOneConnectorDescriptor(spec), keyProviderOp, 0, primaryScanOp, 0);
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
index e7c2e3e..83c9393 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryIndexCreator.java
@@ -19,8 +19,10 @@
import java.io.IOException;
import java.util.List;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.nontagged.AqlBinaryBooleanInspectorImpl;
@@ -103,29 +105,34 @@
protected RecordDescriptor secondaryRecDesc;
protected ICopyEvaluatorFactory[] secondaryFieldAccessEvalFactories;
+ protected IAsterixPropertiesProvider propertiesProvider;
+
// Prevent public construction. Should be created via createIndexCreator().
- protected SecondaryIndexCreator(PhysicalOptimizationConfig physOptConf) {
+ protected SecondaryIndexCreator(PhysicalOptimizationConfig physOptConf,
+ IAsterixPropertiesProvider propertiesProvider) {
this.physOptConf = physOptConf;
+ this.propertiesProvider = propertiesProvider;
}
public static SecondaryIndexCreator createIndexCreator(CompiledCreateIndexStatement createIndexStmt,
AqlMetadataProvider metadataProvider, PhysicalOptimizationConfig physOptConf) throws AsterixException,
AlgebricksException {
+ IAsterixPropertiesProvider asterixPropertiesProvider = AsterixAppContextInfo.getInstance();
SecondaryIndexCreator indexCreator = null;
switch (createIndexStmt.getIndexType()) {
case BTREE: {
- indexCreator = new SecondaryBTreeCreator(physOptConf);
+ indexCreator = new SecondaryBTreeCreator(physOptConf, asterixPropertiesProvider);
break;
}
case RTREE: {
- indexCreator = new SecondaryRTreeCreator(physOptConf);
+ indexCreator = new SecondaryRTreeCreator(physOptConf, asterixPropertiesProvider);
break;
}
case WORD_INVIX:
case NGRAM_INVIX:
case FUZZY_WORD_INVIX:
case FUZZY_NGRAM_INVIX: {
- indexCreator = new SecondaryInvertedIndexCreator(physOptConf);
+ indexCreator = new SecondaryInvertedIndexCreator(physOptConf, asterixPropertiesProvider);
break;
}
default: {
@@ -266,6 +273,7 @@
int[] lowKeyFields = null;
// +Infinity
int[] highKeyFields = null;
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
BTreeSearchOperatorDescriptor primarySearchOp = new BTreeSearchOperatorDescriptor(spec, primaryRecDesc,
AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER, AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER,
primaryFileSplitProvider, primaryRecDesc.getTypeTraits(), primaryComparatorFactories,
@@ -273,8 +281,9 @@
new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES), false, NoOpOperationCallbackFactory.INSTANCE);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()), false,
+ NoOpOperationCallbackFactory.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, primarySearchOp,
primaryPartitionConstraint);
return primarySearchOp;
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
index 0bf379d..7b53a28 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryInvertedIndexCreator.java
@@ -2,8 +2,9 @@
import java.util.List;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.metadata.declared.AqlMetadataProvider;
@@ -60,8 +61,9 @@
private RecordDescriptor tokenKeyPairRecDesc;
private boolean isPartitioned;
- protected SecondaryInvertedIndexCreator(PhysicalOptimizationConfig physOptConf) {
- super(physOptConf);
+ protected SecondaryInvertedIndexCreator(PhysicalOptimizationConfig physOptConf,
+ IAsterixPropertiesProvider propertiesProvider) {
+ super(physOptConf, propertiesProvider);
}
@Override
@@ -150,10 +152,12 @@
public JobSpecification buildCreationJobSpec() throws AsterixException, AlgebricksException {
JobSpecification spec = new JobSpecification();
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
//prepare a LocalResourceMetadata which will be stored in NC's local resource repository
ILocalResourceMetadata localResourceMetadata = new LSMInvertedIndexLocalResourceMetadata(invListsTypeTraits,
primaryComparatorFactories, tokenTypeTraits, tokenComparatorFactories, tokenizerFactory,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES, isPartitioned);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages(),
+ isPartitioned);
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMInvertedIndexResource);
@@ -259,20 +263,21 @@
}
private IIndexDataflowHelperFactory createDataflowHelperFactory() {
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
if (!isPartitioned) {
return new LSMInvertedIndexDataflowHelperFactory(
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
} else {
return new PartitionedLSMInvertedIndexDataflowHelperFactory(
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
}
}
}
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java
index 6f400f9..1a5e0da 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/file/SecondaryRTreeCreator.java
@@ -2,7 +2,8 @@
import java.util.List;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.dataflow.data.nontagged.valueproviders.AqlPrimitiveValueProviderFactory;
@@ -49,20 +50,22 @@
protected int numNestedSecondaryKeyFields;
protected ATypeTag keyType;
- protected SecondaryRTreeCreator(PhysicalOptimizationConfig physOptConf) {
- super(physOptConf);
+ protected SecondaryRTreeCreator(PhysicalOptimizationConfig physOptConf,
+ IAsterixPropertiesProvider propertiesProvider) {
+ super(physOptConf, propertiesProvider);
}
@Override
public JobSpecification buildCreationJobSpec() throws AsterixException, AlgebricksException {
JobSpecification spec = new JobSpecification();
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
//prepare a LocalResourceMetadata which will be stored in NC's local resource repository
ILocalResourceMetadata localResourceMetadata = new LSMRTreeLocalResourceMetadata(
secondaryRecDesc.getTypeTraits(), secondaryComparatorFactories, primaryComparatorFactories,
valueProviderFactories, RTreePolicyType.RTREE, AqlMetadataProvider.proposeLinearizer(keyType,
- secondaryComparatorFactories.length), GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE,
- GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ secondaryComparatorFactories.length), storageProperties.getMemoryComponentPageSize(),
+ storageProperties.getMemoryComponentNumPages());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMRTreeResource);
@@ -74,8 +77,8 @@
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER, AqlMetadataProvider.proposeLinearizer(
- keyType, secondaryComparatorFactories.length),
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
+ keyType, secondaryComparatorFactories.length), storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
localResourceFactoryProvider, NoOpOperationCallbackFactory.INSTANCE);
AlgebricksPartitionConstraintHelper.setPartitionConstraintInJobSpec(spec, secondaryIndexCreateOp,
secondaryPartitionConstraint);
@@ -149,6 +152,7 @@
selectOp = createFilterNullsSelectOp(spec, numNestedSecondaryKeyFields);
}
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
// Create secondary RTree bulk load op.
TreeIndexBulkLoadOperatorDescriptor secondaryBulkLoadOp = createTreeIndexBulkLoadOp(
spec,
@@ -158,8 +162,8 @@
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER, AqlMetadataProvider.proposeLinearizer(
- keyType, secondaryComparatorFactories.length),
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
+ keyType, secondaryComparatorFactories.length), storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
BTree.DEFAULT_FILL_FACTOR);
// Connect the operators.
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index 1b8990b..01cbca0 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -13,9 +13,9 @@
import edu.uci.ics.asterix.api.http.servlet.QueryResultAPIServlet;
import edu.uci.ics.asterix.api.http.servlet.QueryStatusAPIServlet;
import edu.uci.ics.asterix.api.http.servlet.UpdateAPIServlet;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfoImpl;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixExternalProperties;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.bootstrap.AsterixStateProxy;
@@ -29,10 +29,6 @@
private static final String HYRACKS_CONNECTION_ATTR = "edu.uci.ics.asterix.HYRACKS_CONNECTION";
- private static final int DEFAULT_WEB_SERVER_PORT = 19001;
-
- private static final int DEFAULT_JSON_API_SERVER_PORT = 19101;
-
private Server webServer;
private Server jsonAPIServer;
private static IAsterixStateProxy proxy;
@@ -45,20 +41,19 @@
LOGGER.info("Starting Asterix cluster controller");
}
+ AsterixAppContextInfo.initialize(appCtx);
+
proxy = AsterixStateProxy.registerRemoteObject();
- proxy.setAsterixProperties(AsterixProperties.INSTANCE);
appCtx.setDistributedState(proxy);
- MetadataManager.INSTANCE = new MetadataManager(proxy);
+ AsterixMetadataProperties metadataProperties = AsterixAppContextInfo.getInstance().getMetadataProperties();
+ MetadataManager.INSTANCE = new MetadataManager(proxy, metadataProperties);
- setupWebServer();
+ AsterixExternalProperties externalProperties = AsterixAppContextInfo.getInstance().getExternalProperties();
+ setupWebServer(externalProperties);
webServer.start();
-
- // Setup and start the web interface
- setupJSONAPIServer();
+ setupJSONAPIServer(externalProperties);
jsonAPIServer.start();
-
- AsterixAppContextInfoImpl.initialize(appCtx);
}
@Override
@@ -78,10 +73,9 @@
return new HyracksConnection(strIP, port);
}
- private void setupWebServer() throws Exception {
- int port = Integer.parseInt((String) AsterixProperties.INSTANCE
- .getProperty(AsterixProperties.AsterixConfigurationKeys.WEB_INTERFACE_PORT));
- webServer = new Server(port);
+ private void setupWebServer(AsterixExternalProperties externalProperties) throws Exception {
+
+ webServer = new Server(externalProperties.getWebInterfacePort());
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
@@ -93,13 +87,8 @@
context.addServlet(new ServletHolder(new APIServlet()), "/*");
}
- private void setupJSONAPIServer() throws Exception {
- String portStr = System.getProperty(GlobalConfig.JSON_API_SERVER_PORT_PROPERTY);
- int port = DEFAULT_JSON_API_SERVER_PORT;
- if (portStr != null) {
- port = Integer.parseInt(portStr);
- }
- jsonAPIServer = new Server(port);
+ private void setupJSONAPIServer(AsterixExternalProperties externalProperties) throws Exception {
+ jsonAPIServer = new Server(externalProperties.getAPIServerPort());
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
diff --git a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index 8ad8c67..7dad984 100644
--- a/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++ b/asterix-app/src/main/java/edu/uci/ics/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -5,6 +5,7 @@
import java.util.logging.Level;
import java.util.logging.Logger;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
import edu.uci.ics.asterix.metadata.MetadataManager;
import edu.uci.ics.asterix.metadata.MetadataNode;
@@ -86,32 +87,31 @@
@Override
public void notifyStartupComplete() throws Exception {
IAsterixStateProxy proxy = (IAsterixStateProxy) ncApplicationContext.getDistributedState();
+ AsterixMetadataProperties metadataProperties = runtimeContext.getMetadataProperties();
if (systemState == SystemState.NEW_UNIVERSE) {
- PersistentLocalResourceRepository localResourceRepository = (PersistentLocalResourceRepository) runtimeContext
- .getLocalResourceRepository();
-
if (LOGGER.isLoggable(Level.INFO)) {
- LOGGER.info("nodeid" + nodeId);
- LOGGER.info("proxy" + proxy);
- LOGGER.info("stores" + proxy.getAsterixProperties().getStores());
- LOGGER.info("store" + proxy.getAsterixProperties().getStores().get(nodeId)[0]);
+ LOGGER.info("System state: " + SystemState.NEW_UNIVERSE);
+ LOGGER.info("Node ID: " + nodeId);
+ LOGGER.info("Stores: " + metadataProperties.getStores());
+ LOGGER.info("Root Metadata Store: " + metadataProperties.getStores().get(nodeId)[0]);
}
- localResourceRepository.initialize(nodeId, proxy.getAsterixProperties().getStores().get(nodeId)[0], true,
- null);
+ PersistentLocalResourceRepository localResourceRepository = (PersistentLocalResourceRepository) runtimeContext
+ .getLocalResourceRepository();
+ localResourceRepository.initialize(nodeId, metadataProperties.getStores().get(nodeId)[0], true, null);
}
- isMetadataNode = nodeId.equals(proxy.getAsterixProperties().getMetadataNodeName());
+ isMetadataNode = nodeId.equals(metadataProperties.getMetadataNodeName());
if (isMetadataNode) {
registerRemoteMetadataNode(proxy);
if (LOGGER.isLoggable(Level.INFO)) {
LOGGER.info("Bootstrapping metadata");
}
- MetadataManager.INSTANCE = new MetadataManager(proxy);
+ MetadataManager.INSTANCE = new MetadataManager(proxy, metadataProperties);
MetadataManager.INSTANCE.init();
- MetadataBootstrap.startUniverse(proxy.getAsterixProperties(), ncApplicationContext,
+ MetadataBootstrap.startUniverse(runtimeContext, ncApplicationContext,
systemState == SystemState.NEW_UNIVERSE);
MetadataBootstrap.startDDLRecovery();
}
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.3.query.aql
new file mode 100644
index 0000000..9819455
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/aggregate/query-issue400/query-issue400.3.query.aql
@@ -0,0 +1,9 @@
+/*
+ * Description : This test case is to verify the fix for issue400
+ : https://code.google.com/p/asterixdb/issues/detail?id=400
+ * Expected Res : Success
+ * Date : 8th May 2013
+ */
+
+let $l := [[1,2,3,4,5],[6,7,8,9]]
+return count(for $i in $l return $i)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.1.ddl.aql
new file mode 100644
index 0000000..d09e16d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.1.ddl.aql
@@ -0,0 +1,26 @@
+create dataverse SocialNetworkData;
+
+use dataverse SocialNetworkData;
+
+create type EmploymentType as closed {
+organization-name: string,
+start-date: date,
+end-date: date?
+}
+
+create type FacebookUserType as closed {
+id: int32,
+id-copy: int32,
+alias: string,
+name: string,
+user-since: datetime,
+user-since-copy: datetime,
+friend-ids: {{ int32 }},
+employment: [EmploymentType]
+}
+
+create dataset FacebookUsers(FacebookUserType)
+primary key id;
+
+create dataset HandbookUsers(FacebookUserType)
+primary key id;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.2.update.aql
new file mode 100644
index 0000000..72f89e2
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.2.update.aql
@@ -0,0 +1,10 @@
+use dataverse SocialNetworkData;
+
+load dataset FacebookUsers using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/fbu-dml-insert-shuffled.adm"),("format"="adm"));
+
+insert into dataset HandbookUsers (
+for $x in dataset FacebookUsers
+where $x.id < 10307032
+return $x
+)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.3.query.aql
new file mode 100644
index 0000000..4a2f1ff
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue382/query-issue382.3.query.aql
@@ -0,0 +1,3 @@
+use dataverse SocialNetworkData;
+
+count(for $h in dataset HandbookUsers return $h);
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.1.ddl.aql
new file mode 100644
index 0000000..e7ab9e8
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.1.ddl.aql
@@ -0,0 +1,23 @@
+/*
+ * Description : This test case is to verify the fix for issue433
+ : https://code.google.com/p/asterixdb/issues/detail?id=433
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+create dataverse insertIssue;
+use dataverse insertIssue;
+
+create type subElem as closed {
+n: string,
+e: int32?
+}
+
+create type elem as closed {
+id: int32,
+name: string,
+sub: [subElem]
+}
+
+create dataset myDataset(elem)
+primary key id;
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.2.update.aql
new file mode 100644
index 0000000..d06b4f5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.2.update.aql
@@ -0,0 +1,13 @@
+/*
+ * Description : This test case is to verify the fix for issue433
+ : https://code.google.com/p/asterixdb/issues/detail?id=433
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+use dataverse insertIssue;
+
+insert into dataset myDataset (
+for $t in [ {"id":1, "name":"u1","sub":[{"n":"se1","e":100}]}, {"id":2, "name":"u2","sub":[{"n":"se2","e":200}]} ]
+return $t
+);
diff --git a/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.3.query.aql
new file mode 100644
index 0000000..b863cdf
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/dml/query-issue433/query-issue433.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : This test case is to verify the fix for issue433
+ : https://code.google.com/p/asterixdb/issues/detail?id=433
+ * Expected Res : Success
+ * Date : 3th April 2013
+ */
+
+use dataverse insertIssue;
+
+for $d in dataset myDataset
+order by $d.id
+return $d;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.1.ddl.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.1.ddl.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.2.update.aql
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.2.update.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.3.query.aql
new file mode 100644
index 0000000..aa6bf88
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/list/query-issue428/query-issue428.3.query.aql
@@ -0,0 +1,10 @@
+/*
+ * Description : This test case is to verify the fix for issue400
+ : https://code.google.com/p/asterixdb/issues/detail?id=400
+ * Expected Res : Success
+ * Date : 8th May 2013
+ */
+
+for $a in [[1,2],[3,4,5]]
+for $b in [[6,7],[8,9,10]]
+return some $a1 in $a,$b1 in $b satisfies $a1 < $b1
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/aggregate/query-issue400/query-issue400.1.adm b/asterix-app/src/test/resources/runtimets/results/aggregate/query-issue400/query-issue400.1.adm
new file mode 100644
index 0000000..d8263ee
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/aggregate/query-issue400/query-issue400.1.adm
@@ -0,0 +1 @@
+2
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/query-issue382/query-issue382.1.adm b/asterix-app/src/test/resources/runtimets/results/dml/query-issue382/query-issue382.1.adm
new file mode 100644
index 0000000..9a03714
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/query-issue382/query-issue382.1.adm
@@ -0,0 +1 @@
+10
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/dml/query-issue433/query-issue433.1.adm b/asterix-app/src/test/resources/runtimets/results/dml/query-issue433/query-issue433.1.adm
new file mode 100644
index 0000000..ce89449
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/dml/query-issue433/query-issue433.1.adm
@@ -0,0 +1,2 @@
+{ "id": 1, "name": "u1", "sub": [ { "n": "se1", "e": 100 } ] }
+{ "id": 2, "name": "u2", "sub": [ { "n": "se2", "e": 200 } ] }
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/list/query-issue428/query-issue428.1.adm b/asterix-app/src/test/resources/runtimets/results/list/query-issue428/query-issue428.1.adm
new file mode 100644
index 0000000..1140ff5
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/list/query-issue428/query-issue428.1.adm
@@ -0,0 +1,4 @@
+true
+true
+true
+true
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 6cb0ecc..5842563 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1,6 +1,11 @@
<test-suite xmlns="urn:xml.testframework.asterix.ics.uci.edu" ResultOffsetPath="results" QueryOffsetPath="queries" QueryFileExtension=".aql">
<test-group name="aggregate">
<test-case FilePath="aggregate">
+ <compilation-unit name="query-issue400">
+ <output-dir compare="Text">query-issue400</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="aggregate">
<compilation-unit name="issue395">
<output-dir compare="Text">issue395</output-dir>
</compilation-unit>
@@ -768,6 +773,16 @@
</test-group>
<test-group name="dml">
<test-case FilePath="dml">
+ <compilation-unit name="query-issue382">
+ <output-dir compare="Text">query-issue382</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
+ <compilation-unit name="query-issue433">
+ <output-dir compare="Text">query-issue433</output-dir>
+ </compilation-unit>
+ </test-case>
+ <test-case FilePath="dml">
<compilation-unit name="query-issue288">
<output-dir compare="Text">query-issue288</output-dir>
</compilation-unit>
@@ -2109,6 +2124,11 @@
<output-dir compare="Text">unordered-list-constructor_03</output-dir>
</compilation-unit>
</test-case>
+ <test-case FilePath="list">
+ <compilation-unit name="query-issue428">
+ <output-dir compare="Text">query-issue428</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="misc">
<test-case FilePath="misc">
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfo.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfo.java
new file mode 100644
index 0000000..06a1c1f
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfo.java
@@ -0,0 +1,111 @@
+/*
+ * 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.logging.Logger;
+
+import edu.uci.ics.asterix.common.config.AsterixCompilerProperties;
+import edu.uci.ics.asterix.common.config.AsterixExternalProperties;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
+import edu.uci.ics.asterix.common.config.AsterixPropertiesAccessor;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
+import edu.uci.ics.asterix.common.config.AsterixTransactionProperties;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
+import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
+import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
+import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
+import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
+
+/*
+ * Acts as an holder class for IndexRegistryProvider, AsterixStorageManager
+ * instances that are accessed from the NCs. In addition an instance of ICCApplicationContext
+ * is stored for access by the CC.
+ */
+public class AsterixAppContextInfo implements IAsterixApplicationContextInfo, IAsterixPropertiesProvider {
+
+ private static AsterixAppContextInfo INSTANCE;
+
+ private final ICCApplicationContext appCtx;
+
+ private AsterixCompilerProperties compilerProperties;
+ private AsterixExternalProperties externalProperties;
+ private AsterixMetadataProperties metadataProperties;
+ private AsterixStorageProperties storageProperties;
+ private AsterixTransactionProperties txnProperties;
+
+ public static void initialize(ICCApplicationContext ccAppCtx) throws AsterixException {
+ if (INSTANCE == null) {
+ INSTANCE = new AsterixAppContextInfo(ccAppCtx);
+ }
+ AsterixPropertiesAccessor propertiesAccessor = new AsterixPropertiesAccessor();
+ INSTANCE.compilerProperties = new AsterixCompilerProperties(propertiesAccessor);
+ INSTANCE.externalProperties = new AsterixExternalProperties(propertiesAccessor);
+ INSTANCE.metadataProperties = new AsterixMetadataProperties(propertiesAccessor);
+ INSTANCE.storageProperties = new AsterixStorageProperties(propertiesAccessor);
+ INSTANCE.txnProperties = new AsterixTransactionProperties(propertiesAccessor);
+
+ Logger.getLogger("edu.uci.ics").setLevel(INSTANCE.externalProperties.getLogLevel());
+ }
+
+ private AsterixAppContextInfo(ICCApplicationContext ccAppCtx) {
+ this.appCtx = ccAppCtx;
+ }
+
+ public static AsterixAppContextInfo getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public IStorageManagerInterface getStorageManagerInterface() {
+ return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
+ }
+
+ @Override
+ public ICCApplicationContext getCCApplicationContext() {
+ return appCtx;
+ }
+
+ @Override
+ public IIndexLifecycleManagerProvider getIndexLifecycleManagerProvider() {
+ return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
+ }
+
+ @Override
+ public AsterixStorageProperties getStorageProperties() {
+ return storageProperties;
+ }
+
+ @Override
+ public AsterixTransactionProperties getTransactionProperties() {
+ return txnProperties;
+ }
+
+ @Override
+ public AsterixCompilerProperties getCompilerProperties() {
+ return compilerProperties;
+ }
+
+ @Override
+ public AsterixMetadataProperties getMetadataProperties() {
+ return metadataProperties;
+ }
+
+ @Override
+ public AsterixExternalProperties getExternalProperties() {
+ return externalProperties;
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java
deleted file mode 100644
index 0f1de56..0000000
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/api/AsterixAppContextInfoImpl.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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 edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
-import edu.uci.ics.asterix.common.dataflow.IAsterixApplicationContextInfo;
-import edu.uci.ics.hyracks.api.application.ICCApplicationContext;
-import edu.uci.ics.hyracks.storage.am.common.api.IIndexLifecycleManagerProvider;
-import edu.uci.ics.hyracks.storage.common.IStorageManagerInterface;
-
-/*
- * Acts as an holder class for IndexRegistryProvider, AsterixStorageManager
- * instances that are accessed from the NCs. In addition an instance of ICCApplicationContext
- * is stored for access by the CC.
- */
-public class AsterixAppContextInfoImpl implements IAsterixApplicationContextInfo {
-
- private static AsterixAppContextInfoImpl INSTANCE;
-
- private final ICCApplicationContext appCtx;
-
- public static void initialize(ICCApplicationContext ccAppCtx) {
- if (INSTANCE == null) {
- INSTANCE = new AsterixAppContextInfoImpl(ccAppCtx);
- }
- }
-
- private AsterixAppContextInfoImpl(ICCApplicationContext ccAppCtx) {
- this.appCtx = ccAppCtx;
- }
-
- public static IAsterixApplicationContextInfo getInstance() {
- return INSTANCE;
- }
-
- @Override
- public IStorageManagerInterface getStorageManagerInterface() {
- return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
- }
-
- @Override
- public ICCApplicationContext getCCApplicationContext() {
- return appCtx;
- }
-
- @Override
- public IIndexLifecycleManagerProvider getIndexLifecycleManagerProvider() {
- return AsterixRuntimeComponentsProvider.NOINDEX_PROVIDER;
- }
-}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AbstractAsterixProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AbstractAsterixProperties.java
new file mode 100644
index 0000000..4968f40
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AbstractAsterixProperties.java
@@ -0,0 +1,9 @@
+package edu.uci.ics.asterix.common.config;
+
+public abstract class AbstractAsterixProperties {
+ protected final AsterixPropertiesAccessor accessor;
+
+ public AbstractAsterixProperties(AsterixPropertiesAccessor accessor) {
+ this.accessor = accessor;
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixCompilerProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixCompilerProperties.java
new file mode 100644
index 0000000..b1767b9
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixCompilerProperties.java
@@ -0,0 +1,31 @@
+package edu.uci.ics.asterix.common.config;
+
+public class AsterixCompilerProperties extends AbstractAsterixProperties {
+ private static final String COMPILER_SORTMEMORY_KEY = "compiler.sortmemory";
+ private static final long COMPILER_SORTMEMORY_DEFAULT = (512 << 20); // 512MB
+
+ private static final String COMPILER_JOINMEMORY_KEY = "compiler.joinmemory";
+ private static final long COMPILER_JOINMEMORY_DEFAULT = (512 << 20); // 512MB
+
+ private static final String COMPILER_FRAMESIZE_KEY = "compiler.framesize";
+ private static int COMPILER_FRAMESIZE_DEFAULT = (32 << 10); // 32KB
+
+ public AsterixCompilerProperties(AsterixPropertiesAccessor accessor) {
+ super(accessor);
+ }
+
+ public long getSortMemorySize() {
+ return accessor.getProperty(COMPILER_SORTMEMORY_KEY, COMPILER_SORTMEMORY_DEFAULT,
+ PropertyInterpreters.getLongPropertyInterpreter());
+ }
+
+ public long getJoinMemorySize() {
+ return accessor.getProperty(COMPILER_JOINMEMORY_KEY, COMPILER_JOINMEMORY_DEFAULT,
+ PropertyInterpreters.getLongPropertyInterpreter());
+ }
+
+ public int getFrameSize() {
+ return accessor.getProperty(COMPILER_FRAMESIZE_KEY, COMPILER_FRAMESIZE_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixExternalProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixExternalProperties.java
new file mode 100644
index 0000000..cf38932
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixExternalProperties.java
@@ -0,0 +1,34 @@
+package edu.uci.ics.asterix.common.config;
+
+import java.util.logging.Level;
+
+public class AsterixExternalProperties extends AbstractAsterixProperties {
+
+ private static final String EXTERNAL_WEBPORT_KEY = "web.port";
+ private static int EXTERNAL_WEBPORT_DEFAULT = 19001;
+
+ private static final String EXTERNAL_LOGLEVEL_KEY = "log.level";
+ private static Level EXTERNAL_LOGLEVEL_DEFAULT = Level.INFO;
+
+ private static final String EXTERNAL_APISERVER_KEY = "api.port";
+ private static int EXTERNAL_APISERVER_DEFAULT = 19101;
+
+ public AsterixExternalProperties(AsterixPropertiesAccessor accessor) {
+ super(accessor);
+ }
+
+ public int getWebInterfacePort() {
+ return accessor.getProperty(EXTERNAL_WEBPORT_KEY, EXTERNAL_WEBPORT_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getAPIServerPort() {
+ return accessor.getProperty(EXTERNAL_APISERVER_KEY, EXTERNAL_APISERVER_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public Level getLogLevel() {
+ return accessor.getProperty(EXTERNAL_LOGLEVEL_KEY, EXTERNAL_LOGLEVEL_DEFAULT,
+ PropertyInterpreters.getLevelPropertyInterpreter());
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixMetadataProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixMetadataProperties.java
new file mode 100644
index 0000000..6d47e78
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixMetadataProperties.java
@@ -0,0 +1,28 @@
+package edu.uci.ics.asterix.common.config;
+
+import java.util.Map;
+import java.util.Set;
+
+public class AsterixMetadataProperties extends AbstractAsterixProperties {
+
+ public AsterixMetadataProperties(AsterixPropertiesAccessor accessor) {
+ super(accessor);
+ }
+
+ public String getMetadataNodeName() {
+ return accessor.getMetadataNodeName();
+ }
+
+ public String getMetadataStore() {
+ return accessor.getMetadataStore();
+ }
+
+ public Map<String, String[]> getStores() {
+ return accessor.getStores();
+ }
+
+ public Set<String> getNodeNames() {
+ return accessor.getNodeNames();
+ }
+
+}
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
deleted file mode 100644
index 41ef67c..0000000
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixProperties.java
+++ /dev/null
@@ -1,252 +0,0 @@
-/*
- * Copyright 2009-2010 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.config;
-
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.InputStream;
-import java.io.Serializable;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Unmarshaller;
-
-import edu.uci.ics.asterix.common.configuration.AsterixConfiguration;
-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;
-
-/**
- * Holder for Asterix properties values typically set as Java Properties.
- * Intended to live in the AsterixStateProxy so it can be accessed remotely.
- */
-public class AsterixProperties implements Serializable {
-
- private static final long serialVersionUID = 1L;
- private static String metadataNodeName;
- private static HashSet<String> nodeNames;
- private static Map<String, String[]> stores;
- private static Map<String, String> asterixConfigurationParams;
-
- public static AsterixProperties INSTANCE = new AsterixProperties();
-
- public static class AsterixConfigurationKeys {
-
- // JVM parameters for each Node Contoller (NC)
- public static final String NC_JAVA_OPTS = "nc.java.opts";
- public static final String NC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
-
- // JVM parameters for the Cluster Contoller (CC)
- public static final String CC_JAVA_OPTS = "cc.java.opts";
- public static final String CC_JAVA_OPTS_DEFAULT = "-Xmx1024m";
-
- public static final String SIZE_MEMORY_COMPONENT = "size.memory.component";
- public static final String SIZE_MEMORY_COMPONENT_DEFAULT = "512m";
-
- public static final String TOTAL_SIZE_MEMORY_COMPONENT = "total.size.memory.component";
- public static final String TOTAL_SIZE_MEMORY_COMPONENT_DEFAULT = "512m";
-
- public static final String LOG_BUFFER_NUM_PAGES = "log.buffer.num.pages";
- public static final String LOG_BUFFER_NUM_PAGES_DEFAULT = "8";
-
- public static final String LOG_BUFFER_PAGE_SIZE = "log.buffer.page.size";
- public static final String LOG_BUFFER_PAGE_SIZE_DEFAULT = "131072";
-
- public static final String LOG_PARTITION_SIZE = "log.partition.size";
- public static final String LOG_PARTITION_SIZE_DEFAULT = "2147483648";
-
- public static final String GROUP_COMMIT_INTERVAL = "group.commit.interval";
- public static final String GROUP_COMMIT_INTERVAL_DEFAULT = "200ms";
-
- public static final String SORT_OP_MEMORY = "sort.op.memory";
- public static final String SORT_OP_MEMORY_DEFAULT = "512m";
-
- public static final String JOIN_OP_MEMORY = "join.op.memory";
- public static final String JOIN_OP_MEMORY_DEFAULT = "512m";
-
- public static final String WEB_INTERFACE_PORT = "web.interface.port";
- public static final String WEB_INTERFACE_PORT_DEFAULT = "19001";
-
- public static final String NUM_PAGES_BUFFER_CACHE = "num.pages.buffer.cache";
- public static final String NUM_PAGES_BUFFER_CACHE_DEFAULT = "1000";
-
- public static final String LOG_LEVEL = "log.level";
- public static final String LOG_LEVEL_DEFAULT = "INFO";
-
- public static final String LSN_THRESHOLD = "lsn.threshold";
- public static final String LSN_THRESHOLD_DEFAULT = "64m";
-
- public static final String CHECKPOINT_TERMS_IN_SECS = "checkpoint.terms.in.secs";
- public static final String CHECKPOINT_TERMS_IN_SECS_DEFAULT = "120";
-
- public static final String ESCALATE_THRSHOLD_ENTITY_TO_DATASET = "escalate.threshold.entity.to.dataset";
- public static final String ESCALATE_THRSHOLD_ENTITY_TO_DATASET_DEFAULT = "8";
-
- public static final String SHRINK_TIMER_THRESHOLD = "shrink.timer.threshold";
- public static final String SHRINK_TIMER_THRESHOLD_DEFAULT = "120000";
-
- }
-
- private AsterixProperties() {
- try {
- String fileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
- if (fileName == null) {
- fileName = GlobalConfig.DEFAULT_CONFIG_FILE_NAME;
- }
- InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
- if (is == null) {
- try {
- fileName = GlobalConfig.DEFAULT_CONFIG_FILE_NAME;
- is = new FileInputStream(fileName);
- } catch (FileNotFoundException fnf) {
- throw new AlgebricksException("Could not find the configuration file " + fileName);
- }
- }
-
- JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
- Unmarshaller unmarshaller = ctx.createUnmarshaller();
- AsterixConfiguration asterixConfiguration = (AsterixConfiguration) unmarshaller.unmarshal(is);
- metadataNodeName = asterixConfiguration.getMetadataNode();
- stores = new HashMap<String, String[]>();
- List<Store> configuredStores = asterixConfiguration.getStore();
- nodeNames = new HashSet<String>();
- for (Store store : configuredStores) {
- String trimmedStoreDirs = store.getStoreDirs().trim();
- stores.put(store.getNcId(), trimmedStoreDirs.split(","));
- nodeNames.add(store.getNcId());
- }
- 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);
- }
- }
-
- public String getMetadataNodeName() {
- return metadataNodeName;
- }
-
- public String getMetadataStore() {
- return stores.get(metadataNodeName)[0];
- }
-
- public Map<String, String[]> getStores() {
- return stores;
- }
-
- public HashSet<String> getNodeNames() {
- return nodeNames;
- }
-
- public String getProperty(String property) {
- String propValue = asterixConfigurationParams.get(property);
- if (propValue == null) {
- switch (property) {
- case AsterixConfigurationKeys.NC_JAVA_OPTS:
- propValue = AsterixConfigurationKeys.NC_JAVA_OPTS_DEFAULT;
- break;
- case AsterixConfigurationKeys.CC_JAVA_OPTS:
- propValue = AsterixConfigurationKeys.CC_JAVA_OPTS_DEFAULT;
- break;
- case AsterixConfigurationKeys.SIZE_MEMORY_COMPONENT:
- propValue = AsterixConfigurationKeys.SIZE_MEMORY_COMPONENT_DEFAULT;
- break;
- case AsterixConfigurationKeys.TOTAL_SIZE_MEMORY_COMPONENT:
- propValue = AsterixConfigurationKeys.TOTAL_SIZE_MEMORY_COMPONENT_DEFAULT;
- break;
- case AsterixConfigurationKeys.LOG_BUFFER_NUM_PAGES:
- propValue = AsterixConfigurationKeys.LOG_BUFFER_NUM_PAGES_DEFAULT;
- break;
- case AsterixConfigurationKeys.LOG_BUFFER_PAGE_SIZE:
- propValue = AsterixConfigurationKeys.LOG_BUFFER_PAGE_SIZE_DEFAULT;
- break;
- case AsterixConfigurationKeys.LOG_PARTITION_SIZE:
- propValue = AsterixConfigurationKeys.LOG_PARTITION_SIZE_DEFAULT;
- break;
- case AsterixConfigurationKeys.GROUP_COMMIT_INTERVAL:
- propValue = AsterixConfigurationKeys.GROUP_COMMIT_INTERVAL_DEFAULT;
- break;
- case AsterixConfigurationKeys.SORT_OP_MEMORY:
- propValue = AsterixConfigurationKeys.SORT_OP_MEMORY_DEFAULT;
- break;
- case AsterixConfigurationKeys.JOIN_OP_MEMORY:
- propValue = AsterixConfigurationKeys.JOIN_OP_MEMORY_DEFAULT;
- break;
- case AsterixConfigurationKeys.WEB_INTERFACE_PORT:
- propValue = AsterixConfigurationKeys.WEB_INTERFACE_PORT_DEFAULT;
- break;
- case AsterixConfigurationKeys.NUM_PAGES_BUFFER_CACHE:
- propValue = AsterixConfigurationKeys.NUM_PAGES_BUFFER_CACHE_DEFAULT;
- break;
- case AsterixConfigurationKeys.LOG_LEVEL:
- propValue = AsterixConfigurationKeys.LOG_LEVEL_DEFAULT;
- break;
- case AsterixConfigurationKeys.LSN_THRESHOLD:
- propValue = AsterixConfigurationKeys.LSN_THRESHOLD_DEFAULT;
- break;
- case AsterixConfigurationKeys.CHECKPOINT_TERMS_IN_SECS:
- propValue = AsterixConfigurationKeys.CHECKPOINT_TERMS_IN_SECS_DEFAULT;
- break;
- case AsterixConfigurationKeys.ESCALATE_THRSHOLD_ENTITY_TO_DATASET:
- propValue = AsterixConfigurationKeys.ESCALATE_THRSHOLD_ENTITY_TO_DATASET_DEFAULT;
- break;
- case AsterixConfigurationKeys.SHRINK_TIMER_THRESHOLD:
- propValue = AsterixConfigurationKeys.SHRINK_TIMER_THRESHOLD_DEFAULT;
- break;
- }
- }
- return propValue;
- }
-
- private void initializeLogLevel(String configuredLogLevel) {
- Level level = null;
- switch (configuredLogLevel.toLowerCase()) {
- case "info":
- level = Level.INFO;
- break;
- case "fine":
- level = Level.FINE;
- break;
- case "finer":
- level = Level.FINER;
- break;
- case "finest":
- level = Level.FINEST;
- break;
- case "severe":
- level = Level.SEVERE;
- break;
- case "off":
- level = Level.OFF;
- break;
- case "warning":
- level = Level.WARNING;
- break;
- default:
- level = Level.ALL;
- }
- Logger.getLogger("edu.uci.ics").setLevel(level);
- }
-}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java
new file mode 100644
index 0000000..7b2f2a6
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixPropertiesAccessor.java
@@ -0,0 +1,105 @@
+package edu.uci.ics.asterix.common.config;
+
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import edu.uci.ics.asterix.common.configuration.AsterixConfiguration;
+import edu.uci.ics.asterix.common.configuration.Property;
+import edu.uci.ics.asterix.common.configuration.Store;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
+
+public class AsterixPropertiesAccessor {
+ private static final Logger LOGGER = Logger.getLogger(AsterixPropertiesAccessor.class.getName());
+
+ private final String metadataNodeName;
+ private final Set<String> nodeNames;
+ private final Map<String, String[]> stores;
+ private final Map<String, Property> asterixConfigurationParams;
+
+ public AsterixPropertiesAccessor() throws AsterixException {
+ String fileName = System.getProperty(GlobalConfig.CONFIG_FILE_PROPERTY);
+ if (fileName == null) {
+ fileName = GlobalConfig.DEFAULT_CONFIG_FILE_NAME;
+ }
+ InputStream is = this.getClass().getClassLoader().getResourceAsStream(fileName);
+ if (is == null) {
+ try {
+ fileName = GlobalConfig.DEFAULT_CONFIG_FILE_NAME;
+ is = new FileInputStream(fileName);
+ } catch (FileNotFoundException fnf) {
+ throw new AsterixException("Could not find configuration file " + fileName);
+ }
+ }
+
+ AsterixConfiguration asterixConfiguration = null;
+ try {
+ JAXBContext ctx = JAXBContext.newInstance(AsterixConfiguration.class);
+ Unmarshaller unmarshaller = ctx.createUnmarshaller();
+ asterixConfiguration = (AsterixConfiguration) unmarshaller.unmarshal(is);
+ } catch (JAXBException e) {
+ throw new AsterixException("Failed to read configuration file " + fileName);
+ }
+ metadataNodeName = asterixConfiguration.getMetadataNode();
+ stores = new HashMap<String, String[]>();
+ List<Store> configuredStores = asterixConfiguration.getStore();
+ nodeNames = new HashSet<String>();
+ for (Store store : configuredStores) {
+ String trimmedStoreDirs = store.getStoreDirs().trim();
+ stores.put(store.getNcId(), trimmedStoreDirs.split(","));
+ nodeNames.add(store.getNcId());
+ }
+ asterixConfigurationParams = new HashMap<String, Property>();
+ for (Property p : asterixConfiguration.getProperty()) {
+ asterixConfigurationParams.put(p.getName(), p);
+ }
+ }
+
+ public String getMetadataNodeName() {
+ return metadataNodeName;
+ }
+
+ public String getMetadataStore() {
+ return stores.get(metadataNodeName)[0];
+ }
+
+ public Map<String, String[]> getStores() {
+ return stores;
+ }
+
+ public Set<String> getNodeNames() {
+ return nodeNames;
+ }
+
+ public <T> T getProperty(String property, T defaultValue, IPropertyInterpreter<T> interpreter) {
+ Property p = asterixConfigurationParams.get(property);
+ if (p == null) {
+ return defaultValue;
+ }
+
+ try {
+ return interpreter.interpret(p);
+ } catch (IllegalArgumentException e) {
+ logConfigurationError(p, defaultValue);
+ throw e;
+ }
+ }
+
+ private <T> void logConfigurationError(Property p, T defaultValue) {
+ if (LOGGER.isLoggable(Level.SEVERE)) {
+ LOGGER.severe("Invalid property value '" + p.getValue() + "' for property '" + p.getName()
+ + "'.\n See the description: \n" + p.getDescription() + "\nDefault = " + defaultValue);
+ }
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java
new file mode 100644
index 0000000..d34e4ac
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixStorageProperties.java
@@ -0,0 +1,72 @@
+package edu.uci.ics.asterix.common.config;
+
+public class AsterixStorageProperties extends AbstractAsterixProperties {
+
+ private static final String STORAGE_BUFFERCACHE_PAGESIZE_KEY = "storage.buffercache.pagesize";
+ private static int STORAGE_BUFFERCACHE_PAGESIZE_DEFAULT = (32 << 10); // 32KB
+
+ private static final String STORAGE_BUFFERCACHE_NUMPAGES_KEY = "storage.buffercache.numpages";
+ private static final int STORAGE_BUFFERCACHE_NUMPAGES_DEFAULT = 1024;
+
+ private static final String STORAGE_BUFFERCACHE_MAXOPENFILES_KEY = "storage.buffercache.maxopenfiles";
+ private static int STORAGE_BUFFERCACHE_MAXOPENFILES_DEFAULT = Integer.MAX_VALUE;
+
+ private static final String STORAGE_MEMORYCOMPONENT_PAGESIZE_KEY = "storage.memorycomponent.pagesize";
+ private static final int STORAGE_MEMORYCOMPONENT_PAGESIZE_DEFAULT = (32 << 10); // 32KB
+
+ private static final String STORAGE_MEMORYCOMPONENT_NUMPAGES_KEY = "storage.memorycomponent.numpages";
+ private static final int STORAGE_MEMORYCOMPONENT_NUMPAGES_DEFAULT = 4096; // ... so 128MB components
+
+ private static final String STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_KEY = "storage.memorycomponent.globalbudget";
+ private static final long STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_DEFAULT = (1 << 30); // 1GB
+
+ private static final String STORAGE_LSM_MERGETHRESHOLD_KEY = "storage.lsm.mergethreshold";
+ private static int STORAGE_LSM_MERGETHRESHOLD_DEFAULT = 3;
+
+ private static final String STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_KEY = "storage.lsm.bloomfilter.falsepositiverate";
+ private static double STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_DEFAULT = 0.01;
+
+ public AsterixStorageProperties(AsterixPropertiesAccessor accessor) {
+ super(accessor);
+ }
+
+ public int getBufferCachePageSize() {
+ return accessor.getProperty(STORAGE_BUFFERCACHE_PAGESIZE_KEY, STORAGE_BUFFERCACHE_PAGESIZE_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getBufferCacheNumPages() {
+ return accessor.getProperty(STORAGE_BUFFERCACHE_NUMPAGES_KEY, STORAGE_BUFFERCACHE_NUMPAGES_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getBufferCacheMaxOpenFiles() {
+ return accessor.getProperty(STORAGE_BUFFERCACHE_MAXOPENFILES_KEY, STORAGE_BUFFERCACHE_MAXOPENFILES_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getMemoryComponentPageSize() {
+ return accessor.getProperty(STORAGE_MEMORYCOMPONENT_PAGESIZE_KEY, STORAGE_MEMORYCOMPONENT_PAGESIZE_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getMemoryComponentNumPages() {
+ return accessor.getProperty(STORAGE_MEMORYCOMPONENT_NUMPAGES_KEY, STORAGE_MEMORYCOMPONENT_NUMPAGES_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public long getMemoryComponentGlobalBudget() {
+ return accessor.getProperty(STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_KEY,
+ STORAGE_MEMORYCOMPONENT_GLOBALBUDGET_DEFAULT, PropertyInterpreters.getLongPropertyInterpreter());
+ }
+
+ public int getLSMIndexMergeThreshold() {
+ return accessor.getProperty(STORAGE_LSM_MERGETHRESHOLD_KEY, STORAGE_LSM_MERGETHRESHOLD_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public double getBloomFilterFalsePositiveRate() {
+ return accessor.getProperty(STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_KEY,
+ STORAGE_LSM_BLOOMFILTER_FALSEPOSITIVERATE_DEFAULT, PropertyInterpreters.getDoublePropertyInterpreter());
+ }
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java
new file mode 100644
index 0000000..d97e53b
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/AsterixTransactionProperties.java
@@ -0,0 +1,72 @@
+package edu.uci.ics.asterix.common.config;
+
+public class AsterixTransactionProperties extends AbstractAsterixProperties {
+ private static final String TXN_LOG_BUFFER_NUMPAGES_KEY = "txn.log.buffer.numpages";
+ private static int TXN_LOG_BUFFER_NUMPAGES_DEFAULT = 8;
+
+ private static final String TXN_LOG_BUFFER_PAGESIZE_KEY = "txn.log.buffer.pagesize";
+ private static final int TXN_LOG_BUFFER_PAGESIZE_DEFAULT = (128 << 10); // 128KB
+
+ private static final String TXN_LOG_PARTITIONSIZE_KEY = "txn.log.partitionsize";
+ private static final long TXN_LOG_PARTITIONSIZE_DEFAULT = (2 << 30); // 2GB
+
+ private static final String TXN_LOG_GROUPCOMMITINTERVAL_KEY = "txn.log.groupcommitinterval";
+ private static int TXN_LOG_GROUPCOMMITINTERVAL_DEFAULT = 200; // 200ms
+
+ private static final String TXN_LOG_CHECKPOINT_LSNTHRESHOLD_KEY = "txn.log.checkpoint.lsnthreshold";
+ private static final int TXN_LOG_CHECKPOINT_LSNTHRESHOLD_DEFAULT = (64 << 20); // 64M
+
+ private static final String TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY = "txn.log.checkpoint.pollfrequency";
+ private static int TXN_LOG_CHECKPOINT_POLLFREQUENCY_DEFAULT = 120; // 120s
+
+ private static final String TXN_LOCK_ESCALATIONTHRESHOLD_KEY = "txn.lock.escalationthreshold";
+ private static int TXN_LOCK_ESCALATIONTHRESHOLD_DEFAULT = 1000;
+
+ private static final String TXN_LOCK_SHRINKTIMER_KEY = "txn.lock.shrinktimer";
+ private static int TXN_LOCK_SHRINKTIMER_DEFAULT = 120000; // 2m
+
+ public AsterixTransactionProperties(AsterixPropertiesAccessor accessor) {
+ super(accessor);
+ }
+
+ public int getLogBufferNumPages() {
+ return accessor.getProperty(TXN_LOG_BUFFER_NUMPAGES_KEY, TXN_LOG_BUFFER_NUMPAGES_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getLogBufferPageSize() {
+ return accessor.getProperty(TXN_LOG_BUFFER_PAGESIZE_KEY, TXN_LOG_BUFFER_PAGESIZE_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public long getLogPartitionSize() {
+ return accessor.getProperty(TXN_LOG_PARTITIONSIZE_KEY, TXN_LOG_PARTITIONSIZE_DEFAULT,
+ PropertyInterpreters.getLongPropertyInterpreter());
+ }
+
+ public int getGroupCommitInterval() {
+ return accessor.getProperty(TXN_LOG_GROUPCOMMITINTERVAL_KEY, TXN_LOG_GROUPCOMMITINTERVAL_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getCheckpointLSNThreshold() {
+ return accessor.getProperty(TXN_LOG_CHECKPOINT_LSNTHRESHOLD_KEY, TXN_LOG_CHECKPOINT_LSNTHRESHOLD_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getCheckpointPollFrequency() {
+ return accessor.getProperty(TXN_LOG_CHECKPOINT_POLLFREQUENCY_KEY, TXN_LOG_CHECKPOINT_POLLFREQUENCY_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getEntityToDatasetLockEscalationThreshold() {
+ return accessor.getProperty(TXN_LOCK_ESCALATIONTHRESHOLD_KEY, TXN_LOCK_ESCALATIONTHRESHOLD_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+ public int getLockManagerShrinkTimer() {
+ return accessor.getProperty(TXN_LOCK_SHRINKTIMER_KEY, TXN_LOCK_SHRINKTIMER_DEFAULT,
+ PropertyInterpreters.getIntegerPropertyInterpreter());
+ }
+
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/GlobalConfig.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/GlobalConfig.java
index ebce6fe..3948e69 100644
--- a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/GlobalConfig.java
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/GlobalConfig.java
@@ -3,61 +3,43 @@
import java.util.logging.Logger;
public class GlobalConfig {
- public static final boolean DEBUG = true;
+ public static final boolean DEBUG = true;
- public static final String ASTERIX_LOGGER_NAME = "edu.uci.ics.asterix";
+ public static final String ASTERIX_LOGGER_NAME = "edu.uci.ics.asterix";
- public static final Logger ASTERIX_LOGGER = Logger
- .getLogger(ASTERIX_LOGGER_NAME);
+ public static final Logger ASTERIX_LOGGER = Logger.getLogger(ASTERIX_LOGGER_NAME);
- public static final String ASTERIX_LOGFILE_PATTERN = "%t/asterix.log";
+ public static final String DEFAULT_CONFIG_FILE_NAME = "asterix-configuration.xml";
- public static final String DEFAULT_CONFIG_FILE_NAME = "asterix-configuration.xml";
+ public static final String CONFIG_FILE_PROPERTY = "AsterixConfigFileName";
- public static final String TEST_CONFIG_FILE_NAME = "src/main/resources/asterix-configuration.xml";
+ public static final String WEB_SERVER_PORT_PROPERTY = "AsterixWebServerPort";
- public static final String CONFIG_FILE_PROPERTY = "AsterixConfigFileName";
+ public static final String JSON_API_SERVER_PORT_PROPERTY = "AsterixJSONAPIServerPort";
- public static final String WEB_SERVER_PORT_PROPERTY = "AsterixWebServerPort";
+ public static final int DEFAULT_FRAME_SIZE = 32768;
- public static final String JSON_API_SERVER_PORT_PROPERTY = "AsterixJSONAPIServerPort";
+ public static final String FRAME_SIZE_PROPERTY = "FrameSize";
- public static final String BUFFER_CACHE_PAGE_SIZE_PROPERTY = "BufferCachePageSize";
+ public static final float DEFAULT_BTREE_FILL_FACTOR = 1.00f;
- public static final String BUFFER_CACHE_NUM_PAGES_PROPERTY = "BufferCacheNumPages";
+ public static int DEFAULT_INPUT_DATA_COLUMN = 0;
- public static final int DEFAULT_BUFFER_CACHE_NUM_PAGES = 4096;
-
- public static final int DEFAULT_FRAME_SIZE = 32768;
-
- public static final String FRAME_SIZE_PROPERTY = "FrameSize";
-
- public static final float DEFAULT_BTREE_FILL_FACTOR = 1.00f;
-
- public static int DEFAULT_INPUT_DATA_COLUMN = 0;
-
- public static int DEFAULT_INDEX_MEM_PAGE_SIZE = 32768;
-
- public static int DEFAULT_INDEX_MEM_NUM_PAGES = 1000;
-
- public static int getFrameSize() {
- int frameSize = GlobalConfig.DEFAULT_FRAME_SIZE;
- String frameSizeStr = System
- .getProperty(GlobalConfig.FRAME_SIZE_PROPERTY);
- if (frameSizeStr != null) {
- int fz = -1;
- try {
- fz = Integer.parseInt(frameSizeStr);
- } catch (NumberFormatException nfe) {
- GlobalConfig.ASTERIX_LOGGER
- .warning("Wrong frame size size argument. Picking default value ("
- + GlobalConfig.DEFAULT_FRAME_SIZE
- + ") instead.\n");
- }
- if (fz >= 0) {
- frameSize = fz;
- }
- }
- return frameSize;
- }
+ public static int getFrameSize() {
+ int frameSize = GlobalConfig.DEFAULT_FRAME_SIZE;
+ String frameSizeStr = System.getProperty(GlobalConfig.FRAME_SIZE_PROPERTY);
+ if (frameSizeStr != null) {
+ int fz = -1;
+ try {
+ fz = Integer.parseInt(frameSizeStr);
+ } catch (NumberFormatException nfe) {
+ GlobalConfig.ASTERIX_LOGGER.warning("Wrong frame size size argument. Picking default value ("
+ + GlobalConfig.DEFAULT_FRAME_SIZE + ") instead.\n");
+ }
+ if (fz >= 0) {
+ frameSize = fz;
+ }
+ }
+ return frameSize;
+ }
}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/IAsterixPropertiesProvider.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/IAsterixPropertiesProvider.java
new file mode 100644
index 0000000..e42c827
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/IAsterixPropertiesProvider.java
@@ -0,0 +1,14 @@
+package edu.uci.ics.asterix.common.config;
+
+
+public interface IAsterixPropertiesProvider {
+ public AsterixStorageProperties getStorageProperties();
+
+ public AsterixTransactionProperties getTransactionProperties();
+
+ public AsterixCompilerProperties getCompilerProperties();
+
+ public AsterixMetadataProperties getMetadataProperties();
+
+ public AsterixExternalProperties getExternalProperties();
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/IPropertyInterpreter.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/IPropertyInterpreter.java
new file mode 100644
index 0000000..2cabbe5
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/IPropertyInterpreter.java
@@ -0,0 +1,7 @@
+package edu.uci.ics.asterix.common.config;
+
+import edu.uci.ics.asterix.common.configuration.Property;
+
+public interface IPropertyInterpreter<T> {
+ public T interpret(Property p) throws IllegalArgumentException;
+}
diff --git a/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/PropertyInterpreters.java b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/PropertyInterpreters.java
new file mode 100644
index 0000000..9ff5dee
--- /dev/null
+++ b/asterix-common/src/main/java/edu/uci/ics/asterix/common/config/PropertyInterpreters.java
@@ -0,0 +1,71 @@
+package edu.uci.ics.asterix.common.config;
+
+import java.util.logging.Level;
+
+import edu.uci.ics.asterix.common.configuration.Property;
+
+public class PropertyInterpreters {
+
+ public static IPropertyInterpreter<Integer> getIntegerPropertyInterpreter() {
+ return new IPropertyInterpreter<Integer>() {
+
+ @Override
+ public Integer interpret(Property p) throws IllegalArgumentException {
+ try {
+ return Integer.parseInt(p.getValue());
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ };
+ }
+
+ public static IPropertyInterpreter<Long> getLongPropertyInterpreter() {
+ return new IPropertyInterpreter<Long>() {
+
+ @Override
+ public Long interpret(Property p) throws IllegalArgumentException {
+ try {
+ return Long.parseLong(p.getValue());
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ };
+ }
+
+ public static IPropertyInterpreter<Level> getLevelPropertyInterpreter() {
+ return new IPropertyInterpreter<Level>() {
+
+ @Override
+ public Level interpret(Property p) throws IllegalArgumentException {
+ return Level.parse(p.getValue());
+ }
+ };
+ }
+
+ public static IPropertyInterpreter<String> getStringPropertyInterpreter() {
+ return new IPropertyInterpreter<String>() {
+
+ @Override
+ public String interpret(Property p) throws IllegalArgumentException {
+ return p.getValue();
+ }
+ };
+ }
+
+ public static IPropertyInterpreter<Double> getDoublePropertyInterpreter() {
+ return new IPropertyInterpreter<Double>() {
+
+ @Override
+ public Double interpret(Property p) throws IllegalArgumentException {
+ try {
+ return Double.parseDouble(p.getValue());
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException(e);
+ }
+ }
+ };
+ }
+
+}
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..03e84ef 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
@@ -1,9 +1,16 @@
package edu.uci.ics.asterix.common.context;
import java.io.IOException;
-import java.util.logging.Level;
+import java.util.logging.Logger;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.config.AsterixCompilerProperties;
+import edu.uci.ics.asterix.common.config.AsterixExternalProperties;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
+import edu.uci.ics.asterix.common.config.AsterixPropertiesAccessor;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
+import edu.uci.ics.asterix.common.config.AsterixTransactionProperties;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
+import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMBTreeIOOperationCallbackFactory;
import edu.uci.ics.asterix.transaction.management.ioopcallbacks.LSMInvertedIndexIOOperationCallbackFactory;
@@ -39,12 +46,15 @@
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactory;
import edu.uci.ics.hyracks.storage.common.file.ResourceIdFactoryProvider;
-public class AsterixAppRuntimeContext {
- private static final int DEFAULT_BUFFER_CACHE_PAGE_SIZE = 32768;
- private static final int DEFAULT_LIFECYCLEMANAGER_MEMORY_BUDGET = 1024 * 1024 * 1024; // 1GB
- private static final int DEFAULT_MAX_OPEN_FILES = Integer.MAX_VALUE;
+public class AsterixAppRuntimeContext implements IAsterixPropertiesProvider {
private final INCApplicationContext ncApplicationContext;
+ private AsterixCompilerProperties compilerProperties;
+ private AsterixExternalProperties externalProperties;
+ private AsterixMetadataProperties metadataProperties;
+ private AsterixStorageProperties storageProperties;
+ private AsterixTransactionProperties txnProperties;
+
private IIndexLifecycleManager indexLifecycleManager;
private IFileMapManager fileMapManager;
private IBufferCache bufferCache;
@@ -64,24 +74,29 @@
this.ncApplicationContext = ncApplicationContext;
}
- public void initialize() throws IOException, ACIDException {
- int pageSize = getBufferCachePageSize();
- int numPages = getBufferCacheNumPages();
+ public void initialize() throws IOException, ACIDException, AsterixException {
+ AsterixPropertiesAccessor propertiesAccessor = new AsterixPropertiesAccessor();
+ compilerProperties = new AsterixCompilerProperties(propertiesAccessor);
+ externalProperties = new AsterixExternalProperties(propertiesAccessor);
+ metadataProperties = new AsterixMetadataProperties(propertiesAccessor);
+ storageProperties = new AsterixStorageProperties(propertiesAccessor);
+ txnProperties = new AsterixTransactionProperties(propertiesAccessor);
+
+ Logger.getLogger("edu.uci.ics").setLevel(externalProperties.getLogLevel());
fileMapManager = new AsterixFileMapManager();
ICacheMemoryAllocator allocator = new HeapBufferAllocator();
IPageReplacementStrategy prs = new ClockPageReplacementStrategy();
- ioManager = ncApplicationContext.getRootContext().getIOManager();
- indexLifecycleManager = new IndexLifecycleManager(DEFAULT_LIFECYCLEMANAGER_MEMORY_BUDGET);
- IAsterixAppRuntimeContextProvider asterixAppRuntimeContextProvider = new AsterixAppRuntimeContextProviderForRecovery(
- this);
- txnSubsystem = new TransactionSubsystem(ncApplicationContext.getNodeId(), asterixAppRuntimeContextProvider);
IPageCleanerPolicy pcp = new DelayPageCleanerPolicy(600000);
- bufferCache = new BufferCache(ioManager, allocator, prs, pcp, fileMapManager, pageSize, numPages,
- DEFAULT_MAX_OPEN_FILES);
+ ioManager = ncApplicationContext.getRootContext().getIOManager();
+ bufferCache = new BufferCache(ioManager, allocator, prs, pcp, fileMapManager,
+ storageProperties.getBufferCachePageSize(), storageProperties.getBufferCacheNumPages(),
+ storageProperties.getBufferCacheMaxOpenFiles());
+
+ indexLifecycleManager = new IndexLifecycleManager(storageProperties.getMemoryComponentGlobalBudget());
lsmIOScheduler = SynchronousScheduler.INSTANCE;
- mergePolicy = new ConstantMergePolicy(3, this);
+ mergePolicy = new ConstantMergePolicy(storageProperties.getLSMIndexMergeThreshold(), this);
lsmBTreeOpTrackerFactory = new IndexOperationTrackerFactory(LSMBTreeIOOperationCallbackFactory.INSTANCE);
lsmRTreeOpTrackerFactory = new IndexOperationTrackerFactory(LSMRTreeIOOperationCallbackFactory.INSTANCE);
lsmInvertedIndexOpTrackerFactory = new IndexOperationTrackerFactory(
@@ -92,6 +107,10 @@
localResourceRepository = (PersistentLocalResourceRepository) persistentLocalResourceRepositoryFactory
.createRepository();
resourceIdFactory = (new ResourceIdFactoryProvider(localResourceRepository)).createResourceIdFactory();
+
+ IAsterixAppRuntimeContextProvider asterixAppRuntimeContextProvider = new AsterixAppRuntimeContextProviderForRecovery(
+ this);
+ txnSubsystem = new TransactionSubsystem(ncApplicationContext.getNodeId(), asterixAppRuntimeContextProvider);
isShuttingdown = false;
}
@@ -103,49 +122,6 @@
this.isShuttingdown = isShuttingdown;
}
- private int getBufferCachePageSize() {
- int pageSize = DEFAULT_BUFFER_CACHE_PAGE_SIZE;
- String pageSizeStr = System.getProperty(GlobalConfig.BUFFER_CACHE_PAGE_SIZE_PROPERTY, null);
- if (pageSizeStr != null) {
- try {
- pageSize = Integer.parseInt(pageSizeStr);
- } catch (NumberFormatException nfe) {
- if (GlobalConfig.ASTERIX_LOGGER.isLoggable(Level.WARNING)) {
- GlobalConfig.ASTERIX_LOGGER.warning("Wrong buffer cache page size argument. "
- + "Using default value: " + pageSize);
- }
- }
- }
-
- if (GlobalConfig.ASTERIX_LOGGER.isLoggable(Level.INFO)) {
- GlobalConfig.ASTERIX_LOGGER.info("Buffer cache page size: " + pageSize);
- }
-
- return pageSize;
- }
-
- private int getBufferCacheNumPages() {
- int numPages = GlobalConfig.DEFAULT_BUFFER_CACHE_NUM_PAGES;
- String numPagesStr = System.getProperty(GlobalConfig.BUFFER_CACHE_NUM_PAGES_PROPERTY, null);
- if (numPagesStr != null) {
- try {
- numPages = Integer.parseInt(numPagesStr);
- } catch (NumberFormatException nfe) {
- if (GlobalConfig.ASTERIX_LOGGER.isLoggable(Level.WARNING)) {
- GlobalConfig.ASTERIX_LOGGER.warning("Wrong buffer cache size argument. " + "Using default value: "
- + numPages);
- }
- return numPages;
- }
- }
-
- if (GlobalConfig.ASTERIX_LOGGER.isLoggable(Level.INFO)) {
- GlobalConfig.ASTERIX_LOGGER.info("Buffer cache size (number of pages): " + numPages);
- }
-
- return numPages;
- }
-
public void deinitialize() throws HyracksDataException {
bufferCache.close();
for (IIndex index : indexLifecycleManager.getOpenIndexes()) {
@@ -216,4 +192,29 @@
public IIOManager getIOManager() {
return ioManager;
}
+
+ @Override
+ public AsterixStorageProperties getStorageProperties() {
+ return storageProperties;
+ }
+
+ @Override
+ public AsterixTransactionProperties getTransactionProperties() {
+ return txnProperties;
+ }
+
+ @Override
+ public AsterixCompilerProperties getCompilerProperties() {
+ return compilerProperties;
+ }
+
+ @Override
+ public AsterixMetadataProperties getMetadataProperties() {
+ return metadataProperties;
+ }
+
+ @Override
+ public AsterixExternalProperties getExternalProperties() {
+ return externalProperties;
+ }
}
\ No newline at end of file
diff --git a/asterix-installer/src/main/resources/conf/asterix-configuration.xml b/asterix-installer/src/main/resources/conf/asterix-configuration.xml
index 56a88ee..b6958c5 100644
--- a/asterix-installer/src/main/resources/conf/asterix-configuration.xml
+++ b/asterix-installer/src/main/resources/conf/asterix-configuration.xml
@@ -3,114 +3,188 @@
<property>
<name>nc.java.opts</name>
<value>-Xmx1024m</value>
- <description>JVM parameters for each Node Contoller (NC)</description>
+ <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>
+ <description>JVM parameters for each Cluster Contoller (CC)
+ </description>
</property>
<property>
- <name>size.memory.component</name>
- <value>512m</value>
- <description></description>
+ <name>storage.buffercache.pagesize</name>
+ <value>32768</value>
+ <description>The page size in bytes for pages in the buffer cache.
+ (Default = "32768" // 32KB)
+ </description>
</property>
<property>
- <name>total.size.memory.component</name>
- <value>512m</value>
- <description></description>
+ <name>storage.buffercache.numpages</name>
+ <value>1024</value>
+ <description>The number of pages allocated to the disk buffer cache.
+ (Default = "1024")
+ </description>
</property>
<property>
- <name>log.buffer.num.pages</name>
+ <name>storage.buffercache.maxopenfiles</name>
+ <value>214748364</value>
+ <description>The maximum number of open files in the buffer cache.
+ (Default = "214748364")
+ </description>
+ </property>
+
+ <property>
+ <name>storage.memorycomponent.pagesize</name>
+ <value>32768</value>
+ <description>The page size in bytes for pages allocated to memory
+ components. (Default = "32768" // 32KB)
+ </description>
+ </property>
+
+ <property>
+ <name>storage.memorycomponent.numpages</name>
+ <value>4096</value>
+ <description>The number of pages to allocate for a memory component.
+ (Default = 4096)
+ </description>
+ </property>
+
+ <property>
+ <name>storage.memorycomponent.globalbudget</name>
+ <value>1073741824</value>
+ <description>The total size of memory in bytes that the sum of all
+ open memory
+ components cannot exceed. (Default = "1073741824" // 1GB)
+ </description>
+ </property>
+
+ <property>
+ <name>storage.lsm.mergethreshold</name>
+ <value>3</value>
+ <description>The number of on-disk components an LSM index can have
+ before a merge is triggered. (Default = 3)
+ </description>
+ </property>
+
+ <property>
+ <name>storage.lsm.bloomfilter.falsepositiverate</name>
+ <value>0.01</value>
+ <description>The maximum acceptable false positive rate for bloom
+ filters associated with LSM indexes. (Default = "0.01" // 1%)
+ </description>
+ </property>
+
+ <property>
+ <name>txn.log.buffer.numpages</name>
<value>8</value>
- <description></description>
+ <description>The number of in-memory log buffer pages. (Default = "8")
+ </description>
</property>
<property>
- <name>group.commit.interval</name>
- <value>200ms</value>
- <description></description>
+ <name>txn.log.buffer.pagesize</name>
+ <value>131072</value>
+ <description>The size of pages in the in-memory log buffer. (Default =
+ "131072" // 128KB)
+ </description>
</property>
<property>
- <name>sort.op.memory</name>
- <value>200m</value>
- <description></description>
+ <name>txn.log.partitionsize</name>
+ <value>2147483648</value>
+ <description>The maximum size of a log file partition allowed before
+ rotating the log to the next partition. (Default = "2147483648" //
+ 2GB)
+ </description>
</property>
<property>
- <name>join.op.memory</name>
- <value>200m</value>
- <description></description>
+ <name>txn.log.groupcommitinterval</name>
+ <value>200</value>
+ <description>The group commit wait time in milliseconds. (Default =
+ "200" // 2ms)
+ </description>
</property>
<property>
- <name>web.interface.port</name>
+ <name>txn.log.checkpoint.lsnthreshold</name>
+ <value>67108864</value>
+ <description>The size of the window that the maximum LSN is allowed to
+ be ahead of the checkpoint LSN by. (Default = ""67108864" // 64M)
+ </description>
+ </property>
+
+ <property>
+ <name>txn.log.checkpoint.pollfrequency</name>
+ <value>120</value>
+ <description>The time in seconds between that the checkpoint thread
+ waits between polls. (Default = "120" // 120s)
+ </description>
+ </property>
+
+ <property>
+ <name>txn.lock.escalationthreshold</name>
+ <value>1000</value>
+ <description>The number of entity level locks that need to be acquired
+ before the locks are coalesced and escalated into a dataset level
+ lock. (Default = "1000")
+ </description>
+ </property>
+
+ <property>
+ <name>txn.lock.shrinktimer</name>
+ <value>120000</value>
+ <description>The time in milliseconds to wait before deallocating
+ unused lock manager memory. (Default = "120000" // 120s)
+ </description>
+ </property>
+
+ <property>
+ <name>compiler.sortmemory</name>
+ <value>536870912</value>
+ <description>The amount of memory in bytes given to sort operations.
+ (Default = "536870912" // 512mb)
+ </description>
+ </property>
+
+ <property>
+ <name>compiler.joinmemory</name>
+ <value>536870912</value>
+ <description>The amount of memory in bytes given to join operations.
+ (Default = "536870912" // 512mb)
+ </description>
+ </property>
+
+ <property>
+ <name>compiler.framesize</name>
+ <value>32768</value>
+ <description>The Hyracks frame size that the compiler configures per
+ job. (Default = "32768" // 32KB)
+ </description>
+ </property>
+
+ <property>
+ <name>web.port</name>
<value>19001</value>
- <description></description>
+ <description>The port for the ASTERIX web interface. (Default = 19001)
+ </description>
</property>
<property>
- <name>num.pages.buffer.cache</name>
- <value>8</value>
- <description></description>
+ <name>api.port</name>
+ <value>19101</value>
+ <description>The port for the ASTERIX API server. (Default = 19101)
+ </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>checkpoint.terms.in.secs</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>log.buffer.page.size</name>
- <value>128k</value>
- <description></description>
- </property>
-
- <property>
- <name>log.partition.size</name>
- <value>2147483648</value>
- <description></description>
- </property>
-
- <property>
- <name>shrink.timer.threshold</name>
- <value>120000</value>
- <description></description>
- </property>
-
- <property>
- <name>log.buffer.num.pages</name>
- <value>8</value>
- <description></description>
+ <description>The minimum log level to be displayed. (Default = INFO)
+ </description>
</property>
</asterixConfiguration>
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
index 994262d..09ec2f7 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataManager.java
@@ -20,11 +20,11 @@
import java.util.concurrent.locks.ReadWriteLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.functions.FunctionSignature;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.api.IMetadataManager;
import edu.uci.ics.asterix.metadata.api.IMetadataNode;
-import edu.uci.ics.asterix.metadata.bootstrap.MetadataConstants;
import edu.uci.ics.asterix.metadata.entities.Dataset;
import edu.uci.ics.asterix.metadata.entities.DatasourceAdapter;
import edu.uci.ics.asterix.metadata.entities.Datatype;
@@ -85,12 +85,14 @@
private IAsterixStateProxy proxy;
private IMetadataNode metadataNode;
private final ReadWriteLock metadataLatch;
+ private final AsterixMetadataProperties metadataProperties;
- public MetadataManager(IAsterixStateProxy proxy) {
+ public MetadataManager(IAsterixStateProxy proxy, AsterixMetadataProperties metadataProperties) {
if (proxy == null) {
throw new Error("Null proxy given to MetadataManager.");
}
this.proxy = proxy;
+ this.metadataProperties = metadataProperties;
this.metadataNode = null;
this.metadataLatch = new ReentrantReadWriteLock(true);
}
@@ -105,7 +107,7 @@
metadataNode = proxy.getMetadataNode();
if (metadataNode == null) {
throw new Error("Failed to get the MetadataNode.\n" + "The MetadataNode was configured to run on NC: "
- + proxy.getAsterixProperties().getMetadataNodeName());
+ + metadataProperties.getMetadataNodeName());
}
}
}
@@ -544,10 +546,10 @@
throw new MetadataException(e);
}
}
-
+
@Override
public int getMostRecentDatasetId() throws MetadataException {
- try {
+ try {
return metadataNode.getMostRecentDatasetId();
} catch (RemoteException e) {
throw new MetadataException(e);
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IAsterixStateProxy.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IAsterixStateProxy.java
index d67cd27..7f06c30 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IAsterixStateProxy.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/api/IAsterixStateProxy.java
@@ -19,17 +19,11 @@
import java.rmi.Remote;
import java.rmi.RemoteException;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
-
/**
* Interface for setting/getting distributed state of Asterix.
*/
public interface IAsterixStateProxy extends Remote, Serializable {
public void setMetadataNode(IMetadataNode metadataNode) throws RemoteException;
- public void setAsterixProperties(AsterixProperties asterixProperties) throws RemoteException;
-
public IMetadataNode getMetadataNode() throws RemoteException;
-
- public AsterixProperties getAsterixProperties() throws RemoteException;
}
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/AsterixStateProxy.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/AsterixStateProxy.java
index 55aaf33..33f6994 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/AsterixStateProxy.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/AsterixStateProxy.java
@@ -19,7 +19,6 @@
import java.rmi.server.UnicastRemoteObject;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
import edu.uci.ics.asterix.metadata.api.IAsterixStateProxy;
import edu.uci.ics.asterix.metadata.api.IMetadataNode;
@@ -31,7 +30,6 @@
private static final Logger LOGGER = Logger.getLogger(AsterixStateProxy.class.getName());
private IMetadataNode metadataNode;
- private AsterixProperties asterixProperties;
private static final IAsterixStateProxy cc = new AsterixStateProxy();
public static IAsterixStateProxy registerRemoteObject() throws RemoteException {
@@ -54,14 +52,4 @@
public IMetadataNode getMetadataNode() throws RemoteException {
return this.metadataNode;
}
-
- @Override
- public void setAsterixProperties(AsterixProperties asterixProperity) throws RemoteException {
- this.asterixProperties = asterixProperity;
- }
-
- @Override
- public AsterixProperties getAsterixProperties() throws RemoteException {
- return this.asterixProperties;
- }
}
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
index d978f8a..8d5d13b 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -20,16 +20,17 @@
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Set;
import java.util.logging.Level;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
-import edu.uci.ics.asterix.common.config.GlobalConfig;
+import edu.uci.ics.asterix.common.config.IAsterixPropertiesProvider;
import edu.uci.ics.asterix.common.context.AsterixAppRuntimeContext;
import edu.uci.ics.asterix.common.context.AsterixRuntimeComponentsProvider;
import edu.uci.ics.asterix.external.adapter.factory.IAdapterFactory;
@@ -110,12 +111,14 @@
private static String metadataNodeName;
private static String metadataStore;
- private static HashSet<String> nodeNames;
+ private static Set<String> nodeNames;
private static String outputDir;
private static IMetadataIndex[] primaryIndexes;
private static IMetadataIndex[] secondaryIndexes;
+ private static IAsterixPropertiesProvider propertiesProvider;
+
private static void initLocalIndexArrays() {
primaryIndexes = new IMetadataIndex[] { MetadataPrimaryIndexes.DATAVERSE_DATASET,
MetadataPrimaryIndexes.DATASET_DATASET, MetadataPrimaryIndexes.DATATYPE_DATASET,
@@ -127,9 +130,10 @@
MetadataSecondaryIndexes.DATATYPENAME_ON_DATATYPE_INDEX };
}
- public static void startUniverse(AsterixProperties asterixProperties, INCApplicationContext ncApplicationContext,
- boolean isNewUniverse) throws Exception {
+ public static void startUniverse(IAsterixPropertiesProvider asterixPropertiesProvider,
+ INCApplicationContext ncApplicationContext, boolean isNewUniverse) throws Exception {
runtimeContext = (AsterixAppRuntimeContext) ncApplicationContext.getApplicationObject();
+ propertiesProvider = asterixPropertiesProvider;
// Initialize static metadata objects, such as record types and metadata
// index descriptors.
@@ -149,9 +153,10 @@
resourceRepository.registerTransactionalResourceManager(ResourceType.LSM_INVERTED_INDEX,
new IndexResourceManager(ResourceType.LSM_INVERTED_INDEX, runtimeContext.getTransactionSubsystem()));
- metadataNodeName = asterixProperties.getMetadataNodeName();
- metadataStore = asterixProperties.getMetadataStore();
- nodeNames = asterixProperties.getNodeNames();
+ AsterixMetadataProperties metadataProperties = propertiesProvider.getMetadataProperties();
+ metadataNodeName = metadataProperties.getMetadataNodeName();
+ metadataStore = metadataProperties.getMetadataStore();
+ nodeNames = metadataProperties.getNodeNames();
// nodeStores = asterixProperity.getStores();
indexLifecycleManager = runtimeContext.getIndexLifecycleManager();
@@ -165,7 +170,7 @@
// Begin a transaction against the metadata.
// Lock the metadata in X mode.
MetadataManager.INSTANCE.lock(mdTxnCtx, LockMode.X);
-
+
if (isNewUniverse) {
for (int i = 0; i < primaryIndexes.length; i++) {
enlistMetadataDataset(primaryIndexes[i], true);
@@ -196,7 +201,7 @@
LOGGER.info("Finished enlistment of metadata B-trees.");
}
}
-
+
//#. initialize datasetIdFactory
MetadataManager.INSTANCE.initializeDatasetIdFactory(mdTxnCtx);
MetadataManager.INSTANCE.commitTransaction(mdTxnCtx);
@@ -327,7 +332,7 @@
adapterFactoryClassName, DatasourceAdapter.AdapterType.INTERNAL);
}
- public static void enlistMetadataDataset(IMetadataIndex index, boolean create) throws Exception {
+ private static void enlistMetadataDataset(IMetadataIndex index, boolean create) throws Exception {
String filePath = metadataStore + File.separator + index.getFileNameRelativePath();
FileReference file = new FileReference(new File(filePath));
IInMemoryBufferCache memBufferCache = new InMemoryBufferCache(new HeapBufferAllocator(), DEFAULT_MEM_PAGE_SIZE,
@@ -349,9 +354,10 @@
resourceID = runtimeContext.getResourceIdFactory().createId();
indexLifecycleManager.register(resourceID, lsmBtree);
+ AsterixStorageProperties storageProperties = propertiesProvider.getStorageProperties();
ILocalResourceMetadata localResourceMetadata = new LSMBTreeLocalResourceMetadata(typeTraits,
comparatorFactories, bloomFilterKeyFields, index.isPrimaryIndex(),
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES);
+ storageProperties.getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages());
ILocalResourceFactoryProvider localResourceFactoryProvider = new PersistentLocalResourceFactoryProvider(
localResourceMetadata, LocalResource.LSMBTreeResource);
ILocalResourceFactory localResourceFactory = localResourceFactoryProvider.getLocalResourceFactory();
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java
index 70383f9..f79b9b7 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlCompiledMetadataDeclarations.java
@@ -22,7 +22,8 @@
import java.util.logging.Logger;
import edu.uci.ics.asterix.common.annotations.TypeDataGen;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixMetadataProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.exceptions.AsterixException;
import edu.uci.ics.asterix.formats.base.IDataFormat;
@@ -73,8 +74,9 @@
this.dataverseName = dataverseName;
this.outputFile = outputFile;
this.config = config;
+ AsterixMetadataProperties metadataProperties = AsterixAppContextInfo.getInstance().getMetadataProperties();
if (stores == null && online) {
- this.stores = AsterixProperties.INSTANCE.getStores();
+ this.stores = metadataProperties.getStores();
} else {
this.stores = stores;
}
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
index 8bbddec..fa42aed 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/declared/AqlMetadataProvider.java
@@ -23,7 +23,8 @@
import java.util.Map;
import java.util.logging.Logger;
-import edu.uci.ics.asterix.common.config.AsterixProperties;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
+import edu.uci.ics.asterix.common.config.AsterixStorageProperties;
import edu.uci.ics.asterix.common.config.DatasetConfig.DatasetType;
import edu.uci.ics.asterix.common.config.DatasetConfig.IndexType;
import edu.uci.ics.asterix.common.config.GlobalConfig;
@@ -151,6 +152,8 @@
private final Dataverse defaultDataverse;
private JobId jobId;
+ private final AsterixStorageProperties storageProperties;
+
private static final Map<String, String> adapterFactoryMapping = initializeAdapterFactoryMapping();
public String getPropertyValue(String propertyName) {
@@ -171,7 +174,8 @@
public AqlMetadataProvider(Dataverse defaultDataverse) {
this.defaultDataverse = defaultDataverse;
- this.stores = AsterixProperties.INSTANCE.getStores();
+ this.stores = AsterixAppContextInfo.getInstance().getMetadataProperties().getStores();
+ this.storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
}
public void setJobId(JobId jobId) {
@@ -543,8 +547,8 @@
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
- retainInput, searchCallbackFactory);
+ storageProperties.getMemoryComponentPageSize(),
+ storageProperties.getMemoryComponentNumPages()), retainInput, searchCallbackFactory);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(btreeSearchOp, spPc.second);
} catch (MetadataException me) {
@@ -612,8 +616,8 @@
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER, proposeLinearizer(
nestedKeyType.getTypeTag(), comparatorFactories.length),
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
- retainInput, searchCallbackFactory);
+ storageProperties.getMemoryComponentPageSize(),
+ storageProperties.getMemoryComponentNumPages()), retainInput, searchCallbackFactory);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(rtreeSearchOp, spPc.second);
} catch (MetadataException me) {
@@ -772,8 +776,8 @@
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
- NoOpOperationCallbackFactory.INSTANCE);
+ storageProperties.getMemoryComponentPageSize(),
+ storageProperties.getMemoryComponentNumPages()), NoOpOperationCallbackFactory.INSTANCE);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(btreeBulkLoad,
splitsAndConstraint.second);
} catch (MetadataException me) {
@@ -839,9 +843,9 @@
new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES), null,
- modificationCallbackFactory);
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
+ null, modificationCallbackFactory);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(btreeBulkLoad,
splitsAndConstraint.second);
@@ -1035,8 +1039,8 @@
new LSMBTreeDataflowHelperFactory(AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
+ AsterixRuntimeComponentsProvider.LSMBTREE_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
filterFactory, modificationCallbackFactory);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(btreeBulkLoad,
splitsAndConstraint.second);
@@ -1161,8 +1165,8 @@
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
- AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER,
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
+ AsterixRuntimeComponentsProvider.LSMINVERTEDINDEX_PROVIDER, storageProperties
+ .getMemoryComponentPageSize(), storageProperties.getMemoryComponentNumPages()),
filterFactory, modificationCallbackFactory);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(insertDeleteOp,
splitsAndConstraint.second);
@@ -1257,8 +1261,8 @@
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER,
AsterixRuntimeComponentsProvider.LSMRTREE_PROVIDER, proposeLinearizer(
nestedKeyType.getTypeTag(), comparatorFactories.length),
- GlobalConfig.DEFAULT_INDEX_MEM_PAGE_SIZE, GlobalConfig.DEFAULT_INDEX_MEM_NUM_PAGES),
- filterFactory, modificationCallbackFactory);
+ storageProperties.getMemoryComponentPageSize(),
+ storageProperties.getMemoryComponentNumPages()), filterFactory, modificationCallbackFactory);
return new Pair<IOperatorDescriptor, AlgebricksPartitionConstraint>(rtreeUpdate, splitsAndConstraint.second);
} catch (MetadataException | IOException e) {
throw new AlgebricksException(e);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
index 2be7fbd1..bea62dc 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/functions/AsterixBuiltinFunctions.java
@@ -704,7 +704,7 @@
add(RECTANGLE_CONSTRUCTOR, OptionalARectangleTypeComputer.INSTANCE);
// add(RECORD_TYPE_CONSTRUCTOR, null);
add(SCALAR_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
- add(SCALAR_COUNT, ScalarVersionOfAggregateResultType.INSTANCE);
+ add(SCALAR_COUNT, AInt32TypeComputer.INSTANCE);
add(SCALAR_GLOBAL_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
add(SCALAR_LOCAL_AVG, ScalarVersionOfAggregateResultType.INSTANCE);
add(SCALAR_MAX, ScalarVersionOfAggregateResultType.INSTANCE);
diff --git a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java
index 76f3301..e280b2e 100644
--- a/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java
+++ b/asterix-om/src/main/java/edu/uci/ics/asterix/om/util/AsterixRuntimeUtil.java
@@ -23,7 +23,7 @@
import java.util.Map;
import java.util.Set;
-import edu.uci.ics.asterix.common.api.AsterixAppContextInfoImpl;
+import edu.uci.ics.asterix.common.api.AsterixAppContextInfo;
/**
* Utility class for obtaining information on the set of Hyracks NodeController
@@ -52,7 +52,7 @@
public static Map<String, Set<String>> getNodeControllerMap()
throws Exception {
Map<String, Set<String>> map = new HashMap<String, Set<String>>();
- AsterixAppContextInfoImpl.getInstance().getCCApplicationContext()
+ AsterixAppContextInfo.getInstance().getCCApplicationContext()
.getCCContext().getIPAddressNodeMap(map);
return map;
}
diff --git a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
index 20d70d6..8bc792c 100644
--- a/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
+++ b/asterix-runtime/src/main/java/edu/uci/ics/asterix/runtime/formats/NonTaggedDataFormat.java
@@ -35,6 +35,7 @@
import edu.uci.ics.asterix.om.functions.IFunctionDescriptor;
import edu.uci.ics.asterix.om.functions.IFunctionDescriptorFactory;
import edu.uci.ics.asterix.om.functions.IFunctionManager;
+import edu.uci.ics.asterix.om.pointables.base.DefaultOpenFieldType;
import edu.uci.ics.asterix.om.typecomputer.base.TypeComputerUtilities;
import edu.uci.ics.asterix.om.types.AOrderedListType;
import edu.uci.ics.asterix.om.types.ARecordType;
@@ -694,14 +695,20 @@
if (fd.getIdentifier().equals(AsterixBuiltinFunctions.CAST_RECORD)) {
AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
ARecordType rt = (ARecordType) TypeComputerUtilities.getRequiredType(funcExpr);
- ARecordType it = (ARecordType) context.getType(funcExpr.getArguments().get(0).getValue());
- ((CastRecordDescriptor) fd).reset(rt, it);
+ IAType it = (IAType) context.getType(funcExpr.getArguments().get(0).getValue());
+ if (it.getTypeTag().equals(ATypeTag.ANY)) {
+ it = DefaultOpenFieldType.NESTED_OPEN_RECORD_TYPE;
+ }
+ ((CastRecordDescriptor) fd).reset(rt, (ARecordType) it);
}
if (fd.getIdentifier().equals(AsterixBuiltinFunctions.CAST_LIST)) {
AbstractFunctionCallExpression funcExpr = (AbstractFunctionCallExpression) expr;
AbstractCollectionType rt = (AbstractCollectionType) TypeComputerUtilities.getRequiredType(funcExpr);
- AbstractCollectionType it = (AbstractCollectionType) context.getType(funcExpr.getArguments().get(0).getValue());
- ((CastListDescriptor) fd).reset(rt, it);
+ IAType it = (IAType) context.getType(funcExpr.getArguments().get(0).getValue());
+ if (it.getTypeTag().equals(ATypeTag.ANY)) {
+ it = DefaultOpenFieldType.NESTED_OPEN_AORDERED_LIST_TYPE;
+ }
+ ((CastListDescriptor) fd).reset(rt, (AbstractCollectionType) it);
}
if (fd.getIdentifier().equals(AsterixBuiltinFunctions.OPEN_RECORD_CONSTRUCTOR)) {
ARecordType rt = (ARecordType) context.getType(expr);