List:Commits« Previous MessageNext Message »
From:tomas Date:March 9 2007 9:37am
Subject:bk commit into 5.0 tree (tomas:1.2396) BUG#25275
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of tomas. When tomas 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.2396 07/03/09 15:37:10 tomas@stripped +3 -0
  
  Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes
  - correction of part 1
      add ndb_waiter option to wait for single user mode

  ndb/tools/waiter.cpp
    1.27 07/03/09 15:37:03 tomas@stripped +11 -1
    add ndb_waiter option to wait for single user mode

  ndb/src/kernel/blocks/dbdict/Dbdict.hpp
    1.26 07/03/09 15:37:03 tomas@stripped +2 -0
    Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes
    - correction of part 1

  ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.74 07/03/09 15:37:02 tomas@stripped +21 -15
    Bug #25275 SINGLE USER MODE prevents ALTER on non-ndb tables for other mysqld nodes
    - correction of part 1

# 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:	tomas
# Host:	poseidon.mysql.com
# Root:	/home/tomas/mysql-5.0-telco-gca

--- 1.73/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-03-02 09:05:59 +07:00
+++ 1.74/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2007-03-09 15:37:02 +07:00
@@ -2910,9 +2910,7 @@ Dbdict::execCREATE_TABLE_REQ(Signal* sig
       break;
     }
 
-    if(getNodeState().getSingleUserMode() &&
-       (refToNode(signal->getSendersBlockRef()) !=
-        getNodeState().getSingleUserApi()))
+    if (checkSingleUserMode(signal->getSendersBlockRef()))
     {
       jam();
       parseRecord.errorCode = CreateTableRef::SingleUser;
@@ -3081,9 +3079,7 @@ Dbdict::execALTER_TABLE_REQ(Signal* sign
     return;
   }
   
-  if(getNodeState().getSingleUserMode() &&
-     (refToNode(signal->getSendersBlockRef()) !=
-      getNodeState().getSingleUserApi()))
+  if (checkSingleUserMode(signal->getSendersBlockRef()))
   {
     jam();
     alterTableRef(signal, req, AlterTableRef::SingleUser);
@@ -5419,9 +5415,7 @@ Dbdict::execDROP_TABLE_REQ(Signal* signa
     return;
   }
   
-  if(getNodeState().getSingleUserMode() &&
-     (refToNode(signal->getSendersBlockRef()) !=
-      getNodeState().getSingleUserApi()))
+  if (checkSingleUserMode(signal->getSendersBlockRef()))
   {
     jam();
     dropTableRef(signal, req, DropTableRef::SingleUser);
@@ -6558,9 +6552,7 @@ Dbdict::execCREATE_INDX_REQ(Signal* sign
         jam();
         tmperr = CreateIndxRef::Busy;
       }
-      else if(getNodeState().getSingleUserMode() &&
-              (refToNode(senderRef) !=
-               getNodeState().getSingleUserApi()))
+      else if (checkSingleUserMode(senderRef))
       {
         jam();
         tmperr = CreateIndxRef::SingleUser;
@@ -7135,9 +7127,7 @@ Dbdict::execDROP_INDX_REQ(Signal* signal
         jam();
         tmperr = DropIndxRef::Busy;
       }
-      else if(getNodeState().getSingleUserMode() &&
-              (refToNode(senderRef) !=
-               getNodeState().getSingleUserApi()))
+      else if (checkSingleUserMode(senderRef))
       {
         jam();
         tmperr = DropIndxRef::SingleUser;
@@ -10577,6 +10567,22 @@ Dbdict::getMetaAttribute(MetaData::Attri
   }
   new (&attr) MetaData::Attribute(*attrPtr.p);
   return 0;
+}
+
+/*
+  return 1 if all of the below is true
+  a) node in single user mode
+  b) senderRef is not a db node
+  c) senderRef nodeid is not the singleUserApi
+*/
+
+int Dbdict::checkSingleUserMode(Uint32 senderRef)
+{
+  Uint32 nodeId = refToNode(senderRef);
+  return
+    getNodeState().getSingleUserMode() &&
+    (getNodeInfo(nodeId).m_type != NodeInfo::DB) &&
+    (nodeId != getNodeState().getSingleUserApi());
 }
 
 CArray<KeyDescriptor> g_key_descriptor_pool;

--- 1.25/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2006-12-24 02:04:15 +07:00
+++ 1.26/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2007-03-09 15:37:03 +07:00
@@ -1997,6 +1997,8 @@ private:
   int getMetaTable(MetaData::Table& table, const char* tableName);
   int getMetaAttribute(MetaData::Attribute& attribute, const MetaData::Table&
table, Uint32 attributeId);
   int getMetaAttribute(MetaData::Attribute& attribute, const MetaData::Table&
table, const char* attributeName);
+
+  int checkSingleUserMode(Uint32 senderRef);
 };
 
 #endif

--- 1.26/ndb/tools/waiter.cpp	2006-12-24 02:04:22 +07:00
+++ 1.27/ndb/tools/waiter.cpp	2007-03-09 15:37:03 +07:00
@@ -30,12 +30,14 @@ waitClusterStatus(const char* _addr, ndb
 		  unsigned int _timeout);
 
 enum ndb_waiter_options {
-  OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST
+  OPT_WAIT_STATUS_NOT_STARTED = NDB_STD_OPTIONS_LAST,
+  OPT_WAIT_STATUS_SINGLE_USER
 };
 NDB_STD_OPTS_VARS;
 
 static int _no_contact = 0;
 static int _not_started = 0;
+static int _single_user = 0;
 static int _timeout = 120;
 
 const char *load_default_groups[]= { "mysql_cluster",0 };
@@ -49,6 +51,10 @@ static struct my_option my_long_options[
   { "not-started", OPT_WAIT_STATUS_NOT_STARTED, "Wait for cluster not started",
     (gptr*) &_not_started, (gptr*) &_not_started, 0,
     GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
+  { "single-user", OPT_WAIT_STATUS_SINGLE_USER,
+    "Wait for cluster to enter single user mode",
+    (gptr*) &_single_user, (gptr*) &_single_user, 0,
+    GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0 }, 
   { "timeout", 't', "Timeout to wait",
     (gptr*) &_timeout, (gptr*) &_timeout, 0,
     GET_INT, REQUIRED_ARG, 120, 0, 0, 0, 0, 0 }, 
@@ -89,6 +95,10 @@ int main(int argc, char** argv){
   else if (_not_started)
   {
     wait_status= NDB_MGM_NODE_STATUS_NOT_STARTED;
+  }
+  else if (_single_user)
+  {
+    wait_status= NDB_MGM_NODE_STATUS_SINGLEUSER;
   }
   else 
   {
Thread
bk commit into 5.0 tree (tomas:1.2396) BUG#25275tomas9 Mar