← Back to team overview

zorba-coders team mailing list archive

[Merge] lp:~zorba-coders/zorba/bug-986377 into lp:zorba

 

Matthias Brantner has proposed merging lp:~zorba-coders/zorba/bug-986377 into lp:zorba.

Requested reviews:
  Matthias Brantner (matthias-brantner)
  Markos Zaharioudakis (markos-za)
Related bugs:
  Bug #986377 in Zorba: "do not apply any updates on collection if it is to be truncated "
  https://bugs.launchpad.net/zorba/+bug/986377

For more details, see:
https://code.launchpad.net/~zorba-coders/zorba/bug-986377/+merge/105911

- no undo is done for collection truncate
- fix for bug #986377 "do not apply any updates on collection if it is to be truncated"
-- 
https://code.launchpad.net/~zorba-coders/zorba/bug-986377/+merge/105911
Your team Zorba Coders is subscribed to branch lp:zorba.
=== modified file 'ChangeLog'
--- ChangeLog	2012-05-15 21:12:27 +0000
+++ ChangeLog	2012-05-16 00:13:22 +0000
@@ -53,6 +53,7 @@
   * Fixed bug #906494 (default compile with D_FILE_OFFSET_BITS=64)
   * Fixed bug #988412 (date:current-dateTime daylight saving)
   * Fixed bug #912586, #912593 and #912722 (assertion failures with lax validation)
+  * Fixed bug #986377 (do not apply any updates on collection if it is to be truncated)
   * Fixed bug #921458 (file:read-text-lines() blocking)
   * Fixed bug #981405 (do not hoist expr containing try-catch variables out of the associated try-catch expression)
   * Fixed bug #996084 (crash in Streamable*Item with file module)

=== modified file 'include/zorba/pregenerated/diagnostic_list.h'
--- include/zorba/pregenerated/diagnostic_list.h	2012-05-13 15:33:57 +0000
+++ include/zorba/pregenerated/diagnostic_list.h	2012-05-16 00:13:22 +0000
@@ -588,8 +588,6 @@
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0018_NODES_NOT_IN_SAME_COLLECTION;
 
-extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0019_UNDO_NOT_POSSIBLE;
-
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0020_INDEX_DOMAIN_NODE_NOT_IN_COLLECTION;
 
 extern ZORBA_DLL_PUBLIC ZorbaErrorCode ZDDY0021_INDEX_NOT_DECLARED;

=== modified file 'modules/com/zorba-xquery/www/modules/pregenerated/errors.xq'
--- modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-05-13 15:33:57 +0000
+++ modules/com/zorba-xquery/www/modules/pregenerated/errors.xq	2012-05-16 00:13:22 +0000
@@ -466,10 +466,6 @@
 
 (:~
 :)
-declare variable $zerr:ZDDY0019 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0019");
-
-(:~
-:)
 declare variable $zerr:ZDDY0020 as xs:QName := fn:QName($zerr:NS, "zerr:ZDDY0020");
 
 (:~

=== modified file 'src/diagnostics/diagnostic_en.xml'
--- src/diagnostics/diagnostic_en.xml	2012-05-13 15:33:57 +0000
+++ src/diagnostics/diagnostic_en.xml	2012-05-16 00:13:22 +0000
@@ -2056,10 +2056,6 @@
       <value>all nodes must be in same collection</value>
     </diagnostic>
 
-    <diagnostic code="ZDDY0019" name="UNDO_NOT_POSSIBLE">
-      <value>"$1": collection $2 cannot be undone</value>
-    </diagnostic>
-
     <diagnostic code="ZDDY0020" name="INDEX_DOMAIN_NODE_NOT_IN_COLLECTION">
       <value>"$1": index domain expression yields nodes that are not in collection</value>
     </diagnostic>

=== modified file 'src/diagnostics/pregenerated/diagnostic_list.cpp'
--- src/diagnostics/pregenerated/diagnostic_list.cpp	2012-05-13 15:33:57 +0000
+++ src/diagnostics/pregenerated/diagnostic_list.cpp	2012-05-16 00:13:22 +0000
@@ -861,9 +861,6 @@
 ZorbaErrorCode ZDDY0018_NODES_NOT_IN_SAME_COLLECTION( "ZDDY0018" );
 
 
-ZorbaErrorCode ZDDY0019_UNDO_NOT_POSSIBLE( "ZDDY0019" );
-
-
 ZorbaErrorCode ZDDY0020_INDEX_DOMAIN_NODE_NOT_IN_COLLECTION( "ZDDY0020" );
 
 

=== modified file 'src/diagnostics/pregenerated/dict_en.cpp'
--- src/diagnostics/pregenerated/dict_en.cpp	2012-05-13 15:33:57 +0000
+++ src/diagnostics/pregenerated/dict_en.cpp	2012-05-16 00:13:22 +0000
@@ -287,7 +287,6 @@
   { "ZDDY0016", "\"$1\": multiple attemps to create a collection in the same snapshot" },
   { "ZDDY0017", "node does not belong to any collection" },
   { "ZDDY0018", "all nodes must be in same collection" },
-  { "ZDDY0019", "\"$1\": collection $2 cannot be undone" },
   { "ZDDY0020", "\"$1\": index domain expression yields nodes that are not in collection" },
   { "ZDDY0021", "\"$1\": undeclared index" },
   { "ZDDY0022", "\"$1\": index already exists" },

=== modified file 'src/store/naive/pul_primitives.cpp'
--- src/store/naive/pul_primitives.cpp	2012-05-03 12:31:51 +0000
+++ src/store/naive/pul_primitives.cpp	2012-05-16 00:13:22 +0000
@@ -1283,19 +1283,11 @@
   assert(lColl);
   
   lColl->removeAll();
-  theIsApplied = true;
-
 }
 
 void UpdTruncateCollection::undo()
 {
-  if (!theIsApplied) return;
-
-  throw ZORBA_EXCEPTION(
-    zerr::ZDDY0019_UNDO_NOT_POSSIBLE,
-    ERROR_PARAMS( theName->getStringValue(), "truncation" )
-  );
-
+  // NOOP
 }
 
 

=== modified file 'src/store/naive/simple_pul.cpp'
--- src/store/naive/simple_pul.cpp	2012-05-03 12:31:51 +0000
+++ src/store/naive/simple_pul.cpp	2012-05-16 00:13:22 +0000
@@ -2288,6 +2288,14 @@
   if (!theDeleteCollectionList.empty())
     return;
 
+  // if the collection is truncated, no other primitive needs to be applied
+  if (!theTruncateCollectionList.empty())
+  {
+    applyList(theTruncateCollectionList);
+    theIsApplied = true;
+    return;
+  }
+
   try
   {
     // Compute the before-delta for each incrementally maintained index.
@@ -2379,7 +2387,6 @@
     applyList(theCreateCollectionList);
     applyList(theInsertIntoCollectionList);
     applyList(theDeleteFromCollectionList);
-    applyList(theTruncateCollectionList);
 
     // Compute the after-delta for each incrementally maintained index.
     computeIndexAfterDeltas();


Follow ups