List:Internals« Previous MessageNext Message »
From:Martin Skold Date:October 13 2005 2:38pm
Subject:bk commit into 4.1 tree (mskold:1.2475)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 repository of marty. When marty 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.2475 05/10/13 14:38:30 mskold@stripped +1 -0
  Fixed so that TABLE LOCK does not start two transactions in start_stmt, only one

  sql/ha_ndbcluster.cc
    1.173 05/10/13 14:38:03 mskold@stripped +18 -15
    Fixed so that TABLE LOCK does not start two transactions in start_stmt, only one

# 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:	mskold
# Host:	blowfish.ndb.mysql.com
# Root:	/usr/local/home/marty/MySQL/mysql-4.1

--- 1.172/sql/ha_ndbcluster.cc	2005-09-26 16:49:10 +02:00
+++ 1.173/sql/ha_ndbcluster.cc	2005-10-13 14:38:03 +02:00
@@ -1027,7 +1027,7 @@
 
 int ha_ndbcluster::get_ndb_lock_type(enum thr_lock_type type)
 {
-  if (type >= TL_WRITE_ALLOW_WRITE)
+  if (type > TL_READ)
     return NdbOperation::LM_Exclusive;
   else if (uses_blob_value(m_retrieve_all_fields))
     return NdbOperation::LM_Read;
@@ -3172,12 +3172,18 @@
 
   if (lock_type != F_UNLCK)
   {
-    DBUG_PRINT("info", ("lock_type != F_UNLCK"));
+    DBUG_PRINT("info", ("lock_type(%i) != F_UNLCK", lock_type));
+    if (lock_type == F_WRLCK)
+    {
+      /* SELECT ... FOR UPDATE */
+      DBUG_PRINT("info", ("lock_type == F_WRLCK"));
+      m_lock.type= TL_WRITE;
+    }
     if (!thd_ndb->lock_count++)
     {
       PRINT_OPTION_FLAGS(thd);
 
-      if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN |
OPTION_TABLE_LOCK))) 
+      if (!(thd->options & (OPTION_NOT_AUTOCOMMIT | OPTION_BEGIN))) 
       {
         // Autocommit transaction
         DBUG_ASSERT(!thd->transaction.stmt.ndb_tid);
@@ -3328,11 +3334,11 @@
 }
 
 /*
-  When using LOCK TABLE's external_lock is only called when the actual
-  TABLE LOCK is done.
-  Under LOCK TABLES, each used tables will force a call to start_stmt.
-  Ndb doesn't currently support table locks, and will do ordinary
-  startTransaction for each transaction/statement.
+  Start a transaction for running a statement if one is not
+  already running in a transaction. This will be the case in
+  a BEGIN; COMMIT; block
+  When using LOCK TABLE's external_lock will start a transaction
+  since ndb does not currently does not support table locking
 */
 
 int ha_ndbcluster::start_stmt(THD *thd)
@@ -3341,16 +3347,13 @@
   DBUG_ENTER("start_stmt");
   PRINT_OPTION_FLAGS(thd);
 
-  NdbConnection *trans= (NdbConnection*)thd->transaction.stmt.ndb_tid;
+  NdbConnection *trans= 
+    (thd->transaction.stmt.ndb_tid)
+    ? (NdbConnection *)(thd->transaction.stmt.ndb_tid)
+    : (NdbConnection *)(thd->transaction.all.ndb_tid);
   if (!trans){
     Ndb *ndb= ((Thd_ndb*)thd->transaction.thd_ndb)->ndb;
     DBUG_PRINT("trans",("Starting transaction stmt"));  
-    
-    NdbConnection *tablock_trans= 
-      (NdbConnection*)thd->transaction.all.ndb_tid;
-    DBUG_PRINT("info", ("tablock_trans: %x", (UintPtr)tablock_trans));
-    DBUG_ASSERT(tablock_trans);
-//    trans= ndb->hupp(tablock_trans);
     trans= ndb->startTransaction();
     if (trans == NULL)
       ERR_RETURN(ndb->getNdbError());
Thread
bk commit into 4.1 tree (mskold:1.2475)Martin Skold13 Oct