MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:June 7 2006 6:21am
Subject:bk commit into 5.0 tree (stewart:1.2146) BUG#18966
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of stewart. When stewart 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.2146 06/06/07 16:20:57 stewart@stripped +3 -0
  BUG#18966 CHange in stop/shutdown behaviour
  
  Fixes based on review by Tomas

  ndb/src/mgmsrv/Services.hpp
    1.19 06/06/07 16:20:46 stewart@stripped +1 -3
    Only 1 version of stopAll

  ndb/src/mgmsrv/Services.cpp
    1.64 06/06/07 16:20:46 stewart@stripped +14 -22
    Only have 1 version of 'stop all' with reply being dependent on if the optional
    stop parameter is supplied.

  ndb/src/mgmapi/mgmapi.cpp
    1.60 06/06/07 16:20:46 stewart@stripped +21 -9
    Return immediately if ndb_mgm_get_version fails.
    correctly use new protocol for versions > 5.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:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.0/jonas

--- 1.59/ndb/src/mgmapi/mgmapi.cpp	2006-05-23 16:24:19 +10:00
+++ 1.60/ndb/src/mgmapi/mgmapi.cpp	2006-06-07 16:20:46 +10:00
@@ -870,18 +870,24 @@
   if(handle->mgmd_version_build==-1)
   {
     char verstr[50];
-    ndb_mgm_get_version(handle,
+    if(!ndb_mgm_get_version(handle,
                         &(handle->mgmd_version_major),
                         &(handle->mgmd_version_minor),
                         &(handle->mgmd_version_build),
                         sizeof(verstr),
-                        verstr);
+                            verstr))
+    {
+      return -1;
+    }
   }
-  int use_v2= (handle->mgmd_version_major==5)
+  int use_v2= ((handle->mgmd_version_major==5)
     && (
         (handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21)
         ||(handle->mgmd_version_minor==1 && handle->mgmd_version_build>=12)
-        );
+        ||(handle->mgmd_version_minor>1)
+        )
+               )
+    || (handle->mgmd_version_major>5);
 
   if(no_of_nodes < -1){
     SET_ERROR(handle, NDB_MGM_ILLEGAL_NUMBER_OF_NODES, 
@@ -900,7 +906,7 @@
       args.put("stop", (no_of_nodes==-1)?"mgm,db":"db");
     const Properties *reply;
     if(use_v2)
-      reply = ndb_mgm_call(handle, stop_reply_v2, "stop all v2", &args);
+      reply = ndb_mgm_call(handle, stop_reply_v2, "stop all", &args);
     else
       reply = ndb_mgm_call(handle, stop_reply_v1, "stop all", &args);
     CHECK_REPLY(reply, -1);
@@ -1013,18 +1019,24 @@
   if(handle->mgmd_version_build==-1)
   {
     char verstr[50];
-    ndb_mgm_get_version(handle,
+    if(!ndb_mgm_get_version(handle,
                         &(handle->mgmd_version_major),
                         &(handle->mgmd_version_minor),
                         &(handle->mgmd_version_build),
                         sizeof(verstr),
-                        verstr);
+                            verstr))
+    {
+      return -1;
+    }
   }
-  int use_v2= (handle->mgmd_version_major==5)
+  int use_v2= ((handle->mgmd_version_major==5)
     && (
         (handle->mgmd_version_minor==0 && handle->mgmd_version_build>=21)
         ||(handle->mgmd_version_minor==1 && handle->mgmd_version_build>=12)
-        );
+        ||(handle->mgmd_version_minor>1)
+        )
+               )
+    || (handle->mgmd_version_major>5);
 
   if(no_of_nodes < 0){
     SET_ERROR(handle, NDB_MGM_RESTART_FAILED, 

--- 1.63/ndb/src/mgmsrv/Services.cpp	2006-05-23 16:24:19 +10:00
+++ 1.64/ndb/src/mgmsrv/Services.cpp	2006-06-07 16:20:46 +10:00
@@ -200,12 +200,9 @@
     MGM_ARG("node", String, Mandatory, "Node"),
     MGM_ARG("abort", Int, Mandatory, "Node"),
 
-  MGM_CMD("stop all", &MgmApiSession::stopAll_v1, ""),
+  MGM_CMD("stop all", &MgmApiSession::stopAll, ""),
     MGM_ARG("abort", Int, Mandatory, "Node"),
-
-  MGM_CMD("stop all v2", &MgmApiSession::stopAll_v2, ""),
-    MGM_ARG("abort", Int, Mandatory, "Node"),
-    MGM_ARG("stop", String, Mandatory, "MGM/DB or both"),
+    MGM_ARG("stop", String, Optional, "MGM/DB or both"),
 
   MGM_CMD("enter single user", &MgmApiSession::enterSingleUser, ""),
     MGM_ARG("nodeId", Int, Mandatory, "Node"),
@@ -1071,31 +1068,26 @@
   m_output->println("");
 }
 
-
 void
-MgmApiSession::stopAll_v1(Parser<MgmApiSession>::Context &,
-			      Properties const &args) {
-  stopAll(args,"db",1);
-}
-
-void
-MgmApiSession::stopAll_v2(Parser<MgmApiSession>::Context &,
-			      Properties const &args) {
-  BaseString tostop;
-  args.get("stop", tostop);
-  stopAll(args, tostop.c_str(), 2);
-}
-
-void
-MgmApiSession::stopAll(Properties const &args, const char* tostop, int ver) {
+MgmApiSession::stopAll(Parser<MgmApiSession>::Context &,
+                       Properties const &args) {
   int stopped[2] = {0,0};
   Uint32 abort;
   args.get("abort", &abort);
 
+  BaseString stop;
+  const char* tostop= "db";
+  int ver=1;
+  if (args.get("stop", stop))
+  {
+    tostop= stop.c_str();
+    ver= 2;
+  }
+
   int result= 0;
   if(strstr(tostop,"db"))
     result= m_mgmsrv.shutdownDB(&stopped[0], abort != 0);
-  if(strstr(tostop,"mgm"))
+  if(!result && strstr(tostop,"mgm"))
     result= m_mgmsrv.shutdownMGM(&stopped[1], abort!=0, &m_stopSelf);
 
   m_output->println("stop reply");

--- 1.18/ndb/src/mgmsrv/Services.hpp	2006-05-23 16:24:19 +10:00
+++ 1.19/ndb/src/mgmsrv/Services.hpp	2006-06-07 16:20:46 +10:00
@@ -80,9 +80,7 @@
   void stop_v1(Parser_t::Context &ctx, const class Properties &args);
   void stop_v2(Parser_t::Context &ctx, const class Properties &args);
   void stop(const class Properties &args, int version);
-  void stopAll_v1(Parser_t::Context &ctx, const class Properties &args);
-  void stopAll_v2(Parser_t::Context &ctx, const class Properties &args);
-  void stopAll(Properties const &args, const char* tostop, int ver);
+  void stopAll(Parser_t::Context &ctx, const class Properties &args);
   void start(Parser_t::Context &ctx, const class Properties &args);
   void startAll(Parser_t::Context &ctx, const class Properties &args);
   void bye(Parser_t::Context &ctx, const class Properties &args);
Thread
bk commit into 5.0 tree (stewart:1.2146) BUG#18966Stewart Smith7 Jun