List:Commits« Previous MessageNext Message »
From:Magnus Svensson Date:December 16 2008 4:41pm
Subject:bzr commit into mysql-5.1 branch (msvensson:3175)
View as plain text  
#At file:///home/msvensson/mysql/6.4/ based on revid:msvensson@stripped

 3175 Magnus Svensson	2008-12-16 [merge]
      Merge
modified:
  storage/ndb/include/kernel/signaldata/ConfigChange.hpp
  storage/ndb/include/mgmapi/mgmapi_error.h
  storage/ndb/src/mgmapi/mgmapi.cpp
  storage/ndb/src/mgmsrv/ConfigManager.cpp
  storage/ndb/src/mgmsrv/MgmtSrvr.cpp
  storage/ndb/src/mgmsrv/MgmtSrvr.hpp
  storage/ndb/src/mgmsrv/Services.cpp

=== modified file 'storage/ndb/include/kernel/signaldata/ConfigChange.hpp'
--- a/storage/ndb/include/kernel/signaldata/ConfigChange.hpp	2008-12-16 11:53:18 +0000
+++ b/storage/ndb/include/kernel/signaldata/ConfigChange.hpp	2008-12-16 16:27:47 +0000
@@ -75,8 +75,9 @@ class ConfigChangeRef {
     NotMaster               = 2,
     NoConfigData            = 3,
     ConfigChangeAborted     = 4,
-    FailedToStart           = 5,
-    SetGenerationFailed     = 10,
+    ConfigNotOk             = 5,
+
+    InternalError           = 10,
     PrepareFailed           = 11,
     IllegalConfigChange     = 13,
     FailedToUnpack          = 14,
@@ -98,15 +99,14 @@ public:
       return "No config data in signal";
     case ConfigChangeAborted:
       return "Config change was aborted";
-    case FailedToStart:
-      return "Failed to start config change";
-    case SetGenerationFailed:
-      return "setGeneration failed";
     case FailedToUnpack:
       return "Failed to unpack the configuration";
     case IllegalConfigChange:
       return "Illegal config change";
 
+    case InternalError:
+      return "ConfigChangeRef, internal error";
+
     default:
       return "ConfigChangeRef, unknown error";
     }

=== modified file 'storage/ndb/include/mgmapi/mgmapi_error.h'
--- a/storage/ndb/include/mgmapi/mgmapi_error.h	2008-03-28 08:03:06 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi_error.h	2008-12-16 16:27:47 +0000
@@ -72,6 +72,10 @@ extern "C" {
     /** Unable to exit single user mode */
     NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE = 4002,
 
+    /* Service errors - Configuration change */
+    /** Unable to start config change */
+    NDB_MGM_CONFIG_CHANGE_FAILED = 4011,
+
     /* Usage errors */
     /** Usage error */
     NDB_MGM_USAGE_ERROR = 5001
@@ -109,6 +113,10 @@ extern "C" {
     { NDB_MGM_COULD_NOT_EXIT_SINGLE_USER_MODE,
       "Could not exit single user mode" },
 
+    /* Service errors - Configuration change */
+    { NDB_MGM_CONFIG_CHANGE_FAILED,
+      "Failed to complete configuration change" },
+
     /* Usage errors */
     { NDB_MGM_USAGE_ERROR,
       "Usage error" }

=== modified file 'storage/ndb/src/mgmapi/mgmapi.cpp'
--- a/storage/ndb/src/mgmapi/mgmapi.cpp	2008-12-16 02:28:02 +0000
+++ b/storage/ndb/src/mgmapi/mgmapi.cpp	2008-12-16 16:41:33 +0000
@@ -3094,6 +3094,10 @@ extern "C"
 int
 ndb_mgm_set_configuration(NdbMgmHandle h, ndb_mgm_configuration *c)
 {
+  CHECK_HANDLE(h, 0);
+  SET_ERROR(h, NDB_MGM_NO_ERROR, "Executing: ndb_mgm_set_configuration");
+  CHECK_CONNECTED(h, 0);
+
   const ConfigValues * cfg = (ConfigValues*)c;
 
   UtilBuffer buf;
@@ -3130,6 +3134,7 @@ ndb_mgm_set_configuration(NdbMgmHandle h
 
   if(strcmp(result.c_str(), "Ok") != 0) {
     fprintf(h->errstream, "ERROR Message: %s\n", result.c_str());
+    SET_ERROR(h, NDB_MGM_CONFIG_CHANGE_FAILED, result.c_str());
     return -1;
   }
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigManager.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigManager.cpp	2008-12-16 15:53:28 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigManager.cpp	2008-12-16 16:27:47 +0000
@@ -817,7 +817,7 @@ ConfigManager::execCONFIG_CHANGE_IMPL_RE
     {
       g_eventLogger->error("Failed to set new generation to %d",
                            new_generation);
-      sendConfigChangeImplRef(ss, nodeId, ConfigChangeRef::SetGenerationFailed);
+      sendConfigChangeImplRef(ss, nodeId, ConfigChangeRef::InternalError);
       return;
     }
 
@@ -1193,7 +1193,7 @@ ConfigManager::execCONFIG_CHANGE_REQ(Sig
   {
     g_eventLogger->warning("Refusing to start config change, the config "\
                            "is not ok");
-    sendConfigChangeRef(ss, from, ConfigChangeRef::FailedToUnpack);
+    sendConfigChangeRef(ss, from, ConfigChangeRef::ConfigNotOk);
     return;
   }
 

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-12-16 14:09:42 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp	2008-12-16 16:41:33 +0000
@@ -3830,8 +3830,8 @@ int MgmtSrvr::ndbinfo(Uint32 tableId, 
 }
 
 
-int
-MgmtSrvr::change_config(Config& new_config)
+bool
+MgmtSrvr::change_config(Config& new_config, BaseString& msg)
 {
   SignalSender ss(theFacade);
   ss.lock();
@@ -3851,12 +3851,19 @@ MgmtSrvr::change_config(Config& new_conf
 
   NodeId nodeId= ss.find_confirmed_node(mgm_nodes);
   if (nodeId == 0)
-    return -1; // Hrmpf?
+  {
+    msg = "INTERNAL ERROR Could not find any mgmd!";
+    return false;
+  }
 
   if (ss.sendSignal(nodeId, ssig,
                     MGM_CONFIG_MAN, GSN_CONFIG_CHANGE_REQ,
                     ConfigChangeReq::SignalLength) != SEND_OK)
-    return SEND_OR_RECEIVE_FAILED;
+  {
+    msg.assfmt("Could not start configuration change, send to "
+               "node %d failed", nodeId);
+    return false;
+  }
   mgm_nodes.clear(nodeId);
 
   bool done = false;
@@ -3879,18 +3886,26 @@ MgmtSrvr::change_config(Config& new_conf
         // Retry with next node if any
         NodeId nodeId= ss.find_confirmed_node(mgm_nodes);
         if (nodeId == 0)
-          return -1; // Hrmpf?
+        {
+          msg = "INTERNAL ERROR Could not find any mgmd!";
+          return false;
+        }
 
         if (ss.sendSignal(nodeId, ssig,
                           MGM_CONFIG_MAN, GSN_CONFIG_CHANGE_REQ,
                           ConfigChangeReq::SignalLength) != SEND_OK)
-          return SEND_OR_RECEIVE_FAILED;
+        {
+          msg.assfmt("Could not start configuration change, send to "
+                     "node %d failed", nodeId);
+          return false;
+        }
         mgm_nodes.clear(nodeId);
         break;
       }
 
       default:
-        return ref->errorCode;
+        msg = ConfigChangeRef::errorMessage(ref->errorCode);
+        return false;
       }
 
       break;
@@ -3995,13 +4010,8 @@ MgmtSrvr::reload_config(const char* conf
     }
   }
 
-  int res;
-  if ((res= change_config(new_conf)) != 0)
-  {
-    msg.assfmt("error: %d", res);
+  if (!change_config(new_conf, msg))
     return false;
-  }
-
   return true;
 }
 

=== modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.hpp'
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2008-12-16 14:31:45 +0000
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp	2008-12-16 16:41:33 +0000
@@ -363,7 +363,7 @@ public:
 		     int &error_code, BaseString &error_string,
                      int log_event = 1);
 
-  int change_config(Config& new_config);
+  bool change_config(Config& new_config, BaseString& msg);
 
   /**
    *

=== modified file 'storage/ndb/src/mgmsrv/Services.cpp'
--- a/storage/ndb/src/mgmsrv/Services.cpp	2008-12-16 14:09:42 +0000
+++ b/storage/ndb/src/mgmsrv/Services.cpp	2008-12-16 16:41:33 +0000
@@ -2030,10 +2030,8 @@ void MgmApiSession::setConfig(Parser_t::
     }
     delete decoded;
 
-    int res;
     Config new_config(cvf.getConfigValues());
-    if ((res= m_mgmsrv.change_config(new_config)) != 0)
-      result.assfmt("error: %d", res);
+    (void)m_mgmsrv.change_config(new_config, result);
   }
 
 done:

Thread
bzr commit into mysql-5.1 branch (msvensson:3175) Magnus Svensson16 Dec