merged asterix_stabilization r751:755 to asterix_lsm_stabilization
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization@757 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/src/test/resources/metadata/queries.txt b/asterix-app/src/test/resources/metadata/queries.txt
index fedfeb6..331e37b 100644
--- a/asterix-app/src/test/resources/metadata/queries.txt
+++ b/asterix-app/src/test/resources/metadata/queries.txt
@@ -24,4 +24,8 @@
metadata_node.aql
metadata_nodegroup.aql
custord_q9.aql
-custord_q10.aql
\ No newline at end of file
+custord_q10.aql
+regress_01_create_type.aql
+regress_02_refer_existing_type.aql
+regress_03_repeated_create_drop.aql
+regress_04_drop_nested_type.aql
diff --git a/asterix-app/src/test/resources/metadata/queries/custord_q2.aql b/asterix-app/src/test/resources/metadata/queries/custord_q2.aql
index d99bed6..291ca64 100644
--- a/asterix-app/src/test/resources/metadata/queries/custord_q2.aql
+++ b/asterix-app/src/test/resources/metadata/queries/custord_q2.aql
@@ -3,4 +3,5 @@
write output to nc1:"rttest/custord_q2.adm";
for $c in dataset('Customers')
+order by $c.cid
return $c.address
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/metadata/queries/regress_04_drop_nested_type.aql b/asterix-app/src/test/resources/metadata/queries/regress_04_drop_nested_type.aql
new file mode 100644
index 0000000..f8c8626
--- /dev/null
+++ b/asterix-app/src/test/resources/metadata/queries/regress_04_drop_nested_type.aql
@@ -0,0 +1,21 @@
+/*
+ * Description : Test that a synthetically created content type is dropped with its parent type.
+ * Guards against regression to issue 188.
+ * Expected Result : Success
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type FooType as closed {
+ bar: int32?
+};
+
+drop type FooType;
+
+create type FooType as closed {
+ bar: int32?
+};
+
+drop type FooType;
\ No newline at end of file
diff --git a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java
index c634d95..98d6ed3 100644
--- a/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java
+++ b/asterix-metadata/src/main/java/edu/uci/ics/asterix/metadata/MetadataNode.java
@@ -440,9 +440,10 @@
// Searches the index for the tuple to be deleted. Acquires an S
// lock on the 'datatype' dataset.
ITupleReference tuple = getTupleToBeDeleted(jobId, MetadataPrimaryIndexes.DATATYPE_DATASET, searchKey);
+ // This call uses the secondary index on datatype. Get nested types before deleting entry from secondary index.
+ List<String> nestedTypes = getNestedDatatypeNames(jobId, dataverseName, datatypeName);
deleteTupleFromIndex(jobId, MetadataPrimaryIndexes.DATATYPE_DATASET, tuple);
deleteFromDatatypeSecondaryIndex(jobId, dataverseName, datatypeName);
- List<String> nestedTypes = getNestedDatatypeNames(jobId, dataverseName, datatypeName);
for (String nestedType : nestedTypes) {
Datatype dt = getDatatype(jobId, dataverseName, nestedType);
if (dt != null && dt.getIsAnonymous()) {