MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:pekka Date:May 11 2006 10:59am
Subject:bk commit into 5.0 tree (pekka:1.2124) BUG#14509
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of pekka. When pekka 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
  1.2124 06/05/11 12:58:45 pekka@stripped +2 -0
  ndb - bug#14509 (5.0) part 2: create SYSTAB_0 row on first use

  ndb/src/ndbapi/Ndb.cpp
    1.56 06/05/11 12:48:53 pekka@stripped +26 -7
    create SYSTAB_0 row on first use (use writeTuple).
    fix check of interpreted program return code

  ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp
    1.28 06/05/11 12:46:41 pekka@stripped +4 -6
    do not pre-create tupleid values (the values were obsolete too).
    they are created on first use.
    this is easy way to handle rolling upgrade when number of tables is increased

# 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:	pekka
# Host:	orca.ndb.mysql.com
# Root:	/space/pekka/ndb/version/my50-bug14509

--- 1.27/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-04-07 10:39:40 +02:00
+++ 1.28/ndb/src/kernel/blocks/ndbcntr/NdbcntrMain.cpp	2006-05-11 12:46:41 +02:00
@@ -1607,10 +1607,9 @@
 /*       |-2048| # 1 00000001    |                                           */
 /*       |  :  |   :             |                                           */
 /*       | -1  | # 1 00000001    |                                           */
-/*       |  0  |   0             |                                           */
-/*       |  1  |   0             |                                           */
-/*       |  :  |   :             |                                           */
-/*       | 2047|   0             |                                           */
+/*       |  1  |   0             | tupleid sequence now created on first use */
+/*       |  :  |   :             |                   v                       */
+/*       | 2048|   0             |                   v                       */
 /*---------------------------------------------------------------------------*/
 void Ndbcntr::createSystableLab(Signal* signal, unsigned index)
 {
@@ -1819,8 +1818,7 @@
     jam();
     ckey = 1;
     ctransidPhase = ZFALSE;
-    crSystab7Lab(signal);
-    return;
+    // skip 2nd loop - tupleid sequence now created on first use
   }//if
   signal->theData[0] = ctcConnectionP;
   signal->theData[1] = reference();

--- 1.55/ndb/src/ndbapi/Ndb.cpp	2006-05-08 15:16:52 +02:00
+++ 1.56/ndb/src/ndbapi/Ndb.cpp	2006-05-11 12:48:53 +02:00
@@ -813,6 +813,10 @@
     if (cacheSize == 0)
       cacheSize = 1;
     DBUG_PRINT("info", ("reading %u values from database", (uint)cacheSize));
+    /*
+     * reserve next cacheSize entries in db.  adds cacheSize to NEXTID
+     * and returns first tupleId in the new range.
+     */
     tupleId = opTupleIdOnNdb(info, cacheSize, 0);
   }
   DBUG_RETURN(tupleId);
@@ -865,8 +869,12 @@
     assert(info->m_first_tuple_id < info->m_last_tuple_id);
     tupleId = info->m_first_tuple_id + 1;
   }
-  else // Cache is empty, check next in database
+  else
   {
+    /*
+     * peek at NEXTID.  does not reserve it so the value is valid
+     * only if no other transactions are allowed.
+     */
     tupleId = opTupleIdOnNdb(info, 0, 3);
   }
   DBUG_RETURN(tupleId);
@@ -913,7 +921,6 @@
   {
     if (info->m_first_tuple_id != info->m_last_tuple_id)
     {
-      // We have a cache sequence
       assert(info->m_first_tuple_id < info->m_last_tuple_id);
       if (val <= info->m_first_tuple_id + 1)
 	DBUG_RETURN(false);
@@ -922,11 +929,17 @@
 	info->m_first_tuple_id = val - 1;
 	DBUG_RETURN(true);
       }
-      // else continue;
     }
+    /*
+     * if value <= NEXTID, do nothing.  otherwise update NEXTID to
+     * value and set cached range to first = last = value - 1.
+     */
     DBUG_RETURN((opTupleIdOnNdb(info, val, 2) == val));
   }
   else
+    /*
+     * update NEXTID to given value.  reset cached range.
+     */
     DBUG_RETURN((opTupleIdOnNdb(info, val, 1) == val));
 }
 
@@ -980,7 +993,8 @@
       ret = info->m_first_tuple_id;
       break;
     case 1:
-      tOperation->updateTuple();
+      // create on first use
+      tOperation->writeTuple();
       tOperation->equal("SYSKEY_0", aTableId );
       tOperation->setValue("NEXTID", opValue);
 
@@ -996,6 +1010,7 @@
       tOperation->equal("SYSKEY_0", aTableId );
       tOperation->load_const_u64(1, opValue);
       tOperation->read_attr("NEXTID", 2);
+      // compare NEXTID >= opValue
       tOperation->branch_le(2, 1, 0);
       tOperation->write_attr("NEXTID", 1);
       tOperation->interpret_exit_ok();
@@ -1003,10 +1018,14 @@
       tOperation->interpret_exit_nok(9999);
       
       if ( (result = tConnection->execute( Commit )) == -1 )
-        goto error_handler;
-      
-      if (result == 9999)
+      {
+        if (tConnection->theError.code != 9999)
+          goto error_handler;
+
+        // NEXTID >= opValue, return ~(Uint64)0 for now since
+        // there is no error check...
         ret = ~(Uint64)0;
+      }
       else
       {
         info->m_first_tuple_id = info->m_last_tuple_id = opValue - 1;
Thread
bk commit into 5.0 tree (pekka:1.2124) BUG#14509pekka11 May