List:Commits« Previous MessageNext Message »
From:knielsen Date:February 20 2007 8:52am
Subject:bk commit into 5.1 tree (knielsen:1.2444)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of knielsen. When knielsen does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet@stripped, 2007-02-20 09:52:18+01:00, knielsen@ymer.(none) +3 -0
  A few minor cleanups for recent AbortOption behaviour change.

  storage/ndb/include/ndbapi/NdbOperation.hpp@stripped, 2007-02-20 09:52:14+01:00, knielsen@ymer.(none) +16 -5
    Add some comments describing the new AbortOption handling.

  storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp@stripped, 2007-02-20 09:52:14+01:00, knielsen@ymer.(none) +15 -2
    Fix example to work with new AbortOption handling.

  storage/ndb/src/ndbapi/NdbOperationDefine.cpp@stripped, 2007-02-20 09:52:14+01:00, knielsen@ymer.(none) +18 -2
    Add forgotten method implementations.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	knielsen
# Host:	ymer.(none)
# Root:	/usr/local/mysql/mysql-5.1-new-ndb

--- 1.41/storage/ndb/include/ndbapi/NdbOperation.hpp	2007-02-20 09:52:25 +01:00
+++ 1.42/storage/ndb/include/ndbapi/NdbOperation.hpp	2007-02-20 09:52:25 +01:00
@@ -98,7 +98,20 @@ public:
   };
 
   /**
-   * How should transaction be handled if operation fails
+   * How should transaction be handled if operation fails.
+   *
+   * If AO_IgnoreError, a failure in one operation will not abort the
+   * transaction, and NdbTransaction::execute() will return 0 (success). Use
+   * NdbOperation::getNdbError() to check for errors from individual
+   * operations.
+   *
+   * If AbortOnError, a failure in one operation will abort the transaction
+   * and cause NdbTransaction::execute() to return -1.
+   * 
+   * Abort option can be set on execute(), or in the individual operation.
+   * Setting AO_IgnoreError or AbortOnError in execute() overrides the settings
+   * on individual operations. Setting DefaultAbortOption in execute() (the
+   * default) causes individual operation settings to be used.
    *
    * For READ, default is AO_IgnoreError
    *     DML,  default is AbortOnError
@@ -1019,10 +1032,8 @@ protected:
   NdbBlob* theBlobList;
 
   /*
-   * Abort option per operation, used by blobs.  Default -1.  If set,
-   * overrides abort option on connection level.  If set to IgnoreError,
-   * does not cause execute() to return failure.  This is different from
-   * IgnoreError on connection level.
+   * Abort option per operation, used by blobs.
+   * See also comments on enum AbortOption.
    */
   Int8 m_abortOption;
 

--- 1.28/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2007-02-20 09:52:25 +01:00
+++ 1.29/storage/ndb/src/ndbapi/NdbOperationDefine.cpp	2007-02-20 09:52:25 +01:00
@@ -715,6 +715,22 @@ insertATTRINFO_error1:
 
 }//NdbOperation::insertATTRINFOloop()
 
+NdbOperation::AbortOption
+NdbOperation::getAbortOption() const
+{
+  return (AbortOption)m_abortOption;
+}
 
-
-
+int
+NdbOperation::setAbortOption(AbortOption ao)
+{
+  switch(ao)
+  {
+    case AO_IgnoreError:
+    case AbortOnError:
+      m_abortOption= ao;
+      return 0;
+    default:
+      return -1;
+  }
+}

--- 1.3/storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp	2007-02-20 09:52:25 +01:00
+++ 1.4/storage/ndb/ndbapi-examples/ndbapi_simple_index/ndbapi_simple_index.cpp	2007-02-20 09:52:25 +01:00
@@ -19,6 +19,17 @@
 //  Correct output from this program is:
 //
 //  ATTR1 ATTR2
+//    0     0
+//    1     1
+//    2     2
+//    3     3
+//    4     4
+//    5     5
+//    6     6
+//    7     7
+//    8     8
+//    9     9
+//  ATTR1 ATTR2
 //    0    10
 //    1     1
 //    2    12
@@ -166,7 +177,8 @@ int main(int argc, char** argv)
     NdbRecAttr *myRecAttr= myIndexOperation->getValue("ATTR1", NULL);
     if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
 
-    if(myTransaction->execute( NdbTransaction::Commit ) != -1)
+    if(myTransaction->execute( NdbTransaction::Commit,
+                               NdbOperation::AbortOnError ) != -1)
       printf(" %2d    %2d\n", myRecAttr->u_32_value(), i);
 
     myNdb->closeTransaction(myTransaction);
@@ -232,7 +244,8 @@ int main(int argc, char** argv)
       NdbRecAttr *myRecAttr= myOperation->getValue("ATTR2", NULL);
       if (myRecAttr == NULL) APIERROR(myTransaction->getNdbError());
     
-      if(myTransaction->execute( NdbTransaction::Commit ) == -1)
+      if(myTransaction->execute( NdbTransaction::Commit,
+                                 NdbOperation::AbortOnError ) == -1)
 	if (i == 3) {
 	  std::cout << "Detected that deleted tuple doesn't exist!\n";
 	} else {
Thread
bk commit into 5.1 tree (knielsen:1.2444)knielsen20 Feb