asterixdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amo...@apache.org
Subject incubator-asterixdb git commit: ASTERIXDB-1378 Fix NPE on Feed Connect After Restart
Date Sat, 02 Apr 2016 19:12:24 GMT
Repository: incubator-asterixdb
Updated Branches:
  refs/heads/master 442e49b9f -> 02b35a1bf


ASTERIXDB-1378 Fix NPE on Feed Connect After Restart

This issue was caused by the way type traits are computed for each
index. since we have duplicate code to create the index dataflow
helper, we had to fix the way type traits are created in all of
these different places. We propably need to do further refactoring
to have common code for creating index dataflow helper instances.

Change-Id: If8f8696d252868a8cce0afdbaeda0dd046f99186
Reviewed-on: https://asterix-gerrit.ics.uci.edu/766
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Yingyi Bu <buyingyi@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/commit/02b35a1b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/tree/02b35a1b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/diff/02b35a1b

Branch: refs/heads/master
Commit: 02b35a1bf98f4168dae91fa68c14d7e062bfd032
Parents: 442e49b
Author: Abdullah Alamoudi <bamousaa@gmail.com>
Authored: Fri Apr 1 18:50:16 2016 +0300
Committer: abdullah alamoudi <bamousaa@gmail.com>
Committed: Sat Apr 2 12:06:47 2016 -0700

----------------------------------------------------------------------
 .../apache/asterix/file/DatasetOperations.java  | 10 +---
 .../asterix/test/runtime/ExecutionTest.java     |  9 +--
 .../asterix/test/runtime/ExecutionTestUtil.java |  8 +--
 .../test/runtime/SqlppExecutionTest.java        |  8 ++-
 .../dataflow/FeedRecordDataFlowController.java  |  3 +
 .../dataset-with-meta-record.1.script.aql       |  1 +
 .../dataset-with-meta-record.2.ddl.aql          | 58 ++++++++++++++++++++
 .../dataset-with-meta-record.3.update.aql       | 27 +++++++++
 .../dataset-with-meta-record.4.script.aql       |  1 +
 .../dataset-with-meta-record.5.query.aql        | 29 ++++++++++
 .../dataset-with-meta-record.6.script.aql       |  1 +
 .../dataset-with-meta-record.5.adm              |  1 +
 .../create_and_start.sh                         |  1 +
 .../dataset-with-meta-record/stop_and_delete.sh |  3 +
 .../dataset-with-meta-record/stop_and_start.sh  |  2 +
 .../test/resources/transactionts/testsuite.xml  |  6 +-
 .../metadata/declared/AqlMetadataProvider.java  | 21 +++----
 .../asterix/metadata/utils/DatasetUtils.java    | 17 ++++--
 18 files changed, 169 insertions(+), 37 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-app/src/main/java/org/apache/asterix/file/DatasetOperations.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/main/java/org/apache/asterix/file/DatasetOperations.java b/asterix-app/src/main/java/org/apache/asterix/file/DatasetOperations.java
index 06d2b71..9052696 100644
--- a/asterix-app/src/main/java/org/apache/asterix/file/DatasetOperations.java
+++ b/asterix-app/src/main/java/org/apache/asterix/file/DatasetOperations.java
@@ -69,7 +69,7 @@ public class DatasetOperations {
 
     public static JobSpecification createDropDatasetJobSpec(CompiledDatasetDropStatement
datasetDropStmt,
             AqlMetadataProvider metadataProvider)
-                    throws AlgebricksException, HyracksDataException, RemoteException, ACIDException,
AsterixException {
+            throws AlgebricksException, HyracksDataException, RemoteException, ACIDException,
AsterixException {
 
         String dataverseName = null;
         if (datasetDropStmt.getDataverseName() != null) {
@@ -222,26 +222,22 @@ public class DatasetOperations {
             throw new AsterixException("Could not find dataset " + datasetName + " in dataverse
" + dataverseName);
         }
         boolean temp = dataset.getDatasetDetails().isTemp();
-
         ARecordType itemType = (ARecordType) metadata.findType(dataset.getItemTypeDataverseName(),
                 dataset.getItemTypeName());
+        ARecordType metaItemType = DatasetUtils.getMetaType(metadata, dataset);
         JobSpecification spec = JobSpecificationUtils.createJobSpecification();
         IBinaryComparatorFactory[] comparatorFactories = DatasetUtils.computeKeysBinaryComparatorFactories(dataset,
                 itemType, format.getBinaryComparatorFactoryProvider());
-        ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType);
+        ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType,
metaItemType);
         int[] blooFilterKeyFields = DatasetUtils.createBloomFilterKeyFields(dataset);
-
         ITypeTraits[] filterTypeTraits = DatasetUtils.computeFilterTypeTraits(dataset, itemType);
         IBinaryComparatorFactory[] filterCmpFactories = DatasetUtils.computeFilterBinaryComparatorFactories(dataset,
                 itemType, format.getBinaryComparatorFactoryProvider());
         int[] filterFields = DatasetUtils.createFilterFields(dataset);
         int[] btreeFields = DatasetUtils.createBTreeFieldsWhenThereisAFilter(dataset);
-
         Pair<IFileSplitProvider, AlgebricksPartitionConstraint> splitsAndConstraint
= metadata
                 .splitProviderAndPartitionConstraintsForDataset(dataverseName, datasetName,
datasetName, temp);
-
         AsterixStorageProperties storageProperties = AsterixAppContextInfo.getInstance().getStorageProperties();
-
         Pair<ILSMMergePolicyFactory, Map<String, String>> compactionInfo = DatasetUtils.getMergePolicyFactory(dataset,
                 metadata.getMetadataTxnContext());
         LSMTreeIndexCompactOperatorDescriptor compactOp = new LSMTreeIndexCompactOperatorDescriptor(spec,

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
index 8d020e7..e372d31 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTest.java
@@ -48,9 +48,10 @@ public class ExecutionTest {
             File.separator);
 
     protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml";
-
     protected static AsterixTransactionProperties txnProperties;
-    private final static TestExecutor testExecutor = new TestExecutor();
+    private static final TestExecutor testExecutor = new TestExecutor();
+    private static final boolean cleanupOnStart = true;
+    private static final boolean cleanupOnStop = true;
 
     @BeforeClass
     public static void setUp() throws Exception {
@@ -60,7 +61,7 @@ public class ExecutionTest {
             // remove library directory
             TestLibrarian.removeLibraryDir();
             testExecutor.setLibrarian(new TestLibrarian());
-            ExecutionTestUtil.setUp();
+            ExecutionTestUtil.setUp(cleanupOnStart);
         } catch (Throwable th) {
             th.printStackTrace();
             throw th;
@@ -71,7 +72,7 @@ public class ExecutionTest {
     public static void tearDown() throws Exception {
         // remove library directory
         TestLibrarian.removeLibraryDir();
-        ExecutionTestUtil.tearDown();
+        ExecutionTestUtil.tearDown(cleanupOnStop);
     }
 
     @Parameters(name = "ExecutionTest {index}: {0}")

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
index 5e76ecb..d919c92 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/ExecutionTestUtil.java
@@ -43,7 +43,7 @@ public class ExecutionTestUtil {
 
     protected static TestGroup FailedGroup;
 
-    public static void setUp() throws Exception {
+    public static void setUp(boolean cleanup) throws Exception {
         System.out.println("Starting setup");
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("Starting setup");
@@ -53,7 +53,7 @@ public class ExecutionTestUtil {
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("initializing pseudo cluster");
         }
-        AsterixHyracksIntegrationUtil.init(true);
+        AsterixHyracksIntegrationUtil.init(cleanup);
 
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("initializing HDFS");
@@ -81,9 +81,9 @@ public class ExecutionTestUtil {
         }
     }
 
-    public static void tearDown() throws Exception {
+    public static void tearDown(boolean cleanup) throws Exception {
         // validateBufferCacheState(); <-- Commented out until bug is fixed -->
-        AsterixHyracksIntegrationUtil.deinit(true);
+        AsterixHyracksIntegrationUtil.deinit(cleanup);
         File outdir = new File(PATH_ACTUAL);
         File[] files = outdir.listFiles();
         if (files == null || files.length == 0) {

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
----------------------------------------------------------------------
diff --git a/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
b/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
index cbb14c5..b827a0d 100644
--- a/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
+++ b/asterix-app/src/test/java/org/apache/asterix/test/runtime/SqlppExecutionTest.java
@@ -51,7 +51,9 @@ public class SqlppExecutionTest {
     protected static final String TEST_CONFIG_FILE_NAME = "asterix-build-configuration.xml";
 
     protected static AsterixTransactionProperties txnProperties;
-    private final static TestExecutor testExecutor = new TestExecutor();
+    private static final TestExecutor testExecutor = new TestExecutor();
+    private static final boolean cleanupOnStart = true;
+    private static final boolean cleanupOnStop = true;
 
     protected static TestGroup FailedGroup;
 
@@ -59,12 +61,12 @@ public class SqlppExecutionTest {
     public static void setUp() throws Exception {
         File outdir = new File(PATH_ACTUAL);
         outdir.mkdirs();
-        ExecutionTestUtil.setUp();
+        ExecutionTestUtil.setUp(cleanupOnStart);
     }
 
     @AfterClass
     public static void tearDown() throws Exception {
-        ExecutionTestUtil.tearDown();
+        ExecutionTestUtil.tearDown(cleanupOnStop);
         AsterixHyracksIntegrationUtil.removeTestStorageFiles();
     }
 

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-external-data/src/main/java/org/apache/asterix/external/dataflow/FeedRecordDataFlowController.java
----------------------------------------------------------------------
diff --git a/asterix-external-data/src/main/java/org/apache/asterix/external/dataflow/FeedRecordDataFlowController.java
b/asterix-external-data/src/main/java/org/apache/asterix/external/dataflow/FeedRecordDataFlowController.java
index 6401234..387e2dc 100644
--- a/asterix-external-data/src/main/java/org/apache/asterix/external/dataflow/FeedRecordDataFlowController.java
+++ b/asterix-external-data/src/main/java/org/apache/asterix/external/dataflow/FeedRecordDataFlowController.java
@@ -85,6 +85,9 @@ public class FeedRecordDataFlowController<T> extends AbstractFeedDataFlowControl
                 }
                 tupleForwarder.addTuple(tb);
             }
+        } catch (InterruptedException e) {
+            //TODO: Find out what could cause an interrupted exception beside termination
of a job/feed
+            LOGGER.warn("Feed has been interrupted. Closing the feed");
         } catch (Exception e) {
             failed = true;
             tupleForwarder.flush();

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.1.script.aql
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.1.script.aql
b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.1.script.aql
new file mode 100644
index 0000000..cc46136
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.1.script.aql
@@ -0,0 +1 @@
+create_and_start.sh

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.2.ddl.aql
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.2.ddl.aql
b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.2.ddl.aql
new file mode 100644
index 0000000..d3317e4
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.2.ddl.aql
@@ -0,0 +1,58 @@
+/*
+ * 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.
+ */
+/*
+ * Description  : Create a change feed with meta-data and test ingestion of records
+ * Expected Res : Success
+ * Date         : 24th Feb 2016
+ */
+
+drop dataverse KeyVerse if exists;
+create dataverse KeyVerse;
+use dataverse KeyVerse;
+
+create type DocumentType as open{
+};
+
+create type KVMetaType as open{
+"key":string,
+bucket:string,
+vbucket:int32,
+seq:int64,
+cas:int64,
+creationTime:int64,
+expiration:int32,
+flags:int32,
+revSeq:int64,
+lockTime:int32
+};
+
+create dataset KVStore(DocumentType) with meta(KVMetaType)primary key meta()."key";
+
+create feed KVChangeStream using adapter(
+    ("type-name"="DocumentType"),
+    ("meta-type-name"="KVMetaType"),
+    ("reader"="kv_test"),
+    ("parser"="record-with-metadata"),
+    ("format"="dcp"),
+    ("record-format"="json"),
+    ("change-feed"="true"),
+    ("key-indexes"="0"),
+    ("key-indicators"="1"),
+    ("num-of-records"="1000")
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.3.update.aql
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.3.update.aql
b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.3.update.aql
new file mode 100644
index 0000000..7faf013
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.3.update.aql
@@ -0,0 +1,27 @@
+/*
+ * 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.
+ */
+/*
+ * Description  : Create a change feed with meta-data and test ingestion of records
+ * Expected Res : Success
+ * Date         : 24th Feb 2016
+ */
+use dataverse KeyVerse;
+
+set wait-for-completion-feed "true";
+connect feed KVChangeStream to dataset KVStore;
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.4.script.aql
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.4.script.aql
b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.4.script.aql
new file mode 100644
index 0000000..3ba1dc0
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.4.script.aql
@@ -0,0 +1 @@
+stop_and_start.sh

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.query.aql
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.query.aql
b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.query.aql
new file mode 100644
index 0000000..9db20a9
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.query.aql
@@ -0,0 +1,29 @@
+/*
+ * 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.
+ */
+/*
+ * Description  : Create a change feed and test ingestion of records
+ * Expected Res : Success
+ * Date         : 24th Feb 2016
+ */
+use dataverse KeyVerse;
+
+count(
+    for $d in dataset KVStore
+    return $d
+);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.6.script.aql
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.6.script.aql
b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.6.script.aql
new file mode 100644
index 0000000..10e1a51
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/queries/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.6.script.aql
@@ -0,0 +1 @@
+stop_and_delete.sh

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/results/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.adm
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/results/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.adm
b/asterix-installer/src/test/resources/transactionts/results/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.adm
new file mode 100644
index 0000000..c31da8b
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/results/query_after_restart/dataset-with-meta-record/dataset-with-meta-record.5.adm
@@ -0,0 +1 @@
+804
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/create_and_start.sh
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/create_and_start.sh
b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/create_and_start.sh
new file mode 100755
index 0000000..945f01d
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/create_and_start.sh
@@ -0,0 +1 @@
+$MANAGIX_HOME/bin/managix create -n nc1 -c $MANAGIX_HOME/clusters/local/local.xml;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_delete.sh
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_delete.sh
b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_delete.sh
new file mode 100755
index 0000000..d7deea3
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_delete.sh
@@ -0,0 +1,3 @@
+$MANAGIX_HOME/bin/managix stop -n nc1;
+$MANAGIX_HOME/bin/managix delete -n nc1;
+

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_start.sh
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_start.sh
b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_start.sh
new file mode 100755
index 0000000..1271a2b
--- /dev/null
+++ b/asterix-installer/src/test/resources/transactionts/scripts/query_after_restart/dataset-with-meta-record/stop_and_start.sh
@@ -0,0 +1,2 @@
+$MANAGIX_HOME/bin/managix stop -n nc1;
+$MANAGIX_HOME/bin/managix start -n nc1;

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-installer/src/test/resources/transactionts/testsuite.xml
----------------------------------------------------------------------
diff --git a/asterix-installer/src/test/resources/transactionts/testsuite.xml b/asterix-installer/src/test/resources/transactionts/testsuite.xml
index 0635e7c..0c12426 100644
--- a/asterix-installer/src/test/resources/transactionts/testsuite.xml
+++ b/asterix-installer/src/test/resources/transactionts/testsuite.xml
@@ -17,9 +17,13 @@
  ! under the License.
  !-->
 <test-suite xmlns="urn:xml.testframework.asterix.apache.org" ResultOffsetPath="results"
QueryOffsetPath="queries" QueryFileExtension=".aql">
-
   <test-group name="query_after_restart">
       <test-case FilePath="query_after_restart">
+          <compilation-unit name="dataset-with-meta-record">
+              <output-dir compare="Text">dataset-with-meta-record</output-dir>
+          </compilation-unit>
+      </test-case>
+      <test-case FilePath="query_after_restart">
           <compilation-unit name="external_index">
               <output-dir compare="Text">external_index</output-dir>
           </compilation-unit>

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
index a629cdf..90ebfb7 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
@@ -700,11 +700,11 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId,
Strin
                 for (int i = 0; i < numPrimaryKeys; i++) {
                     bloomFilterKeyFields[i] = i;
                 }
-
-                typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType);
+                // get meta item type
+                ARecordType metaItemType = DatasetUtils.getMetaType(this, dataset);
+                typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType, metaItemType);
                 comparatorFactories = DatasetUtils.computeKeysBinaryComparatorFactories(dataset,
itemType,
                         context.getBinaryComparatorFactoryProvider());
-
                 filterFields = DatasetUtils.createFilterFields(dataset);
                 btreeFields = DatasetUtils.createBTreeFieldsWhenThereisAFilter(dataset);
             }
@@ -1089,7 +1089,7 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId,
Strin
             String itemTypeName = dataset.getItemTypeName();
             ARecordType itemType = (ARecordType) MetadataManager.INSTANCE
                     .getDatatype(mdTxnCtx, dataset.getItemTypeDataverseName(), itemTypeName).getDatatype();
-            ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType);
+            ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType,
null);
             IBinaryComparatorFactory[] comparatorFactories = DatasetUtils.computeKeysBinaryComparatorFactories(dataset,
                     itemType, context.getBinaryComparatorFactoryProvider());
 
@@ -1174,12 +1174,10 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId,
Strin
             Index primaryIndex = MetadataManager.INSTANCE.getIndex(mdTxnCtx, dataset.getDataverseName(),
                     dataset.getDatasetName(), dataset.getDatasetName());
             String indexName = primaryIndex.getIndexName();
-
-            String itemTypeName = dataset.getItemTypeName();
             ARecordType itemType = (ARecordType) MetadataManager.INSTANCE
-                    .getDatatype(mdTxnCtx, dataset.getItemTypeDataverseName(), itemTypeName).getDatatype();
-
-            ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType);
+                    .getDatatype(mdTxnCtx, dataset.getItemTypeDataverseName(), dataset.getItemTypeName()).getDatatype();
+            ARecordType metaItemType = DatasetUtils.getMetaType(this, dataset);
+            ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType,
metaItemType);
 
             IAsterixApplicationContextInfo appContext = (IAsterixApplicationContextInfo)
context.getAppContext();
             IBinaryComparatorFactory[] comparatorFactories = DatasetUtils.computeKeysBinaryComparatorFactories(dataset,
@@ -2347,9 +2345,8 @@ public class AqlMetadataProvider implements IMetadataProvider<AqlSourceId,
Strin
             String itemTypeName = dataset.getItemTypeName();
             ARecordType itemType = (ARecordType) MetadataManager.INSTANCE
                     .getDatatype(mdTxnCtx, dataSource.getId().getDataverseName(), itemTypeName).getDatatype();
-
-            ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType);
-
+            ARecordType metaItemType = DatasetUtils.getMetaType(this, dataset);
+            ITypeTraits[] typeTraits = DatasetUtils.computeTupleTypeTraits(dataset, itemType,
metaItemType);
             IAsterixApplicationContextInfo appContext = (IAsterixApplicationContextInfo)
context.getAppContext();
             IBinaryComparatorFactory[] comparatorFactories = DatasetUtils.computeKeysBinaryComparatorFactories(dataset,
                     itemType, context.getBinaryComparatorFactoryProvider());

http://git-wip-us.apache.org/repos/asf/incubator-asterixdb/blob/02b35a1b/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
----------------------------------------------------------------------
diff --git a/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
b/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
index 581d01c..0ac4f56 100644
--- a/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
+++ b/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/DatasetUtils.java
@@ -35,6 +35,7 @@ import org.apache.asterix.formats.nontagged.AqlTypeTraitProvider;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataTransactionContext;
+import org.apache.asterix.metadata.declared.AqlMetadataProvider;
 import org.apache.asterix.metadata.entities.CompactionPolicy;
 import org.apache.asterix.metadata.entities.Dataset;
 import org.apache.asterix.metadata.entities.ExternalDatasetDetails;
@@ -105,11 +106,6 @@ public class DatasetUtils {
         return bhffs;
     }
 
-    public static ITypeTraits[] computeTupleTypeTraits(Dataset dataset, ARecordType itemType)
-            throws AlgebricksException {
-        return computeTupleTypeTraits(dataset, itemType, null);
-    }
-
     public static ITypeTraits[] computeTupleTypeTraits(Dataset dataset, ARecordType itemType,
ARecordType metaItemType)
             throws AlgebricksException {
         if (dataset.getDatasetType() == DatasetType.EXTERNAL) {
@@ -156,7 +152,7 @@ public class DatasetUtils {
 
     public static IBinaryComparatorFactory[] computeFilterBinaryComparatorFactories(Dataset
dataset,
             ARecordType itemType, IBinaryComparatorFactoryProvider comparatorFactoryProvider)
-                    throws AlgebricksException {
+            throws AlgebricksException {
         if (dataset.getDatasetType() == DatasetType.EXTERNAL) {
             return null;
         }
@@ -274,4 +270,13 @@ public class DatasetUtils {
 
         propertyRecordBuilder.write(out, true);
     }
+
+    public static ARecordType getMetaType(AqlMetadataProvider metadataProvider, Dataset dataset)
+            throws AlgebricksException {
+        if (dataset.hasMetaPart()) {
+            return (ARecordType) metadataProvider.findType(dataset.getMetaItemTypeDataverseName(),
+                    dataset.getMetaItemTypeName());
+        }
+        return null;
+    }
 }


Mime
View raw message