merge r1463 through r1472 into asterix_lsm_stabilization_managix
git-svn-id: https://asterixdb.googlecode.com/svn/branches/asterix_lsm_stabilization_managix@1473 eaa15691-b419-025a-1212-ee371bd00084
diff --git a/asterix-app/data/custord-tiny/customer-tiny-neg.adm b/asterix-app/data/custord-tiny/customer-tiny-neg.adm
new file mode 100644
index 0000000..4e8e9ab
--- /dev/null
+++ b/asterix-app/data/custord-tiny/customer-tiny-neg.adm
@@ -0,0 +1,10 @@
+{ "cid": 4440, "name": "Renea Lavelett", "age": 72, "address": { "number": 8963, "street": "Oak St.", "city": "Mountain View" }, "lastorder": { "oid": 20520, "total": 6.198883E-4f } }
+{ "cid": 530, "name": "Clint Coil", "age": 79, "address": { "number": 4491, "street": "7th St.", "city": "San Jose" }, "lastorder": { "oid": 530, "total": 7.5879574f } }
+{ "cid": 76, "name": "Marvella Loud", "age": 72, "address": { "number": 6988, "street": "7th St.", "city": "Sunnyvale" }, "lastorder": { "oid": 76, "total": 12.811708f } }
+{ "cid": 586, "name": "Tamie Pollara", "age": 89, "address": { "number": 7424, "street": "Oak St.", "city": "Sunnyvale" }, "lastorder": { "oid": 586, "total": 22.163845f } }
+{ "cid": 59, "name": "Lance Pracht", "age": 27, "address": { "number": 342, "street": "Washington St.", "city": "Mountain View" }, "lastorder": { "oid": 59, "total": 26.975239f } }
+{ "cid": 939, "name": "Larry Gothier", "age": 34, "address": { "number": 1786, "street": "Park St.", "city": "Mountain View" }, "lastorder": { "oid": 939, "total": 33.49055f } }
+{ "cid": 996, "name": "Obdulia Dicosmo", "age": 14, "address": { "number": 9237, "street": "Cedar St.", "city": "Los Angeles" }, "lastorder": { "oid": 996, "total": 94.23889f } }
+{ "cid": 953, "name": "Elias Leonardo", "age": 62, "address": { "number": 7831, "street": "Main St.", "city": "San Jose" }, "lastorder": { "oid": 953, "total": 79.990875f } }
+{ "cid": 74, "name": "Myrtice Cubias", "age": 11, "address": { "number": 9048, "street": "Park St.", "city": "San Jose" }, "lastorder": { "oid": 74, "total": 47.675938f } }
+{ "cid": 758, "name": "Curt Savage", "age": 81, "address": { "number": 5651, "street": "Main St.", "city": "Seattle" }, "lastorder": { "oid": 758, "total": 45.33596f } }
\ No newline at end of file
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
index c38410a..2602707 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/aql/TestsUtils.java
@@ -54,6 +54,9 @@
try {
while ((lineExpected = readerExpected.readLine()) != null) {
+ if (jArray.length() <= 0) {
+ throw new Exception("No results returned for query.");
+ }
JSONArray resultArray = jArray.getJSONArray(chunkCounter);
if ((lineActual = resultArray.getString(recordCounter)) == null) {
diff --git a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
index c0d3585..aacec61 100644
--- a/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
+++ b/asterix-app/src/test/java/edu/uci/ics/asterix/test/runtime/ExecutionTest.java
@@ -57,7 +57,7 @@
File log = new File("asterix_logs");
if (log.exists()) {
- FileUtils.deleteDirectory(log);
+ FileUtils.deleteDirectory(log);
}
AsterixHyracksIntegrationUtil.init();
@@ -87,7 +87,7 @@
File log = new File("asterix_logs");
if (log.exists()) {
- FileUtils.deleteDirectory(log);
+ FileUtils.deleteDirectory(log);
}
HDFSCluster.getInstance().cleanup();
}
@@ -232,11 +232,14 @@
List<CompilationUnit> cUnits = tcCtx.getTestCase().getCompilationUnit();
for (CompilationUnit cUnit : cUnits) {
LOGGER.info("[TEST]: " + tcCtx.getTestCase().getFilePath() + "/" + cUnit.getName());
-
-// if (!tcCtx.getTestCase().getFilePath().contains("failure")) {
-// continue;
+
+// if (!(tcCtx.getTestCase().getFilePath().contains("dml") && cUnit.getName().equals(
+// "delete-from-loaded-dataset-with-index"))) {
+// continue;
// }
-
+//
+// System.out.println("/Test/: " + tcCtx.getTestCase().getFilePath() + "/" + cUnit.getName());
+
testFileCtxs = tcCtx.getTestFiles(cUnit);
expectedResultFileCtxs = tcCtx.getExpectedResultFiles(cUnit);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql
index 2e951e2..5103c09 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.1.ddl.aql
@@ -21,5 +21,3 @@
create dataset employee(Emp) primary key id;
-create index idx_employee_f_l_name on employee(fname,lname);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql
new file mode 100644
index 0000000..8a7bafe
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.3.ddl.aql
@@ -0,0 +1,6 @@
+
+use dataverse test;
+
+// create secondary index
+
+create index idx_employee_f_l_name on employee(fname,lname);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-composite-key/btree-index-composite-key.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql
index aeb8652c..4ed0993 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.1.ddl.aql
@@ -24,5 +24,3 @@
create dataset Orders(OrderType) primary key o_orderkey;
-create index idx_Orders_Custkey on Orders(o_custkey);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql
new file mode 100644
index 0000000..2489b15
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.ddl.aql
@@ -0,0 +1,6 @@
+
+use dataverse tpch;
+
+// create secondary index on Orders(o_custkey)
+
+create index idx_Orders_Custkey on Orders(o_custkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/btree-index-rewrite-multiple/btree-index-rewrite-multiple.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.1.ddl.aql
index 82c835d..80e9b17 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.1.ddl.aql
@@ -19,5 +19,3 @@
create dataset Customers(CustomerType) primary key cid;
-create index age_index on Customers(age);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.3.ddl.aql
new file mode 100644
index 0000000..7548774
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.3.ddl.aql
@@ -0,0 +1,6 @@
+
+use dataverse test;
+
+// create secondary index on Customers(age)
+
+create index age_index on Customers(age);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/cust-index-age-nullable/cust-index-age-nullable.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql
index 7e7ae8c..49c6b3b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.1.ddl.aql
@@ -15,5 +15,3 @@
create dataset DBLP(DBLPType)
primary key id on group1;
-create index ngram_index on DBLP(title) type ngram(3);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql
new file mode 100644
index 0000000..4fbadcd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.ddl.aql
@@ -0,0 +1,6 @@
+
+use dataverse test;
+
+// create secondary index of type ngram on DBLP(title)
+
+create index ngram_index on DBLP(title) type ngram(3);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-contains/inverted-index-ngram-contains.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql
index d2ef8c8..49c6b3b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.1.ddl.aql
@@ -15,5 +15,3 @@
create dataset DBLP(DBLPType)
primary key id on group1;
-create index ngram_index on DBLP(authors) type ngram(3);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql
new file mode 100644
index 0000000..ad6365d
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.ddl.aql
@@ -0,0 +1,4 @@
+
+use dataverse test;
+
+create index ngram_index on DBLP(authors) type ngram(3);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance-panic/inverted-index-ngram-edit-distance-panic.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql
index d2ef8c8..49c6b3b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.1.ddl.aql
@@ -15,5 +15,3 @@
create dataset DBLP(DBLPType)
primary key id on group1;
-create index ngram_index on DBLP(authors) type ngram(3);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql
new file mode 100644
index 0000000..2a43a57
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index ngram_index on DBLP(authors) type ngram(3);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-edit-distance/inverted-index-ngram-edit-distance.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql
index 7e7ae8c..49c6b3b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.1.ddl.aql
@@ -15,5 +15,3 @@
create dataset DBLP(DBLPType)
primary key id on group1;
-create index ngram_index on DBLP(title) type ngram(3);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql
new file mode 100644
index 0000000..4209874
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index ngram_index on DBLP(title) type ngram(3);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ngram-jaccard/inverted-index-ngram-jaccard.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.1.ddl.aql
index 207c8ec..b2dc701 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.1.ddl.aql
@@ -20,5 +20,3 @@
create dataset Customers(CustomerType)
primary key cid on group1;
-create index interests_index on Customers(interests) type keyword;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.3.ddl.aql
new file mode 100644
index 0000000..5356b79
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.3.ddl.aql
@@ -0,0 +1,4 @@
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance-panic/inverted-index-olist-edit-distance-panic.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.1.ddl.aql
index e5774db..dfc0f4e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.1.ddl.aql
@@ -22,5 +22,3 @@
create dataset Customers(CustomerType)
primary key cid on group1;
-create index interests_index on Customers(interests) type keyword;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.3.ddl.aql
new file mode 100644
index 0000000..6d7c0cb
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-edit-distance/inverted-index-olist-edit-distance.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.1.ddl.aql
index e5774db..dfc0f4e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.1.ddl.aql
@@ -22,5 +22,3 @@
create dataset Customers(CustomerType)
primary key cid on group1;
-create index interests_index on Customers(interests) type keyword;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.3.ddl.aql
new file mode 100644
index 0000000..5356b79
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.3.ddl.aql
@@ -0,0 +1,4 @@
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-olist-jaccard/inverted-index-olist-jaccard.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.1.ddl.aql
index a7177ba..a350a46 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.1.ddl.aql
@@ -22,5 +22,3 @@
create dataset Customers(CustomerType)
primary key cid on group1;
-create index interests_index on Customers(interests) type keyword;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.3.ddl.aql
new file mode 100644
index 0000000..5356b79
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.3.ddl.aql
@@ -0,0 +1,4 @@
+
+use dataverse test;
+
+create index interests_index on Customers(interests) type keyword;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-ulist-jaccard/inverted-index-ulist-jaccard.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql
index bad04b6..49c6b3b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.1.ddl.aql
@@ -15,5 +15,3 @@
create dataset DBLP(DBLPType)
primary key id on group1;
-create index keyword_index on DBLP(title) type keyword;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql
new file mode 100644
index 0000000..c8db25b
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.ddl.aql
@@ -0,0 +1,4 @@
+use dataverse test;
+
+create index keyword_index on DBLP(title) type keyword;
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-contains/inverted-index-word-contains.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql
index bad04b6..49c6b3b 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.1.ddl.aql
@@ -15,5 +15,3 @@
create dataset DBLP(DBLPType)
primary key id on group1;
-create index keyword_index on DBLP(title) type keyword;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql
new file mode 100644
index 0000000..93b64c1
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index keyword_index on DBLP(title) type keyword;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/inverted-index-word-jaccard/inverted-index-word-jaccard.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.1.ddl.aql
index 51fdf24..2cfb39a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.1.ddl.aql
@@ -17,5 +17,3 @@
create dataset Orders(OrderType)
primary key o_orderkey;
-create index idx_Orders_Custkey on Orders(o_custkey) ;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.3.ddl.aql
new file mode 100644
index 0000000..a92308f
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse tpch;
+
+create index idx_Orders_Custkey on Orders(o_custkey) ;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive-open/orders-index-custkey-conjunctive-open.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql
index 51fdf24..2cfb39a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.1.ddl.aql
@@ -17,5 +17,3 @@
create dataset Orders(OrderType)
primary key o_orderkey;
-create index idx_Orders_Custkey on Orders(o_custkey) ;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql
new file mode 100644
index 0000000..ed3fab0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse tpch;
+
+create index idx_Orders_Custkey on Orders(o_custkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-conjunctive/orders-index-custkey-conjunctive.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.1.ddl.aql
index 4d38a74..b541c58 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.1.ddl.aql
@@ -20,5 +20,3 @@
create dataset Orders(OrderType)
primary key o_orderkey on group1;
-create index idx_Orders_Custkey on Orders(o_custkey);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.3.ddl.aql
new file mode 100644
index 0000000..ed3fab0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse tpch;
+
+create index idx_Orders_Custkey on Orders(o_custkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey-open/orders-index-custkey-open.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql
index 8b12616..2cfb39a 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.1.ddl.aql
@@ -17,5 +17,3 @@
create dataset Orders(OrderType)
primary key o_orderkey;
-create index idx_Orders_Custkey on Orders(o_custkey);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql
new file mode 100644
index 0000000..ed3fab0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse tpch;
+
+create index idx_Orders_Custkey on Orders(o_custkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/orders-index-custkey/orders-index-custkey.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.1.ddl.aql
index 265e110..530d7a9 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.1.ddl.aql
@@ -25,6 +25,3 @@
create dataset LineItem(LineItemType)
primary key l_orderkey, l_linenumber;
-create index idx_LineItem_partkey on LineItem(l_linenumber);
-create index idx_LineItem_suppkey on LineItem(l_suppkey);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.3.ddl.aql
new file mode 100644
index 0000000..a3572c4
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.3.ddl.aql
@@ -0,0 +1,5 @@
+use dataverse test;
+
+create index idx_LineItem_partkey on LineItem(l_linenumber);
+create index idx_LineItem_suppkey on LineItem(l_suppkey);
+
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/range-search-open/range-search-open.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.1.ddl.aql
index 89eeec3..5281e04 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.1.ddl.aql
@@ -25,7 +25,3 @@
create dataset LineItem(LineItemType)
primary key l_orderkey, l_linenumber;
-
-create index idx_LineItem_partkey on LineItem(l_linenumber);
-create index idx_LineItem_suppkey on LineItem(l_suppkey);
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.3.ddl.aql
new file mode 100644
index 0000000..75edda0
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.3.ddl.aql
@@ -0,0 +1,4 @@
+use dataverse test;
+
+create index idx_LineItem_partkey on LineItem(l_linenumber);
+create index idx_LineItem_suppkey on LineItem(l_suppkey);
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/range-search/range-search.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.1.ddl.aql
index 088317c..77b9ef2 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.1.ddl.aql
@@ -16,5 +16,3 @@
create dataset MyData(MyRecord)
primary key id;
-create index rtree_index_point on MyData(point) type rtree;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql
new file mode 100644
index 0000000..b6a123e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index rtree_index_point on MyData(point) type rtree;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-nullable/rtree-secondary-index-nullable.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql
index be8978c..9de9b5e 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.1.ddl.aql
@@ -16,5 +16,3 @@
create dataset MyData(MyRecord)
primary key id;
-create index rtree_index_point on MyData(point) type rtree;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql
new file mode 100644
index 0000000..b6a123e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index rtree_index_point on MyData(point) type rtree;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index-open/rtree-secondary-index-open.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
index 41973e1..52fa76f 100644
--- a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.1.ddl.aql
@@ -17,5 +17,3 @@
create dataset MyData(MyRecord)
primary key id;
-create index rtree_index_point on MyData(point) type rtree;
-
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
new file mode 100644
index 0000000..b6a123e
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.3.ddl.aql
@@ -0,0 +1,3 @@
+use dataverse test;
+
+create index rtree_index_point on MyData(point) type rtree;
diff --git a/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql
similarity index 100%
rename from asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.3.query.aql
rename to asterix-app/src/test/resources/runtimets/queries/index-selection/rtree-secondary-index/rtree-secondary-index.4.query.aql
diff --git a/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.1.ddl.aql b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.1.ddl.aql
new file mode 100644
index 0000000..b9683dd
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.1.ddl.aql
@@ -0,0 +1,29 @@
+/*
+ * Description : Load dataset with float numbers containing "E-4f"
+ * Expected Res : Success
+ * Date : 01 Apr 2013
+ */
+
+drop dataverse test if exists;
+create dataverse test;
+use dataverse test;
+
+create type AddressType as open {
+ number: int32,
+ street: string,
+ city: string
+}
+
+create type CustomerType as closed {
+ cid: int32,
+ name: string,
+ age: int32?,
+ address: AddressType?,
+ lastorder: {
+ oid: int32,
+ total: float
+ }
+}
+
+create dataset Customers(CustomerType)
+primary key cid;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.2.update.aql b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.2.update.aql
new file mode 100644
index 0000000..f0671ca
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.2.update.aql
@@ -0,0 +1,11 @@
+/*
+ * Description : Load dataset with float numbers containing "E-4f"
+ * Expected Res : Success
+ * Date : 01 Apr 2013
+ */
+
+use dataverse test;
+
+load dataset Customers
+using "edu.uci.ics.asterix.external.dataset.adapter.NCFileSystemAdapter"
+(("path"="nc1://data/custord-tiny/customer-tiny-neg.adm"),("format"="adm")) pre-sorted;
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.3.query.aql b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.3.query.aql
new file mode 100644
index 0000000..1d2c9b6
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/queries/load/issue289_query/issue289_query.3.query.aql
@@ -0,0 +1,12 @@
+/*
+ * Description : Load dataset with float numbers containing "E-4f"
+ * Expected Res : Success
+ * Date : 01 Apr 2013
+ */
+
+use dataverse test;
+
+count(
+for $l in dataset('Customers')
+return $l
+)
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/results/load/issue289_query/issue289_query.1.adm b/asterix-app/src/test/resources/runtimets/results/load/issue289_query/issue289_query.1.adm
new file mode 100644
index 0000000..9a03714
--- /dev/null
+++ b/asterix-app/src/test/resources/runtimets/results/load/issue289_query/issue289_query.1.adm
@@ -0,0 +1 @@
+10
\ No newline at end of file
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index af77e2f..4eb7b0f 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -4046,6 +4046,11 @@
<expected-error>edu.uci.ics.asterix.common.exceptions.AsterixException</expected-error>
</compilation-unit>
</test-case>
+ <test-case FilePath="load">
+ <compilation-unit name="issue289_query">
+ <output-dir compare="Text">issue289_query</output-dir>
+ </compilation-unit>
+ </test-case>
</test-group>
<test-group name="hints">
<test-case FilePath="hints">
diff --git a/asterix-aql/src/main/javacc/AQL.jj b/asterix-aql/src/main/javacc/AQL.jj
index 5ede3ac..8e3e203 100644
--- a/asterix-aql/src/main/javacc/AQL.jj
+++ b/asterix-aql/src/main/javacc/AQL.jj
@@ -260,7 +260,7 @@
datasetName = nameComponents.second;
}
- (<LEFTPAREN>)? query = Query() (<RIGHTPAREN>)? (";")?
+ query = Query() (";")?
{return new InsertStatement(dataverseName, datasetName, query, getVarCounter());}
}
diff --git a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java
index 89caf4f..045df58 100644
--- a/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java
+++ b/asterix-maven-plugins/lexer-generator-maven-plugin/src/main/java/edu/uci/ics/asterix/lexergenerator/rules/RulePartial.java
@@ -61,8 +61,10 @@
public String javaMatch(String action) {
StringBuilder result = new StringBuilder();
result.append("if (parse_" + partialName + "(currentChar)==TOKEN_" + partialName + "){");
+ result.append("currentChar = buffer[bufpos];");
result.append(action);
result.append("}");
+ result.append("else { currentChar = buffer[bufpos];}");
return result.toString();
}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java
new file mode 100644
index 0000000..3773950
--- /dev/null
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/opcallbacks/PrimaryIndexInstantSearchOperationCallbackFactory.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright 2009-2012 by The Regents of the University of California
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * you may obtain a copy of the License from
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.uci.ics.asterix.transaction.management.opcallbacks;
+
+import edu.uci.ics.asterix.transaction.management.exception.ACIDException;
+import edu.uci.ics.asterix.transaction.management.service.transaction.ITransactionSubsystemProvider;
+import edu.uci.ics.asterix.transaction.management.service.transaction.JobId;
+import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionContext;
+import edu.uci.ics.asterix.transaction.management.service.transaction.TransactionSubsystem;
+import edu.uci.ics.hyracks.api.context.IHyracksTaskContext;
+import edu.uci.ics.hyracks.api.exceptions.HyracksDataException;
+import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallback;
+import edu.uci.ics.hyracks.storage.am.common.api.ISearchOperationCallbackFactory;
+
+public class PrimaryIndexInstantSearchOperationCallbackFactory extends AbstractOperationCallbackFactory implements
+ ISearchOperationCallbackFactory {
+
+ private static final long serialVersionUID = 1L;
+
+ public PrimaryIndexInstantSearchOperationCallbackFactory(JobId jobId, int datasetId, int[] entityIdFields,
+ ITransactionSubsystemProvider txnSubsystemProvider, byte resourceType) {
+ super(jobId, datasetId, entityIdFields, txnSubsystemProvider, resourceType);
+ }
+
+ @Override
+ public ISearchOperationCallback createSearchOperationCallback(long resourceId, IHyracksTaskContext ctx)
+ throws HyracksDataException {
+ TransactionSubsystem txnSubsystem = txnSubsystemProvider.getTransactionSubsystem(ctx);
+ try {
+ TransactionContext txnCtx = txnSubsystem.getTransactionManager().getTransactionContext(jobId);
+ return new PrimaryIndexInstantSearchOperationCallback(datasetId, primaryKeyFields,
+ txnSubsystem.getLockManager(), txnCtx);
+ } catch (ACIDException e) {
+ throw new HyracksDataException(e);
+ }
+ }
+
+}
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java
index 8abc5b1..75ff349 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/JobInfo.java
@@ -11,7 +11,7 @@
private int firstWaitingResource; //resource(entity or dataset) which this job is waiting for
private int upgradingResource; //resource(entity or dataset) which this job is waiting for to upgrade
- private PrimitiveIntHashMap dLockHT; //used for keeping dataset-granule-lock's count acquired by this job.
+ private PrimitiveIntHashMap datasetISLockHT; //used for keeping dataset-granule-lock's count acquired by this job.
public JobInfo(EntityInfoManager entityInfoManager, LockWaiterManager lockWaiterManager, TransactionContext txnCtx) {
this.entityInfoManager = entityInfoManager;
@@ -20,10 +20,10 @@
this.lastHoldingResource = -1;
this.firstWaitingResource = -1;
this.upgradingResource = -1;
- if (LockManager.ALLOW_UPGRADE_FROM_ENTITY_TO_DATASET) {
+ if (LockManager.ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
//This table maintains the number of locks acquired by this jobInfo.
//[Notice] But this doesn't decrease the count even if the lock is released.
- this.dLockHT = new PrimitiveIntHashMap(1 << 4, 1 << 2, Integer.MAX_VALUE);
+ this.datasetISLockHT = new PrimitiveIntHashMap(1 << 4, 1 << 2, Integer.MAX_VALUE);
}
}
@@ -43,10 +43,6 @@
entityInfoManager.setPrevJobResource(resource, lastHoldingResource);
entityInfoManager.setNextJobResource(resource, -1);
lastHoldingResource = resource;
-
- if (LockManager.ALLOW_UPGRADE_FROM_ENTITY_TO_DATASET) {
- increaseDatasetLockCount(resource);
- }
}
public void removeHoldingResource(int resource) {
@@ -187,18 +183,30 @@
// }
}
- private void increaseDatasetLockCount(int entityInfo) {
- int datasetId = entityInfoManager.getDatasetId(entityInfo);
- int count = dLockHT.get(datasetId);
+ public void increaseDatasetISLockCount(int datasetId) {
+ int count = datasetISLockHT.get(datasetId);
if (count == -1) {
- dLockHT.upsert(datasetId, 1);
+ datasetISLockHT.upsert(datasetId, 1);
} else {
- dLockHT.upsert(datasetId, count + 1);
+ datasetISLockHT.upsert(datasetId, count + 1);
}
}
- public int getDatasetLockCount(int datasetId) {
- int count = dLockHT.get(datasetId);
+ public void decreaseDatasetISLockCount(int datasetId) {
+ int count = datasetISLockHT.get(datasetId);
+ if (count >= LockManager.ESCALATE_TRHESHOLD_ENTITY_TO_DATASET) {
+ //do not decrease the count since it is already escalated.
+ } else if (count > 1) {
+ datasetISLockHT.upsert(datasetId, count - 1);
+ } else if (count == 1) {
+ datasetISLockHT.remove(datasetId);
+ } else if (count <= 0) {
+ throw new IllegalStateException("Illegal state of datasetLock count in JobInfo's dLockHT");
+ }
+ }
+
+ public int getDatasetISLockCount(int datasetId) {
+ int count = datasetISLockHT.get(datasetId);
if (count == -1) {
return 0;
} else {
@@ -207,17 +215,6 @@
}
/**********************************************************************************
- * public void decreaseDatasetLockCount(int entityInfo) {
- * int datasetId = entityInfoManager.getDatasetId(entityInfo);
- * int count = dLockHT.get(datasetId);
- * if (count > 1) {
- * dLockHT.upsert(datasetId, count-1);
- * } else if (count == 1) {
- * dLockHT.remove(datasetId);
- * } else if (count <= 0 ) {
- * throw new IllegalStateException("Illegal state of datasetLock count in JobInfo's dLockHT");
- * }
- * }
* public boolean isDatasetLockGranted(int datasetId) {
* return dLockHT.get(datasetId) == -1 ? false : true;
* }
diff --git a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java
index 5687656..1d47c0b 100644
--- a/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java
+++ b/asterix-transactions/src/main/java/edu/uci/ics/asterix/transaction/management/service/locking/LockManager.java
@@ -45,11 +45,11 @@
public static final boolean IS_DEBUG_MODE = false;//true
- public static final boolean ALLOW_UPGRADE_FROM_ENTITY_TO_DATASET = true;
- public static final int UPGRADE_TRHESHOLD_ENTITY_TO_DATASET = 10000;
- private static final int DO_UPGRADE = 0;
- private static final int UPGRADED = 1;
- private static final int DONOT_UPGRADE = 2;
+ public static final boolean ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET = true;
+ public static final int ESCALATE_TRHESHOLD_ENTITY_TO_DATASET = 1000;
+ private static final int DO_ESCALATE = 0;
+ private static final int ESCALATED = 1;
+ private static final int DONOT_ESCALATE = 2;
private TransactionSubsystem txnSubsystem;
@@ -117,6 +117,7 @@
DatasetLockInfo dLockInfo = null;
JobInfo jobInfo;
byte datasetLockMode = entityHashValue == -1 ? lockMode : lockMode == LockMode.S ? LockMode.IS : LockMode.IX;
+ boolean isEscalated = false;
latchLockTable();
validateJob(txnContext);
@@ -129,18 +130,19 @@
dLockInfo = datasetResourceHT.get(datasetId);
jobInfo = jobHT.get(jobId);
- if (ALLOW_UPGRADE_FROM_ENTITY_TO_DATASET) {
- if (jobInfo != null && dLockInfo != null && entityHashValue != -1) {
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (datasetLockMode == LockMode.IS && jobInfo != null && dLockInfo != null) {
int upgradeStatus = needUpgradeFromEntityToDataset(jobInfo, dId, lockMode);
switch (upgradeStatus) {
- case DO_UPGRADE:
+ case DO_ESCALATE:
entityHashValue = -1;
+ isEscalated = true;
break;
-
- case UPGRADED:
+
+ case ESCALATED:
unlatchLockTable();
return;
-
+
default:
break;
}
@@ -177,6 +179,12 @@
}
jobInfo.addHoldingResource(entityInfo);
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (datasetLockMode == LockMode.IS) {
+ jobInfo.increaseDatasetISLockCount(dId);
+ }
+ }
+
if (IS_DEBUG_MODE) {
trackLockRequest("Granted", RequestType.LOCK, datasetId, entityHashValue, lockMode, txnContext,
dLockInfo, eLockInfo);
@@ -195,6 +203,15 @@
lockEntityGranule(datasetId, entityHashValue, lockMode, entityInfo, txnContext);
}
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (isEscalated) {
+ releaseDatasetISLocks(jobInfo, jobId, datasetId, txnContext);
+ }
+ if (datasetLockMode == LockMode.IS) {
+ jobInfo.increaseDatasetISLockCount(dId);
+ }
+ }
+
if (IS_DEBUG_MODE) {
trackLockRequest("Granted", RequestType.LOCK, datasetId, entityHashValue, lockMode, txnContext, dLockInfo,
eLockInfo);
@@ -203,19 +220,46 @@
return;
}
+ private void releaseDatasetISLocks(JobInfo jobInfo, JobId jobId, DatasetId datasetId, TransactionContext txnContext)
+ throws ACIDException {
+ int entityInfo;
+ int prevEntityInfo;
+ int entityHashValue;
+ int did;//int-type dataset id
+
+ //while traversing all holding resources,
+ //release IS locks on the escalated dataset and
+ //release S locks on the corresponding enttites
+ //by calling unlock() method.
+ entityInfo = jobInfo.getLastHoldingResource();
+ while (entityInfo != -1) {
+ prevEntityInfo = entityInfoManager.getPrevJobResource(entityInfo);
+
+ //release a lock only if the datset is the escalated dataset and
+ //the entityHashValue is not -1("not -1" means a non-dataset-level lock)
+ did = entityInfoManager.getDatasetId(entityInfo);
+ entityHashValue = entityInfoManager.getPKHashVal(entityInfo);
+ if (did == datasetId.getId() && entityHashValue != -1) {
+ this.unlock(datasetId, entityHashValue, txnContext);
+ }
+
+ entityInfo = prevEntityInfo;
+ }
+ }
+
private int needUpgradeFromEntityToDataset(JobInfo jobInfo, int datasetId, byte lockMode) {
//we currently allow upgrade only if the lockMode is S.
if (lockMode != LockMode.S) {
- return DONOT_UPGRADE;
+ return DONOT_ESCALATE;
}
- int count = jobInfo.getDatasetLockCount(datasetId);
- if (count == UPGRADE_TRHESHOLD_ENTITY_TO_DATASET) {
- return DO_UPGRADE;
- } else if (count > UPGRADE_TRHESHOLD_ENTITY_TO_DATASET){
- return UPGRADED;
+ int count = jobInfo.getDatasetISLockCount(datasetId);
+ if (count == ESCALATE_TRHESHOLD_ENTITY_TO_DATASET) {
+ return DO_ESCALATE;
+ } else if (count > ESCALATE_TRHESHOLD_ENTITY_TO_DATASET) {
+ return ESCALATED;
} else {
- return DONOT_UPGRADE;
+ return DONOT_ESCALATE;
}
}
@@ -319,6 +363,27 @@
|| !dLockInfo.isCompatible(datasetLockMode)) {
/////////////////////////////////////////////////////////////////////////////////////////////
+ //[Notice] Mimicking SIX mode
+ //When the lock escalation from IS to S in dataset-level is allowed, the following case occurs
+ //DatasetLockInfo's SCount = 1 and the same job who carried out the escalation tries to insert,
+ //then the job should be able to insert without being blocked by itself.
+ //Our approach is to introduce SIX mode, but we don't have currently,
+ //so I simply mimicking SIX by allowing S and IX coexist in the dataset level
+ //only if their job id is identical for the requests.
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (datasetLockMode == LockMode.IX && dLockInfo.getSCount() == 1
+ && jobInfo.isDatasetLockGranted(dId, LockMode.S)) {
+ entityInfoManager.increaseDatasetLockCount(entityInfo);
+ //IX holders are implicitly handled without adding holder
+ dLockInfo.increaseLockCount(datasetLockMode);
+ //add entityInfo to JobInfo's holding-resource list
+ jobInfo.addHoldingResource(entityInfo);
+ return entityInfo;
+ }
+ }
+ ///////////////////////////////////////////////////////////////////////////////////////////////
+
+ /////////////////////////////////////////////////////////////////////////////////////////////
//[Notice]
//There has been no same caller as (jId, dId, entityHashValue) triplet.
//But there could be the same caller as (jId, dId) pair.
@@ -545,6 +610,7 @@
DatasetLockInfo dLockInfo = null;
JobInfo jobInfo;
int entityInfo = -1;
+ byte datasetLockMode;
if (IS_DEBUG_MODE) {
if (entityHashValue == -1) {
@@ -584,9 +650,10 @@
+ entityHashValue + "]: Corresponding lock info doesn't exist.");
}
+ datasetLockMode = entityInfoManager.getDatasetLockMode(entityInfo) == LockMode.S ? LockMode.IS : LockMode.IX;
+
//decrease the corresponding count of dLockInfo/eLockInfo/entityInfo
- dLockInfo.decreaseLockCount(entityInfoManager.getDatasetLockMode(entityInfo) == LockMode.S ? LockMode.IS
- : LockMode.IX);
+ dLockInfo.decreaseLockCount(datasetLockMode);
entityLockInfoManager.decreaseLockCount(eLockInfo, entityInfoManager.getEntityLockMode(entityInfo));
entityInfoManager.decreaseDatasetLockCount(entityInfo);
entityInfoManager.decreaseEntityLockCount(entityInfo);
@@ -663,6 +730,12 @@
//we don't deallocate datasetLockInfo even if there is no txn referring to the datasetLockInfo
//since the datasetLockInfo is likely to be referred to again.
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (datasetLockMode == LockMode.IS) {
+ jobInfo.decreaseDatasetISLockCount(datasetId.getId());
+ }
+ }
+
if (IS_DEBUG_MODE) {
trackLockRequest("Granted", RequestType.UNLOCK, datasetId, entityHashValue, (byte) 0, txnContext,
dLockInfo, eLockInfo);
@@ -916,6 +989,7 @@
JobInfo jobInfo;
byte datasetLockMode = entityHashValue == -1 ? lockMode : lockMode == LockMode.S ? LockMode.IS : LockMode.IX;
boolean isSuccess = false;
+ boolean isEscalated = false;
latchLockTable();
validateJob(txnContext);
@@ -928,18 +1002,19 @@
dLockInfo = datasetResourceHT.get(datasetId);
jobInfo = jobHT.get(jobId);
- if (ALLOW_UPGRADE_FROM_ENTITY_TO_DATASET) {
- if (jobInfo != null && dLockInfo != null && entityHashValue != -1) {
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (datasetLockMode == LockMode.IS && jobInfo != null && dLockInfo != null) {
int upgradeStatus = needUpgradeFromEntityToDataset(jobInfo, dId, lockMode);
switch (upgradeStatus) {
- case DO_UPGRADE:
+ case DO_ESCALATE:
entityHashValue = -1;
+ isEscalated = true;
break;
-
- case UPGRADED:
+
+ case ESCALATED:
unlatchLockTable();
return true;
-
+
default:
break;
}
@@ -976,6 +1051,12 @@
}
jobInfo.addHoldingResource(entityInfo);
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (datasetLockMode == LockMode.IS) {
+ jobInfo.increaseDatasetISLockCount(dId);
+ }
+ }
+
if (IS_DEBUG_MODE) {
trackLockRequest("Granted", RequestType.TRY_LOCK, datasetId, entityHashValue, lockMode, txnContext,
dLockInfo, eLockInfo);
@@ -1001,6 +1082,15 @@
}
}
+ if (ALLOW_ESCALATE_FROM_ENTITY_TO_DATASET) {
+ if (isEscalated) {
+ releaseDatasetISLocks(jobInfo, jobId, datasetId, txnContext);
+ }
+ if (datasetLockMode == LockMode.IS) {
+ jobInfo.increaseDatasetISLockCount(dId);
+ }
+ }
+
if (IS_DEBUG_MODE) {
if (isSuccess) {
trackLockRequest("Granted", RequestType.TRY_LOCK, datasetId, entityHashValue, lockMode, txnContext,