Add Support for Upsert Operation

This change allows users to execute upsert commands which
couples delete if found with insert. It locks the primary
keys before doing the search ensuring consistency.

Change-Id: I8999000331795a5949d621d2dd003903e057a521
Reviewed-on: https://asterix-gerrit.ics.uci.edu/477
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Till Westmann <tillw@apache.org>
diff --git a/asterix-app/src/test/resources/runtimets/testsuite.xml b/asterix-app/src/test/resources/runtimets/testsuite.xml
index 5d55f2d..621c73a 100644
--- a/asterix-app/src/test/resources/runtimets/testsuite.xml
+++ b/asterix-app/src/test/resources/runtimets/testsuite.xml
@@ -1240,8 +1240,65 @@
         </test-case>
         -->
     </test-group>
+    <test-group name="upsert">
+        <test-case FilePath="upsert">
+            <compilation-unit name="primary-secondary-rtree">
+                <output-dir compare="Text">primary-secondary-rtree</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="upsert-with-self-read">
+                <output-dir compare="Text">upsert-with-self-read</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="filtered-dataset">
+                <output-dir compare="Text">filtered-dataset</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="nullable-index">
+                <output-dir compare="Text">nullable-index</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="nested-index">
+                <output-dir compare="Text">nested-index</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="open-index">
+                <output-dir compare="Text">open-index</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="primary-index">
+                <output-dir compare="Text">primary-index</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="primary-secondary-btree">
+                <output-dir compare="Text">primary-secondary-btree</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="primary-secondary-inverted">
+                <output-dir compare="Text">primary-secondary-inverted</output-dir>
+            </compilation-unit>
+        </test-case>
+        <test-case FilePath="upsert">
+            <compilation-unit name="multiple-secondaries">
+                <output-dir compare="Text">multiple-secondaries</output-dir>
+            </compilation-unit>
+        </test-case>
+    </test-group>
     <test-group name="dml">
          <test-case FilePath="dml">
+            <compilation-unit name="load-with-ngram-index">
+                <output-dir compare="Text">load-with-ngram-index</output-dir>
+            </compilation-unit>
+        </test-case>
+         <test-case FilePath="dml">
             <compilation-unit name="insert-duplicated-keys-from-query">
                 <output-dir compare="Text">insert-duplicated-keys-from-query</output-dir>
                 <expected-error>org.apache.hyracks.storage.am.common.exceptions.TreeIndexDuplicateKeyException: Failed to insert key since key already exists</expected-error>
@@ -1470,11 +1527,6 @@
             </compilation-unit>
         </test-case>
         <test-case FilePath="dml">
-            <compilation-unit name="load-with-ngram-index">
-                <output-dir compare="Text">load-with-ngram-index</output-dir>
-            </compilation-unit>
-        </test-case>
-        <test-case FilePath="dml">
             <compilation-unit name="load-with-rtree-index">
                 <output-dir compare="Text">load-with-rtree-index</output-dir>
             </compilation-unit>