http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java index 4a3444e..deb2c72 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/common/TestExecutor.java @@ -123,7 +123,8 @@ public class TestExecutor { private static final Pattern HTTP_PARAM_PATTERN = Pattern.compile("param (\\w+)=(.*)", Pattern.MULTILINE); private static final Pattern HTTP_BODY_PATTERN = Pattern.compile("body=(.*)", Pattern.MULTILINE); private static final Pattern HTTP_STATUSCODE_PATTERN = Pattern.compile("statuscode (.*)", Pattern.MULTILINE); - private static final Pattern MAX_RESULT_READS_PATTERN = Pattern.compile("maxresultreads=(\\d+)(\\D|$)", Pattern.MULTILINE); + private static final Pattern MAX_RESULT_READS_PATTERN = + Pattern.compile("maxresultreads=(\\d+)(\\D|$)", Pattern.MULTILINE); public static final int TRUNCATE_THRESHOLD = 16384; public static final String DELIVERY_ASYNC = "async"; @@ -1003,7 +1004,7 @@ public class TestExecutor { ctx.extension(), cUnit.getOutputDir().getCompare()); break; case "server": // (start <test server name> <port> - // [<arg1>][<arg2>][<arg3>]...|stop (<port>|all)) + // [<arg1>][<arg2>][<arg3>]...|stop (<port>|all)) try { lines = statement.trim().split("\n"); String[] command = lines[lines.length - 1].trim().split(" "); @@ -1051,7 +1052,7 @@ public class TestExecutor { } break; case "lib": // expected format <dataverse-name> <library-name> - // <library-directory> + // <library-directory> // TODO: make this case work well with entity names containing spaces by // looking for \" lines = statement.split("\n");
http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/ComponentRollbackTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/ComponentRollbackTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/ComponentRollbackTest.java index fca0848..9828424 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/ComponentRollbackTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/ComponentRollbackTest.java @@ -90,8 +90,8 @@ public class ComponentRollbackTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, - GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = + { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -152,14 +152,14 @@ public class ComponentRollbackTest { List<List<String>> partitioningKeys = new ArrayList<>(); partitioningKeys.add(Collections.singletonList("key")); int partition = 0; - dataset = new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, NODE_GROUP_NAME, - NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, PartitioningStrategy.HASH, - partitioningKeys, null, null, null, false, null), + dataset = new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, + NODE_GROUP_NAME, NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, + PartitioningStrategy.HASH, partitioningKeys, null, null, null, false, null), null, DatasetType.INTERNAL, DATASET_ID, 0); PrimaryIndexInfo primaryIndexInfo = nc.createPrimaryIndex(dataset, KEY_TYPES, RECORD_TYPE, META_TYPE, null, storageManager, KEY_INDEXES, KEY_INDICATORS_LIST, partition); - IndexDataflowHelperFactory iHelperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), - primaryIndexInfo.getFileSplitProvider()); + IndexDataflowHelperFactory iHelperFactory = + new IndexDataflowHelperFactory(nc.getStorageManager(), primaryIndexInfo.getFileSplitProvider()); JobId jobId = nc.newJobId(); ctx = nc.createTestContext(jobId, partition, false); indexDataflowHelper = iHelperFactory.create(ctx.getJobletContext().getServiceContext(), partition); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/LogMarkerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/LogMarkerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/LogMarkerTest.java index 5e32a10..0a968c8 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/LogMarkerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/LogMarkerTest.java @@ -75,8 +75,8 @@ public class LogMarkerTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, - GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = + { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -150,10 +150,10 @@ public class LogMarkerTest { } insertOp.close(); nc.getTransactionManager().commitTransaction(txnCtx.getTxnId()); - IndexDataflowHelperFactory iHelperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), - indexInfo.getFileSplitProvider()); - IIndexDataflowHelper dataflowHelper = iHelperFactory.create(ctx.getJobletContext().getServiceContext(), - 0); + IndexDataflowHelperFactory iHelperFactory = + new IndexDataflowHelperFactory(nc.getStorageManager(), indexInfo.getFileSplitProvider()); + IIndexDataflowHelper dataflowHelper = + iHelperFactory.create(ctx.getJobletContext().getServiceContext(), 0); dataflowHelper.open(); LSMBTree btree = (LSMBTree) dataflowHelper.getIndexInstance(); LongPointable longPointable = LongPointable.FACTORY.createPointable(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java index 703eb85..b39a5c6 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/MultiPartitionLSMIndexTest.java @@ -86,8 +86,8 @@ public class MultiPartitionLSMIndexTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, - GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = + { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -104,8 +104,8 @@ public class MultiPartitionLSMIndexTest { private static final String DATA_TYPE_NAME = "DUMMY"; private static final String NODE_GROUP_NAME = "DEFAULT"; private static final IndexType INDEX_TYPE = IndexType.BTREE; - private static final List<List<String>> INDEX_FIELD_NAMES = Arrays - .asList(Arrays.asList(RECORD_TYPE.getFieldNames()[1])); + private static final List<List<String>> INDEX_FIELD_NAMES = + Arrays.asList(Arrays.asList(RECORD_TYPE.getFieldNames()[1])); private static final List<Integer> INDEX_FIELD_INDICATORS = Arrays.asList(Index.RECORD_INDICATOR); private static final List<IAType> INDEX_FIELD_TYPES = Arrays.asList(BuiltinType.AINT64); private static final StorageComponentProvider storageManager = new StorageComponentProvider(); @@ -147,9 +147,9 @@ public class MultiPartitionLSMIndexTest { public void createIndex() throws Exception { List<List<String>> partitioningKeys = new ArrayList<>(); partitioningKeys.add(Collections.singletonList("key")); - dataset = new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, NODE_GROUP_NAME, - NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, PartitioningStrategy.HASH, - partitioningKeys, null, null, null, false, null), + dataset = new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, + NODE_GROUP_NAME, NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, + PartitioningStrategy.HASH, partitioningKeys, null, null, null, false, null), null, DatasetType.INTERNAL, DATASET_ID, 0); secondaryIndex = new Index(DATAVERSE_NAME, DATASET_NAME, INDEX_NAME, INDEX_TYPE, INDEX_FIELD_NAMES, INDEX_FIELD_INDICATORS, INDEX_FIELD_TYPES, false, false, false, 0); @@ -167,18 +167,18 @@ public class MultiPartitionLSMIndexTest { taskCtxs[i] = nc.createTestContext(jobId, i, false); PrimaryIndexInfo primaryIndexInfo = nc.createPrimaryIndex(dataset, KEY_TYPES, RECORD_TYPE, META_TYPE, null, storageManager, KEY_INDEXES, KEY_INDICATORS_LIST, i); - SecondaryIndexInfo secondaryIndexInfo = nc.createSecondaryIndex(primaryIndexInfo, secondaryIndex, - storageManager, i); - IndexDataflowHelperFactory iHelperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), - primaryIndexInfo.getFileSplitProvider()); - primaryIndexDataflowHelpers[i] = iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), - i); + SecondaryIndexInfo secondaryIndexInfo = + nc.createSecondaryIndex(primaryIndexInfo, secondaryIndex, storageManager, i); + IndexDataflowHelperFactory iHelperFactory = + new IndexDataflowHelperFactory(nc.getStorageManager(), primaryIndexInfo.getFileSplitProvider()); + primaryIndexDataflowHelpers[i] = + iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), i); primaryIndexDataflowHelpers[i].open(); primaryLsmBtrees[i] = (TestLsmBtree) primaryIndexDataflowHelpers[i].getIndexInstance(); - iHelperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), - secondaryIndexInfo.getFileSplitProvider()); - secondaryIndexDataflowHelpers[i] = iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), - i); + iHelperFactory = + new IndexDataflowHelperFactory(nc.getStorageManager(), secondaryIndexInfo.getFileSplitProvider()); + secondaryIndexDataflowHelpers[i] = + iHelperFactory.create(taskCtxs[i].getJobletContext().getServiceContext(), i); secondaryIndexDataflowHelpers[i].open(); secondaryLsmBtrees[i] = (TestLsmBtree) secondaryIndexDataflowHelpers[i].getIndexInstance(); secondaryIndexDataflowHelpers[i].close(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/SearchCursorComponentSwitchTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/SearchCursorComponentSwitchTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/SearchCursorComponentSwitchTest.java index 652616a..7bc7a88 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/SearchCursorComponentSwitchTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dataflow/SearchCursorComponentSwitchTest.java @@ -121,11 +121,10 @@ public class SearchCursorComponentSwitchTest { public void createIndex() throws Exception { List<List<String>> partitioningKeys = new ArrayList<>(); partitioningKeys.add(Collections.singletonList("key")); - dataset = - new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, NODE_GROUP_NAME, - NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, PartitioningStrategy.HASH, - partitioningKeys, null, null, null, false, null), - null, DatasetType.INTERNAL, DATASET_ID, 0); + dataset = new TestDataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, + NODE_GROUP_NAME, NoMergePolicyFactory.NAME, null, new InternalDatasetDetails(null, + PartitioningStrategy.HASH, partitioningKeys, null, null, null, false, null), + null, DatasetType.INTERNAL, DATASET_ID, 0); PrimaryIndexInfo primaryIndexInfo = nc.createPrimaryIndex(dataset, KEY_TYPES, RECORD_TYPE, META_TYPE, null, storageManager, KEY_INDEXES, KEY_INDICATORS_LIST, 0); IndexDataflowHelperFactory iHelperFactory = http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/ddl/SecondaryBTreeOperationsHelperTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/ddl/SecondaryBTreeOperationsHelperTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/ddl/SecondaryBTreeOperationsHelperTest.java index dc8e228..0affaf2 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/ddl/SecondaryBTreeOperationsHelperTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/ddl/SecondaryBTreeOperationsHelperTest.java @@ -86,8 +86,8 @@ public class SecondaryBTreeOperationsHelperTest { // create a secondary primary index TestDataUtil.createPrimaryIndex(datasetName, primaryIndexName); - index = metadataProvider - .getIndex(MetadataBuiltinEntities.DEFAULT_DATAVERSE_NAME, datasetName, primaryIndexName); + index = metadataProvider.getIndex(MetadataBuiltinEntities.DEFAULT_DATAVERSE_NAME, datasetName, + primaryIndexName); Assert.assertNotNull(index); jobSpecification = IndexUtil.buildSecondaryIndexLoadingJobSpec(dataset, index, metadataProvider); jobSpecification.getOperatorMap().values().forEach(iOperatorDescriptor -> { @@ -96,8 +96,8 @@ public class SecondaryBTreeOperationsHelperTest { // create a normal BTree index TestDataUtil.createSecondaryBTreeIndex(datasetName, secondaryIndexName, SKFieldName); - index = metadataProvider - .getIndex(MetadataBuiltinEntities.DEFAULT_DATAVERSE_NAME, datasetName, secondaryIndexName); + index = metadataProvider.getIndex(MetadataBuiltinEntities.DEFAULT_DATAVERSE_NAME, datasetName, + secondaryIndexName); Assert.assertNotNull(index); jobSpecification = IndexUtil.buildSecondaryIndexLoadingJobSpec(dataset, index, metadataProvider); final long numOfSortOperators = jobSpecification.getOperatorMap().values().stream() http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java index facf03d1..3b636c6 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/dml/DmlTest.java @@ -41,8 +41,8 @@ public class DmlTest { private static final String[] ASTERIX_DATA_DIRS = new String[] { "nc1data", "nc2data" }; private static final String PATH_ACTUAL = "dmltest" + File.separator; private static final String SEPARATOR = File.separator; - private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "dmlts" - + SEPARATOR; + private static final String PATH_BASE = + "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "dmlts" + SEPARATOR; private static final String PATH_SCRIPTS = PATH_BASE + "scripts" + SEPARATOR; private static final String LOAD_FOR_ENLIST_FILE = PATH_SCRIPTS + "load-cust.aql"; @@ -60,12 +60,12 @@ public class DmlTest { outdir.mkdirs(); integrationUtil.init(true, AsterixHyracksIntegrationUtil.DEFAULT_CONF_FILE); - Reader loadReader = new BufferedReader( - new InputStreamReader(new FileInputStream(LOAD_FOR_ENLIST_FILE), "UTF-8")); - AsterixJavaClient asterixLoad = new AsterixJavaClient( - (ICcApplicationContext) integrationUtil.cc.getApplicationContext(), - integrationUtil.getHyracksClientConnection(), loadReader, ERR, new AqlCompilationProvider(), - new DefaultStatementExecutorFactory(), new StorageComponentProvider()); + Reader loadReader = + new BufferedReader(new InputStreamReader(new FileInputStream(LOAD_FOR_ENLIST_FILE), "UTF-8")); + AsterixJavaClient asterixLoad = + new AsterixJavaClient((ICcApplicationContext) integrationUtil.cc.getApplicationContext(), + integrationUtil.getHyracksClientConnection(), loadReader, ERR, new AqlCompilationProvider(), + new DefaultStatementExecutorFactory(), new StorageComponentProvider()); try { asterixLoad.compile(true, false, false, false, false, true, false); } catch (AsterixException e) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java index 7965afb..e7b6271 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/jsonplan/JsonLogicalPlanTest.java @@ -1 +1,235 @@ -/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY * KIND, either express or implied. See the License for the * specific language governing permissions and limitations * under the License. */ package org.apache.asterix.test.jsonplan; import java.io.BufferedReader; import java.io.File; import java.io.FileInputStream; import java.io.InputStreamReader; import java.io.PrintWriter; import java.io.Reader; import java.util.ArrayList; import java.util.Collection; import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil; import org.apache.asterix.api.java.AsterixJavaClient; import org.apache.asterix.app.translator.DefaultStatementExecutorFactory; import org.apache.asterix.common.config.GlobalConfig; import org.apache.asterix.common.context.IStorageComponentProvider; import org.apache.asterix.common.dataflow.ICcApplicationContext; import org.apache.asterix.common.exceptions.AsterixException; import org.apache.asterix.compiler.provider.AqlCompilationProvider; import org.apache.asterix.compiler.provider.ILangCompilationProvider; import org.apache.asterix.compiler.provider.SqlppCompilationProvider; import org.apache.asterix.external.util.ExternalDataConstants; import org.apache.asterix.external.util.IdentitiyResolverFactory; import org.apache.asterix.file.StorageComponentProvider; import org.apache.asterix.test.base.AsterixTestHelper; import org.apache.ast erix.test.common.TestHelper; import org.apache.asterix.test.runtime.HDFSCluster; import org.apache.asterix.translator.IStatementExecutorFactory; import org.apache.asterix.translator.SessionConfig.PlanFormat; import org.apache.hyracks.api.client.IHyracksClientConnection; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.AfterClass; import org.junit.Assume; import org.junit.BeforeClass; import org.junit.Test; import org.junit.internal.AssumptionViolatedException; import org.junit.runner.RunWith; import org.junit.runners.Parameterized; import org.junit.runners.Parameterized.Parameters; import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.ObjectMapper; @RunWith(Parameterized.class) public class JsonLogicalPlanTest { private static final Logger LOGGER = LogManager.getLogger(); protected static final String SEPARATOR = File.separator; private static final String EXTENSION_AQL = "aql"; pri vate static final String EXTENSION_SQLPP = "sqlpp"; private static final String EXTENSION_RESULT = "plan"; private static final String FILENAME_IGNORE = "ignore.txt"; private static final String FILENAME_ONLY = "only.txt"; private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "optimizerts" + SEPARATOR; private static final String PATH_QUERIES = PATH_BASE + "queries" + SEPARATOR; protected static String PATH_ACTUAL = "target" + File.separator + "jplantest" + SEPARATOR; protected static boolean optimized = false; private static final ArrayList<String> ignore = AsterixTestHelper.readTestListFile(FILENAME_IGNORE, PATH_BASE); private static final ArrayList<String> only = AsterixTestHelper.readTestListFile(FILENAME_ONLY, PATH_BASE); protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final ILangCompilationProvider aqlCompilationProvid er = new AqlCompilationProvider(); private static final ILangCompilationProvider sqlppCompilationProvider = new SqlppCompilationProvider(); protected static ILangCompilationProvider extensionLangCompilationProvider = null; protected static IStatementExecutorFactory statementExecutorFactory = new DefaultStatementExecutorFactory(); protected static IStorageComponentProvider storageComponentProvider = new StorageComponentProvider(); protected static AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); @BeforeClass public static void setUp() throws Exception { System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); final File outdir = new File(PATH_ACTUAL); outdir.mkdirs(); HDFSCluster.getInstance().setup(); integrationUtil.init(true, TEST_CONFIG_FILE_NAME); // Set the node resolver to be the identity resolver that expects node names // to be node controller ids; a valid assumption in test environment. System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY, IdentitiyResolverFactory.class.getName()); } @AfterClass public static void tearDown() throws Exception { File outdir = new File(PATH_ACTUAL); File[] files = outdir.listFiles(); if (files == null || files.length == 0) { outdir.delete(); } HDFSCluster.getInstance().cleanup(); integrationUtil.deinit(true); } private static void suiteBuildPerFile(File file, Collection<Object[]> testArgs, String path) { if (file.isDirectory() && !file.getName().startsWith(".")) { for (File innerfile : file.listFiles()) { String subdir = innerfile.isDirectory() ? path + innerfile.getName() + SEPARATOR : path; suiteBuildPerFile(innerfile, testArgs, subdir); } } if (file.isFile() && (file.getNa me().endsWith(EXTENSION_AQL) || file.getName().endsWith(EXTENSION_SQLPP))) { String resultFileName = AsterixTestHelper.extToResExt(file.getName(), EXTENSION_RESULT); File actualFile = new File(PATH_ACTUAL + SEPARATOR + path + resultFileName); testArgs.add(new Object[] { file, actualFile }); } } @Parameters(name = "JsonLogicalPlanTest {index}: {0}") public static Collection<Object[]> tests() { Collection<Object[]> testArgs = new ArrayList<>(); if (only.isEmpty()) { suiteBuildPerFile(new File(PATH_QUERIES), testArgs, ""); } else { for (String path : only) { suiteBuildPerFile(new File(PATH_QUERIES + path), testArgs, path.lastIndexOf(SEPARATOR) < 0 ? "" : path.substring(0, path.lastIndexOf(SEPARATOR) + 1)); } } return testArgs; } private final File actualFile; private final File queryFile; public Js onLogicalPlanTest(final File queryFile, final File actualFile) { this.queryFile = queryFile; this.actualFile = actualFile; } @Test public void test() throws Exception { try { String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), '/'); if (!only.isEmpty()) { boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); if (!toRun) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" \"only.txt\" not empty and not in \"only.txt\"."); } Assume.assumeTrue(toRun); } boolean skipped = TestHelper.isInPrefixList(ignore, queryFileShort); if (skipped) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" in \"ignore.txt\"."); } Assume.assumeTrue(!skipped); LOGGER.info("RUN TEST: \"" + queryFile.getPath() + "\""); Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8")); // Forces the creation of actualFile. actualFile.getParentFile().mkdirs(); PrintWriter plan = new PrintWriter(actualFile); ILangCompilationProvider provider = queryFile.getName().endsWith("aql") ? aqlCompilationProvider : sqlppCompilationProvider; if (extensionLangCompilationProvider != null) { provider = extensionLangCompilationProvider; } IHyracksClientConnection hcc = integrationUtil.getHyracksClientConnection(); AsterixJavaClient asterix = new AsterixJavaClient( (ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, query, plan, provider, statementExecutorFactory, storageComponentProvider); try { asterix.compile(true, false, !optimized, optimized, false, false, false, PlanFormat.JSON); } catch (AsterixException e) { plan.close(); query.close(); throw new Exception("Compile ERROR for " + queryFile + ": " + e.getMessage(), e); } plan.close(); query.close(); BufferedReader readerActual = new BufferedReader( new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); String lineActual, objectActual = ""; boolean firstPlan = false; while ((lineActual = readerActual.readLine()) != null) { if (lineActual.contains("--")) { if (firstPlan) { break; } firstPlan = true; } else { objectActual = objectActual + lineActual; } } try { final JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(objectActual); while (parser.nextToken() != null) { } } finally { readerActual.close(); } } catch (Exception e) { if (!(e instanceof AssumptionViolatedException)) { LOGGER.error("Test \"" + queryFile.getPath() + "\" FAILED!"); throw new Exception("Test \"" + queryFile.getPath() + "\" FAILED!", e); } else { throw e; } } } } \ No newline at end of file +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package org.apache.asterix.test.jsonplan; + +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.InputStreamReader; +import java.io.PrintWriter; +import java.io.Reader; +import java.util.ArrayList; +import java.util.Collection; + +import org.apache.asterix.api.common.AsterixHyracksIntegrationUtil; +import org.apache.asterix.api.java.AsterixJavaClient; +import org.apache.asterix.app.translator.DefaultStatementExecutorFactory; +import org.apache.asterix.common.config.GlobalConfig; +import org.apache.asterix.common.context.IStorageComponentProvider; +import org.apache.asterix.common.dataflow.ICcApplicationContext; +import org.apache.asterix.common.exceptions.AsterixException; +import org.apache.asterix.compiler.provider.AqlCompilationProvider; +import org.apache.asterix.compiler.provider.ILangCompilationProvider; +import org.apache.asterix.compiler.provider.SqlppCompilationProvider; +import org.apache.asterix.external.util.ExternalDataConstants; +import org.apache.asterix.external.util.IdentitiyResolverFactory; +import org.apache.asterix.file.StorageComponentProvider; +import org.apache.asterix.test.base.AsterixTestHelper; +import org.apache.asterix.test.common.TestHelper; +import org.apache.asterix.test.runtime.HDFSCluster; +import org.apache.asterix.translator.IStatementExecutorFactory; +import org.apache.asterix.translator.SessionConfig.PlanFormat; +import org.apache.hyracks.api.client.IHyracksClientConnection; +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.BeforeClass; +import org.junit.Test; +import org.junit.internal.AssumptionViolatedException; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; +import org.junit.runners.Parameterized.Parameters; + +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.ObjectMapper; + +@RunWith(Parameterized.class) +public class JsonLogicalPlanTest { + + private static final Logger LOGGER = LogManager.getLogger(); + + protected static final String SEPARATOR = File.separator; + private static final String EXTENSION_AQL = "aql"; + private static final String EXTENSION_SQLPP = "sqlpp"; + private static final String EXTENSION_RESULT = "plan"; + private static final String FILENAME_IGNORE = "ignore.txt"; + private static final String FILENAME_ONLY = "only.txt"; + private static final String PATH_BASE = + "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "optimizerts" + SEPARATOR; + private static final String PATH_QUERIES = PATH_BASE + "queries" + SEPARATOR; + protected static String PATH_ACTUAL = "target" + File.separator + "jplantest" + SEPARATOR; + protected static boolean optimized = false; + + private static final ArrayList<String> ignore = AsterixTestHelper.readTestListFile(FILENAME_IGNORE, PATH_BASE); + private static final ArrayList<String> only = AsterixTestHelper.readTestListFile(FILENAME_ONLY, PATH_BASE); + protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; + private static final ILangCompilationProvider aqlCompilationProvider = new AqlCompilationProvider(); + private static final ILangCompilationProvider sqlppCompilationProvider = new SqlppCompilationProvider(); + protected static ILangCompilationProvider extensionLangCompilationProvider = null; + protected static IStatementExecutorFactory statementExecutorFactory = new DefaultStatementExecutorFactory(); + protected static IStorageComponentProvider storageComponentProvider = new StorageComponentProvider(); + + protected static AsterixHyracksIntegrationUtil integrationUtil = new AsterixHyracksIntegrationUtil(); + + @BeforeClass + public static void setUp() throws Exception { + System.setProperty(GlobalConfig.CONFIG_FILE_PROPERTY, TEST_CONFIG_FILE_NAME); + final File outdir = new File(PATH_ACTUAL); + outdir.mkdirs(); + + HDFSCluster.getInstance().setup(); + + integrationUtil.init(true, TEST_CONFIG_FILE_NAME); + // Set the node resolver to be the identity resolver that expects node names + // to be node controller ids; a valid assumption in test environment. + System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY, + IdentitiyResolverFactory.class.getName()); + } + + @AfterClass + public static void tearDown() throws Exception { + File outdir = new File(PATH_ACTUAL); + File[] files = outdir.listFiles(); + if (files == null || files.length == 0) { + outdir.delete(); + } + + HDFSCluster.getInstance().cleanup(); + + integrationUtil.deinit(true); + } + + private static void suiteBuildPerFile(File file, Collection<Object[]> testArgs, String path) { + if (file.isDirectory() && !file.getName().startsWith(".")) { + for (File innerfile : file.listFiles()) { + String subdir = innerfile.isDirectory() ? path + innerfile.getName() + SEPARATOR : path; + suiteBuildPerFile(innerfile, testArgs, subdir); + } + } + if (file.isFile() && (file.getName().endsWith(EXTENSION_AQL) || file.getName().endsWith(EXTENSION_SQLPP))) { + String resultFileName = AsterixTestHelper.extToResExt(file.getName(), EXTENSION_RESULT); + File actualFile = new File(PATH_ACTUAL + SEPARATOR + path + resultFileName); + testArgs.add(new Object[] { file, actualFile }); + } + } + + @Parameters(name = "JsonLogicalPlanTest {index}: {0}") + public static Collection<Object[]> tests() { + Collection<Object[]> testArgs = new ArrayList<>(); + if (only.isEmpty()) { + suiteBuildPerFile(new File(PATH_QUERIES), testArgs, ""); + } else { + for (String path : only) { + suiteBuildPerFile(new File(PATH_QUERIES + path), testArgs, + path.lastIndexOf(SEPARATOR) < 0 ? "" : path.substring(0, path.lastIndexOf(SEPARATOR) + 1)); + } + } + return testArgs; + } + + private final File actualFile; + private final File queryFile; + + public JsonLogicalPlanTest(final File queryFile, final File actualFile) { + this.queryFile = queryFile; + this.actualFile = actualFile; + } + + @Test + public void test() throws Exception { + try { + String queryFileShort = + queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), '/'); + if (!only.isEmpty()) { + boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); + if (!toRun) { + LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + + "\" \"only.txt\" not empty and not in \"only.txt\"."); + } + Assume.assumeTrue(toRun); + } + boolean skipped = TestHelper.isInPrefixList(ignore, queryFileShort); + if (skipped) { + LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" in \"ignore.txt\"."); + } + Assume.assumeTrue(!skipped); + + LOGGER.info("RUN TEST: \"" + queryFile.getPath() + "\""); + Reader query = new BufferedReader(new InputStreamReader(new FileInputStream(queryFile), "UTF-8")); + + // Forces the creation of actualFile. + actualFile.getParentFile().mkdirs(); + + PrintWriter plan = new PrintWriter(actualFile); + ILangCompilationProvider provider = + queryFile.getName().endsWith("aql") ? aqlCompilationProvider : sqlppCompilationProvider; + if (extensionLangCompilationProvider != null) { + provider = extensionLangCompilationProvider; + } + IHyracksClientConnection hcc = integrationUtil.getHyracksClientConnection(); + AsterixJavaClient asterix = + new AsterixJavaClient((ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, + query, plan, provider, statementExecutorFactory, storageComponentProvider); + try { + asterix.compile(true, false, !optimized, optimized, false, false, false, PlanFormat.JSON); + + } catch (AsterixException e) { + plan.close(); + query.close(); + throw new Exception("Compile ERROR for " + queryFile + ": " + e.getMessage(), e); + } + plan.close(); + query.close(); + + BufferedReader readerActual = + new BufferedReader(new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); + String lineActual, objectActual = ""; + boolean firstPlan = false; + while ((lineActual = readerActual.readLine()) != null) { + if (lineActual.contains("--")) { + if (firstPlan) { + break; + } + firstPlan = true; + + } else { + objectActual = objectActual + lineActual; + } + } + + try { + final JsonParser parser = new ObjectMapper().getJsonFactory().createJsonParser(objectActual); + while (parser.nextToken() != null) { + } + } finally { + readerActual.close(); + } + + } catch (Exception e) { + if (!(e instanceof AssumptionViolatedException)) { + LOGGER.error("Test \"" + queryFile.getPath() + "\" FAILED!"); + throw new Exception("Test \"" + queryFile.getPath() + "\" FAILED!", e); + } else { + throw e; + } + } + } +} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java index f635d6f..8a2bc1d 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/logging/CheckpointingTest.java @@ -74,8 +74,8 @@ public class CheckpointingTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, - GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = + { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -217,8 +217,8 @@ public class CheckpointingTest { nc.init(); try { final ITransactionSubsystem txnSubsystem = nc.getTransactionSubsystem(); - final AbstractCheckpointManager checkpointManager = (AbstractCheckpointManager) txnSubsystem - .getCheckpointManager(); + final AbstractCheckpointManager checkpointManager = + (AbstractCheckpointManager) txnSubsystem.getCheckpointManager(); // Make a checkpoint with the current minFirstLSN final long minFirstLSN = txnSubsystem.getRecoveryManager().getMinFirstLSN(); checkpointManager.tryCheckpoint(minFirstLSN); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java index 0cd9473..0e8b4a9 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTest.java @@ -43,8 +43,8 @@ public class MetadataTest { private TestCaseContext tcCtx; private static final String PATH_ACTUAL = "target" + File.separator + "mdtest" + File.separator; - private static final String PATH_BASE = StringUtils - .join(new String[] { "src", "test", "resources", "metadata" + File.separator }, File.separator); + private static final String PATH_BASE = + StringUtils.join(new String[] { "src", "test", "resources", "metadata" + File.separator }, File.separator); protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf"; private static final TestExecutor testExecutor = new TestExecutor(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java index decee99..a10c234 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/metadata/MetadataTxnTest.java @@ -67,8 +67,8 @@ public class MetadataTxnTest { @Test public void abortMetadataTxn() throws Exception { - ICcApplicationContext appCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService() - .getApplicationContext(); + ICcApplicationContext appCtx = + (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); final MetadataProvider metadataProvider = new MetadataProvider(appCtx, null); final MetadataTransactionContext mdTxn = MetadataManager.INSTANCE.beginTransaction(); metadataProvider.setMetadataTxnContext(mdTxn); @@ -95,8 +95,8 @@ public class MetadataTxnTest { @Test public void rebalanceFailureMetadataTxn() throws Exception { - ICcApplicationContext appCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService() - .getApplicationContext(); + ICcApplicationContext appCtx = + (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); String nodeGroup = "ng"; String datasetName = "dataset1"; final TestCaseContext.OutputFormat format = TestCaseContext.OutputFormat.CLEAN_JSON; @@ -155,8 +155,8 @@ public class MetadataTxnTest { testExecutor.executeSqlppUpdateOrDdl("CREATE DATASET " + datasetName + "(KeyType) PRIMARY KEY id;", format); // get created dataset - ICcApplicationContext appCtx = (ICcApplicationContext) integrationUtil.getClusterControllerService() - .getApplicationContext(); + ICcApplicationContext appCtx = + (ICcApplicationContext) integrationUtil.getClusterControllerService().getApplicationContext(); MetadataProvider metadataProvider = new MetadataProvider(appCtx, null); final MetadataTransactionContext mdTxnCtx = MetadataManager.INSTANCE.beginTransaction(); metadataProvider.setMetadataTxnContext(mdTxnCtx); @@ -199,8 +199,8 @@ public class MetadataTxnTest { Assert.assertEquals(0, failCount.get()); // make sure all metadata indexes have no pending operations after all txns committed/aborted - final IDatasetLifecycleManager datasetLifecycleManager = ((INcApplicationContext) integrationUtil.ncs[0] - .getApplicationContext()).getDatasetLifecycleManager(); + final IDatasetLifecycleManager datasetLifecycleManager = + ((INcApplicationContext) integrationUtil.ncs[0].getApplicationContext()).getDatasetLifecycleManager(); int maxMetadatasetId = 14; for (int i = 1; i <= maxMetadatasetId; i++) { if (datasetLifecycleManager.getIndex(i, i) != null) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java index 8b228bd..3fd59a4 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/optimizer/OptimizerTest.java @@ -67,8 +67,8 @@ public class OptimizerTest { private static final String EXTENSION_RESULT = "plan"; private static final String FILENAME_IGNORE = "ignore.txt"; private static final String FILENAME_ONLY = "only.txt"; - private static final String PATH_BASE = "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR - + "optimizerts" + SEPARATOR; + private static final String PATH_BASE = + "src" + SEPARATOR + "test" + SEPARATOR + "resources" + SEPARATOR + "optimizerts" + SEPARATOR; private static final String PATH_QUERIES = PATH_BASE + "queries" + SEPARATOR; private static final String PATH_EXPECTED = PATH_BASE + "results" + SEPARATOR; protected static final String PATH_ACTUAL = "target" + File.separator + "opttest" + SEPARATOR; @@ -153,10 +153,10 @@ public class OptimizerTest { @Test public void test() throws Exception { try { - String queryFileShort = queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), - '/'); + String queryFileShort = + queryFile.getPath().substring(PATH_QUERIES.length()).replace(SEPARATOR.charAt(0), '/'); if (!only.isEmpty()) { - boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); + boolean toRun = TestHelper.isInPrefixList(only, queryFileShort); if (!toRun) { LOGGER.info("SKIP TEST: \"" + queryFile.getPath() + "\" \"only.txt\" not empty and not in \"only.txt\"."); @@ -178,15 +178,15 @@ public class OptimizerTest { actualFile.getParentFile().mkdirs(); PrintWriter plan = new PrintWriter(actualFile); - ILangCompilationProvider provider = queryFile.getName().endsWith("aql") ? aqlCompilationProvider - : sqlppCompilationProvider; + ILangCompilationProvider provider = + queryFile.getName().endsWith("aql") ? aqlCompilationProvider : sqlppCompilationProvider; if (extensionLangCompilationProvider != null) { provider = extensionLangCompilationProvider; } IHyracksClientConnection hcc = integrationUtil.getHyracksClientConnection(); - AsterixJavaClient asterix = new AsterixJavaClient( - (ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, query, plan, provider, - statementExecutorFactory, storageComponentProvider); + AsterixJavaClient asterix = + new AsterixJavaClient((ICcApplicationContext) integrationUtil.cc.getApplicationContext(), hcc, + query, plan, provider, statementExecutorFactory, storageComponentProvider); try { asterix.compile(true, false, false, true, true, false, false); } catch (AlgebricksException e) { @@ -197,10 +197,10 @@ public class OptimizerTest { plan.close(); query.close(); - BufferedReader readerExpected = new BufferedReader( - new InputStreamReader(new FileInputStream(expectedFile), "UTF-8")); - BufferedReader readerActual = new BufferedReader( - new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); + BufferedReader readerExpected = + new BufferedReader(new InputStreamReader(new FileInputStream(expectedFile), "UTF-8")); + BufferedReader readerActual = + new BufferedReader(new InputStreamReader(new FileInputStream(actualFile), "UTF-8")); String lineExpected, lineActual; int num = 1; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java index 8deb827..9da0e66 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/LangExecutionUtil.java @@ -49,8 +49,8 @@ import org.apache.hyracks.util.ThreadDumpUtil; public class LangExecutionUtil { private static final String PATH_ACTUAL = "target" + File.separator + "rttest" + File.separator; - private static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, - File.separator); + private static final String PATH_BASE = + StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, File.separator); private static final boolean cleanupOnStart = true; private static final boolean cleanupOnStop = true; @@ -214,8 +214,8 @@ public class LangExecutionUtil { String processId = processName.split("@")[0]; // Checks whether there are leaked run files from operators. - Process process = Runtime.getRuntime() - .exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf|wc -l" }); + Process process = + Runtime.getRuntime().exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf|wc -l" }); try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { int runFileCount = Integer.parseInt(reader.readLine().trim()); if (runFileCount != 0) { @@ -231,8 +231,8 @@ public class LangExecutionUtil { } private static void outputLeakedOpenFiles(String processId) throws IOException { - Process process = Runtime.getRuntime() - .exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf" }); + Process process = + Runtime.getRuntime().exec(new String[] { "bash", "-c", "lsof -p " + processId + "|grep waf" }); try (BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream()))) { String line; while ((line = reader.readLine()) != null) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java index d54d448..cbca8dc 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/runtime/ReplicationExecutionTest.java @@ -60,7 +60,8 @@ public class ReplicationExecutionTest { final String nodeId = nc.getId(); final INcApplicationContext appCtx = (INcApplicationContext) nc.getApplicationContext(); int apiPort = appCtx.getExternalProperties().getNcApiPort(); - int replicationPort = (int) appCtx.getServiceContext().getAppConfig().get(NCConfig.Option.REPLICATION_LISTEN_PORT); + int replicationPort = + (int) appCtx.getServiceContext().getAppConfig().get(NCConfig.Option.REPLICATION_LISTEN_PORT); ncEndPoints.put(nodeId, InetSocketAddress.createUnresolved(ip, apiPort)); replicationAddress.put(nodeId, InetSocketAddress.createUnresolved(ip, replicationPort)); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java index 054da38..2088903 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/sqlpp/RuntimeParserTest.java @@ -44,8 +44,8 @@ public class RuntimeParserTest { protected static final Logger LOGGER = LogManager.getLogger(); protected static final String PATH_ACTUAL = "target" + File.separator + "runtime_parserts" + File.separator; - protected static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, - File.separator); + protected static final String PATH_BASE = + StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, File.separator); private final TestExecutor testExecutor = new ParserTestExecutor(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java index c813c43..8897169 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/DiskIsFullTest.java @@ -63,8 +63,8 @@ public class DiskIsFullTest { private static final IAType[] KEY_TYPES = { BuiltinType.AINT32 }; private static final ARecordType RECORD_TYPE = new ARecordType("TestRecordType", new String[] { "key", "value" }, new IAType[] { BuiltinType.AINT32, BuiltinType.AINT64 }, false); - private static final GenerationFunction[] RECORD_GEN_FUNCTION = { GenerationFunction.DETERMINISTIC, - GenerationFunction.DETERMINISTIC }; + private static final GenerationFunction[] RECORD_GEN_FUNCTION = + { GenerationFunction.DETERMINISTIC, GenerationFunction.DETERMINISTIC }; private static final boolean[] UNIQUE_RECORD_FIELDS = { true, false }; private static final ARecordType META_TYPE = null; private static final GenerationFunction[] META_GEN_FUNCTION = null; @@ -111,8 +111,8 @@ public class DiskIsFullTest { if (!shouldRun) { return; } - HyracksDataException expectedException = HyracksDataException - .create(ErrorCode.CANNOT_MODIFY_INDEX_DISK_IS_FULL); + HyracksDataException expectedException = + HyracksDataException.create(ErrorCode.CANNOT_MODIFY_INDEX_DISK_IS_FULL); try { TestNodeController nc = new TestNodeController(null, false); nc.init(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java index 31cc77a..31a6004 100644 --- a/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java +++ b/asterixdb/asterix-app/src/test/java/org/apache/asterix/test/storage/IndexDropOperatorNodePushableTest.java @@ -104,15 +104,15 @@ public class IndexDropOperatorNodePushableTest { List<List<String>> partitioningKeys = new ArrayList<>(); partitioningKeys.add(Collections.singletonList("key")); Dataset dataset = new Dataset(DATAVERSE_NAME, DATASET_NAME, DATAVERSE_NAME, DATA_TYPE_NAME, NODE_GROUP_NAME, - NoMergePolicyFactory.NAME, null, - new InternalDatasetDetails(null, InternalDatasetDetails.PartitioningStrategy.HASH, partitioningKeys, - null, null, null, false, null), + NoMergePolicyFactory.NAME, + null, new InternalDatasetDetails(null, InternalDatasetDetails.PartitioningStrategy.HASH, + partitioningKeys, null, null, null, false, null), null, DatasetConfig.DatasetType.INTERNAL, DATASET_ID, 0); // create dataset TestNodeController.PrimaryIndexInfo indexInfo = nc.createPrimaryIndex(dataset, KEY_TYPES, RECORD_TYPE, META_TYPE, null, storageManager, KEY_INDEXES, KEY_INDICATORS_LIST, 0); - IndexDataflowHelperFactory helperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), - indexInfo.getFileSplitProvider()); + IndexDataflowHelperFactory helperFactory = + new IndexDataflowHelperFactory(nc.getStorageManager(), indexInfo.getFileSplitProvider()); JobId jobId = nc.newJobId(); IHyracksTaskContext ctx = nc.createTestContext(jobId, 0, true); IIndexDataflowHelper dataflowHelper = helperFactory.create(ctx.getJobletContext().getServiceContext(), 0); @@ -153,10 +153,10 @@ public class IndexDropOperatorNodePushableTest { MetadataManager.INSTANCE.commitTransaction(mdTxn); FileSplit[] splits = SplitsAndConstraintsUtil.getIndexSplits(appCtx.getClusterStateManager(), dataset, indexName, Arrays.asList("asterix_nc1")); - final ConstantFileSplitProvider constantFileSplitProvider = new ConstantFileSplitProvider( - Arrays.copyOfRange(splits, 0, 1)); - IndexDataflowHelperFactory helperFactory = new IndexDataflowHelperFactory(nc.getStorageManager(), - constantFileSplitProvider); + final ConstantFileSplitProvider constantFileSplitProvider = + new ConstantFileSplitProvider(Arrays.copyOfRange(splits, 0, 1)); + IndexDataflowHelperFactory helperFactory = + new IndexDataflowHelperFactory(nc.getStorageManager(), constantFileSplitProvider); JobId jobId = nc.newJobId(); IHyracksTaskContext ctx = nc.createTestContext(jobId, 0, true); IIndexDataflowHelper dataflowHelper = helperFactory.create(ctx.getJobletContext().getServiceContext(), 0); @@ -172,8 +172,8 @@ public class IndexDropOperatorNodePushableTest { // open the index to make it in-use dataflowHelper.open(); // try to drop in-use index (should fail) - IndexDropOperatorNodePushable dropInUseOp = new IndexDropOperatorNodePushable(helperFactory, - EnumSet.noneOf(DropOption.class), ctx, 0); + IndexDropOperatorNodePushable dropInUseOp = + new IndexDropOperatorNodePushable(helperFactory, EnumSet.noneOf(DropOption.class), ctx, 0); try { dropInUseOp.initialize(); } catch (HyracksDataException e) { @@ -212,8 +212,8 @@ public class IndexDropOperatorNodePushableTest { private void dropNonExisting(IHyracksTaskContext ctx, IndexDataflowHelperFactory helperFactory) throws Exception { dropFailed.set(false); // Dropping non-existing index - IndexDropOperatorNodePushable dropNonExistingOp = new IndexDropOperatorNodePushable(helperFactory, - EnumSet.noneOf(DropOption.class), ctx, 0); + IndexDropOperatorNodePushable dropNonExistingOp = + new IndexDropOperatorNodePushable(helperFactory, EnumSet.noneOf(DropOption.class), ctx, 0); try { dropNonExistingOp.initialize(); } catch (HyracksDataException e) { @@ -228,8 +228,8 @@ public class IndexDropOperatorNodePushableTest { throws Exception { // Dropping non-existing index with if exists option should be successful dropFailed.set(false); - IndexDropOperatorNodePushable dropNonExistingWithIfExistsOp = new IndexDropOperatorNodePushable(helperFactory, - EnumSet.of(DropOption.IF_EXISTS), ctx, 0); + IndexDropOperatorNodePushable dropNonExistingWithIfExistsOp = + new IndexDropOperatorNodePushable(helperFactory, EnumSet.of(DropOption.IF_EXISTS), ctx, 0); try { dropNonExistingWithIfExistsOp.initialize(); } catch (HyracksDataException e) { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java index 8a721b9..5432df9 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/Args.java @@ -28,22 +28,18 @@ import org.kohsuke.args4j.Option; @SuppressWarnings("FieldCanBeLocal") public class Args { - @Option(name = "-clusteraddress", metaVar = "<address>", - usage = "Hostname or IP Address of the cluster") + @Option(name = "-clusteraddress", metaVar = "<address>", usage = "Hostname or IP Address of the cluster") protected String clusterAddress = InetAddress.getLoopbackAddress().getHostAddress(); @Option(name = "-clusterport", metaVar = "<port>", usage = "Port of the cluster to connect to") protected int clusterPort = 19002; - @Option(name = "-clusterstatepath", metaVar = "<path>", hidden = true, - usage = "Path on host:port to check for cluster readiness") + @Option(name = "-clusterstatepath", metaVar = "<path>", hidden = true, usage = "Path on host:port to check for cluster readiness") protected String clusterStatePath = "admin/cluster"; - @Option(name = "-shutdownpath", metaVar = "<path>", hidden = true, - usage = "Path on host:port to invoke to initiate shutdown") + @Option(name = "-shutdownpath", metaVar = "<path>", hidden = true, usage = "Path on host:port to invoke to initiate shutdown") protected String shutdownPath = "admin/shutdown"; - @Option(name = "-timeout", metaVar = "<secs>", usage = "Timeout for wait commands in seconds") protected int timeoutSecs = 0; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java index 7dfede9..d71b844 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelper.java @@ -25,7 +25,7 @@ public class AsterixHelper { private AsterixHelper() { } - public static void main(String [] args) throws IOException { + public static void main(String[] args) throws IOException { AsterixHelperExecution execution = new AsterixHelperExecution(); System.exit(execution.execute(args)); } http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java index cf7fd4f..326b1ca 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/AsterixHelperExecution.java @@ -40,11 +40,10 @@ public class AsterixHelperExecution { protected AsterixHelperExecution() { } - @SuppressWarnings({ - "squid:S106", // use of System.err + @SuppressWarnings({ "squid:S106", // use of System.err "squid:S1166" // rethrow or log exception }) - public int execute(String [] argArray) throws IOException { + public int execute(String[] argArray) throws IOException { Args args = createArgs(); CmdLineParser parser = createParser(args); try { @@ -59,8 +58,8 @@ public class AsterixHelperExecution { return command.execute(); } } catch (CmdLineException e) { - System.err.println("ERROR: " + e.getMessage() + "\n\n" - + "Usage: " + getHelperCommandName() + " [options] <command>"); + System.err.println( + "ERROR: " + e.getMessage() + "\n\n" + "Usage: " + getHelperCommandName() + " [options] <command>"); printUsageDetails(parser, System.err); return 99; http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java index 6a16761..4ba48c6 100644 --- a/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java +++ b/asterixdb/asterix-client-helper/src/main/java/org/apache/asterix/clienthelper/commands/RemoteCommand.java @@ -67,7 +67,7 @@ public abstract class RemoteCommand extends ClientCommand { protected HttpURLConnection openConnection(String path, Method method) throws IOException { URL url = new URL("http://" + hostPort + "/" + path); - HttpURLConnection conn = (HttpURLConnection)url.openConnection(); + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); final int timeoutMillis = (int) TimeUnit.SECONDS.toMillis(Math.max(MAX_CONNECTION_TIMEOUT_SECS, args.getTimeoutSecs())); conn.setConnectTimeout(timeoutMillis); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/SkipSecondaryIndexSearchExpressionAnnotation.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/SkipSecondaryIndexSearchExpressionAnnotation.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/SkipSecondaryIndexSearchExpressionAnnotation.java index de1e1fa..4d08b54 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/SkipSecondaryIndexSearchExpressionAnnotation.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/annotations/SkipSecondaryIndexSearchExpressionAnnotation.java @@ -24,7 +24,8 @@ import org.apache.hyracks.algebricks.core.algebra.expressions.IExpressionAnnotat public class SkipSecondaryIndexSearchExpressionAnnotation extends AbstractExpressionAnnotation { public static final String HINT_STRING = "skip-index"; - public static final SkipSecondaryIndexSearchExpressionAnnotation INSTANCE = new SkipSecondaryIndexSearchExpressionAnnotation(); + public static final SkipSecondaryIndexSearchExpressionAnnotation INSTANCE = + new SkipSecondaryIndexSearchExpressionAnnotation(); @Override public IExpressionAnnotation copy() { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWork.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWork.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWork.java index 8bc6eb0..c2d3303 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWork.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWork.java @@ -26,12 +26,12 @@ public interface IClusterManagementWork { } enum ClusterState { - UNUSABLE, // one or more cluster partitions are inactive or max id resources have not been reported - PENDING, // the metadata node has not yet joined & initialized - RECOVERING, // global recovery has not yet completed - ACTIVE, // cluster is ACTIVE and ready for requests - REBALANCING, // replication is processing failbacks - SHUTTING_DOWN // a shutdown request has been received, and is underway + UNUSABLE, // one or more cluster partitions are inactive or max id resources have not been reported + PENDING, // the metadata node has not yet joined & initialized + RECOVERING, // global recovery has not yet completed + ACTIVE, // cluster is ACTIVE and ready for requests + REBALANCING, // replication is processing failbacks + SHUTTING_DOWN // a shutdown request has been received, and is underway } WorkType getClusterManagementWorkType(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWorkResponse.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWorkResponse.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWorkResponse.java index a39aecd..0506817 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWorkResponse.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/api/IClusterManagementWorkResponse.java @@ -18,7 +18,6 @@ */ package org.apache.asterix.common.api; - public interface IClusterManagementWorkResponse { public enum Status { http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixProperties.java index 690d326..2c981c9 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixProperties.java @@ -34,15 +34,9 @@ public class AsterixProperties { } public static void registerConfigOptions(IConfigManager configManager) { - configManager.register( - NodeProperties.Option.class, - CompilerProperties.Option.class, - MetadataProperties.Option.class, - ExternalProperties.Option.class, - ActiveProperties.Option.class, - MessagingProperties.Option.class, - ReplicationProperties.Option.class, - StorageProperties.Option.class, + configManager.register(NodeProperties.Option.class, CompilerProperties.Option.class, + MetadataProperties.Option.class, ExternalProperties.Option.class, ActiveProperties.Option.class, + MessagingProperties.Option.class, ReplicationProperties.Option.class, StorageProperties.Option.class, TransactionProperties.Option.class); // we need to process the old-style asterix config before we apply defaults! http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java index 5ccff4f..0d29943 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/CompilerProperties.java @@ -33,19 +33,30 @@ import org.apache.hyracks.util.StorageUtil; public class CompilerProperties extends AbstractProperties { public enum Option implements IOption { - COMPILER_SORTMEMORY(LONG_BYTE_UNIT, StorageUtil.getLongSizeInBytes(32L, MEGABYTE), + COMPILER_SORTMEMORY( + LONG_BYTE_UNIT, + StorageUtil.getLongSizeInBytes(32L, MEGABYTE), "The memory budget (in bytes) for a sort operator instance in a partition"), - COMPILER_JOINMEMORY(LONG_BYTE_UNIT, StorageUtil.getLongSizeInBytes(32L, MEGABYTE), + COMPILER_JOINMEMORY( + LONG_BYTE_UNIT, + StorageUtil.getLongSizeInBytes(32L, MEGABYTE), "The memory budget (in bytes) for a join operator instance in a partition"), - COMPILER_GROUPMEMORY(LONG_BYTE_UNIT, StorageUtil.getLongSizeInBytes(32L, MEGABYTE), + COMPILER_GROUPMEMORY( + LONG_BYTE_UNIT, + StorageUtil.getLongSizeInBytes(32L, MEGABYTE), "The memory budget (in bytes) for a group by operator instance in a partition"), - COMPILER_FRAMESIZE(INTEGER_BYTE_UNIT, StorageUtil.getIntSizeInBytes(32, KILOBYTE), + COMPILER_FRAMESIZE( + INTEGER_BYTE_UNIT, + StorageUtil.getIntSizeInBytes(32, KILOBYTE), "The page size (in bytes) for computation"), - COMPILER_PARALLELISM(INTEGER, COMPILER_PARALLELISM_AS_STORAGE, "The degree of parallelism for query " + - "execution. Zero means to use the storage parallelism as the query execution parallelism, while " + - "other integer values dictate the number of query execution parallel partitions. The system will " + - "fall back to use the number of all available CPU cores in the cluster as the degree of parallelism " + - "if the number set by a user is too large or too small"), + COMPILER_PARALLELISM( + INTEGER, + COMPILER_PARALLELISM_AS_STORAGE, + "The degree of parallelism for query " + + "execution. Zero means to use the storage parallelism as the query execution parallelism, while " + + "other integer values dictate the number of query execution parallel partitions. The system will " + + "fall back to use the number of all available CPU cores in the cluster as the degree of parallelism " + + "if the number set by a user is too large or too small"), COMPILER_PREGELIX_HOME(STRING, "~/pregelix", "Pregelix installation root directory"); private final IOptionType type; @@ -83,6 +94,7 @@ public class CompilerProperties extends AbstractProperties { return this == COMPILER_PREGELIX_HOME; } } + public static final String COMPILER_SORTMEMORY_KEY = Option.COMPILER_SORTMEMORY.ini(); public static final String COMPILER_GROUPMEMORY_KEY = Option.COMPILER_GROUPMEMORY.ini(); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java index 4172a72..4bc1953 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ExternalProperties.java @@ -36,8 +36,11 @@ public class ExternalProperties extends AbstractProperties { ACTIVE_PORT(INTEGER, 19003, "The listen port of the active server"), NC_API_PORT(INTEGER, 19004, "The listen port of the node controller API server"), LOG_LEVEL(LEVEL, Level.WARN, "The logging level for master and slave processes"), - MAX_WAIT_ACTIVE_CLUSTER(INTEGER, 60, "The max pending time (in seconds) for cluster startup. After the " + - "threshold, if the cluster still is not up and running, it is considered unavailable"), + MAX_WAIT_ACTIVE_CLUSTER( + INTEGER, + 60, + "The max pending time (in seconds) for cluster startup. After the " + + "threshold, if the cluster still is not up and running, it is considered unavailable"), CC_JAVA_OPTS(STRING, "-Xmx1024m", "The JVM options passed to the cluster controller process by managix"), NC_JAVA_OPTS(STRING, "-Xmx1024m", "The JVM options passed to the node controller process(es) by managix"); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/MessagingProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/MessagingProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/MessagingProperties.java index 6a96546..e382293 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/MessagingProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/MessagingProperties.java @@ -30,7 +30,9 @@ import org.apache.hyracks.util.StorageUtil; public class MessagingProperties extends AbstractProperties { public enum Option implements IOption { - MESSAGING_FRAME_SIZE(INTEGER_BYTE_UNIT, StorageUtil.getIntSizeInBytes(4, KILOBYTE), + MESSAGING_FRAME_SIZE( + INTEGER_BYTE_UNIT, + StorageUtil.getIntSizeInBytes(4, KILOBYTE), "The frame size to be used for NC to NC messaging"), MESSAGING_FRAME_COUNT(INTEGER, 512, "Number of reusable frames for NC to NC messaging"); http://git-wip-us.apache.org/repos/asf/asterixdb/blob/cb9ca975/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java ---------------------------------------------------------------------- diff --git a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java index 3455774..18503b2 100644 --- a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java +++ b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ReplicationProperties.java @@ -36,12 +36,18 @@ import org.apache.hyracks.util.StorageUtil.StorageUnit; public class ReplicationProperties extends AbstractProperties { public enum Option implements IOption { - REPLICATION_LOG_BUFFER_PAGESIZE(INTEGER_BYTE_UNIT, StorageUtil.getIntSizeInBytes(128, StorageUnit.KILOBYTE), + REPLICATION_LOG_BUFFER_PAGESIZE( + INTEGER_BYTE_UNIT, + StorageUtil.getIntSizeInBytes(128, StorageUnit.KILOBYTE), "The size in bytes of each log buffer page"), REPLICATION_LOG_BUFFER_NUMPAGES(INTEGER, 8, "The number of log buffer pages"), - REPLICATION_LOG_BATCHSIZE(INTEGER_BYTE_UNIT, StorageUtil.getIntSizeInBytes(4, StorageUnit.KILOBYTE), + REPLICATION_LOG_BATCHSIZE( + INTEGER_BYTE_UNIT, + StorageUtil.getIntSizeInBytes(4, StorageUnit.KILOBYTE), "The size in bytes to replicate in each batch"), - REPLICATION_TIMEOUT(LONG, TimeUnit.SECONDS.toSeconds(30), + REPLICATION_TIMEOUT( + LONG, + TimeUnit.SECONDS.toSeconds(30), "The time in seconds to timeout waiting for master or replica to ack"), REPLICATION_ENABLED(BOOLEAN, false, "Whether or not data replication is enabled"), REPLICATION_FACTOR(INTEGER, 2, "Number of replicas (backups) to maintain per master replica"),
