List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:September 20 2005 9:34am
Subject:bk commit into 4.1 tree (stewart:1.2437)
View as plain text  
Below is the list of changes that have just been committed into a local
4.1 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.2437 05/09/20 17:34:46 stewart@stripped +8 -0
  Remove old and usused configuration locking code.
  
  Some new code that does this job is being written against 5.1. This code is
  largely removed from that work.

  ndb/src/mgmsrv/Services.hpp
    1.9 05/09/20 17:34:43 stewart@stripped +0 -3
    remove usused configuration locking code

  ndb/src/mgmsrv/Services.cpp
    1.37 05/09/20 17:34:43 stewart@stripped +0 -59
    remove unused configuration locking code

  ndb/src/mgmsrv/MgmtSrvrConfig.cpp
    1.7 05/09/20 17:34:43 stewart@stripped +0 -235
    remove CONFIG (UN)LOCK signals, lockConf/unlockConf, commit/rollback and changeConfig.
    
    never used.

  ndb/src/mgmsrv/MgmtSrvr.hpp
    1.31 05/09/20 17:34:43 stewart@stripped +0 -36
    remove prototypes for config lock and commit/rollback.

  ndb/src/mgmsrv/MgmtSrvr.cpp
    1.70 05/09/20 17:34:43 stewart@stripped +0 -20
    remove unused getPrimaryNode

  ndb/src/mgmsrv/Config.hpp
    1.7 05/09/20 17:34:43 stewart@stripped +0 -10
    remove unused generation number prototypes.

  ndb/src/mgmsrv/Config.cpp
    1.7 05/09/20 17:34:43 stewart@stripped +0 -87
    remove unused generation number code.
    
    remove unused Config::change

  ndb/include/kernel/GlobalSignalNumbers.h
    1.10 05/09/20 17:34:43 stewart@stripped +0 -8
    remove dead (never used) MGM_(UN)LOCK signal numbers

# 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/4.1/mgmd

--- 1.9/ndb/include/kernel/GlobalSignalNumbers.h	2005-09-13 00:08:12 +10:00
+++ 1.10/ndb/include/kernel/GlobalSignalNumbers.h	2005-09-20 17:34:43 +10:00
@@ -834,14 +834,6 @@
 /* Start Global Replication */
 #define GSN_GREP_REQ                    656
 
-/**
- * Management server
- */
-#define GSN_MGM_LOCK_CONFIG_REQ		657
-#define GSN_MGM_LOCK_CONFIG_REP		658
-#define GSN_MGM_UNLOCK_CONFIG_REQ	659
-#define GSN_MGM_UNLOCK_CONFIG_REP	660
-
 #define GSN_UTIL_CREATE_LOCK_REQ        132
 #define GSN_UTIL_CREATE_LOCK_REF        133
 #define GSN_UTIL_CREATE_LOCK_CONF       188

--- 1.6/ndb/src/mgmsrv/Config.cpp	2004-11-10 10:39:10 +11:00
+++ 1.7/ndb/src/mgmsrv/Config.cpp	2005-09-20 17:34:43 +10:00
@@ -179,90 +179,3 @@
   }
 #endif
 }
-
-Uint32
-Config::getGenerationNumber() const {
-#if 0
-  Uint32 ret;
-  const Properties *prop = NULL;
-
-  get("SYSTEM", &prop);
-
-  if(prop != NULL)
-    if(prop->get("ConfigGenerationNumber", &ret))
-      return ret;
-  
-  return 0;
-#else
-  return 0;
-#endif
-}
-
-int
-Config::setGenerationNumber(Uint32 gen) {
-#if 0
-  Properties *prop = NULL;
-
-  getCopy("SYSTEM", &prop);
-
-  if(prop != NULL) {
-    MGM_REQUIRE(prop->put("ConfigGenerationNumber", gen, true));
-    MGM_REQUIRE(put("SYSTEM", prop, true));
-    return 0;
-  }
-  return -1;
-#else
-  return -1;
-#endif
-}
-
-bool
-Config::change(const BaseString &section,
-	       const BaseString &param,
-	       const BaseString &value) {
-#if 0
-  const char *name;
-  Properties::Iterator it(this);
-
-  for(name = it.first(); name != NULL; name = it.next()) {
-    Properties *prop = NULL;
-    if(strcasecmp(section.c_str(), name) == 0) {
-      getCopy(name, &prop);
-      if(prop == NULL) /* doesn't exist */
-	return false;
-      if(value == "") {
-	prop->remove(param.c_str());
-	put(section.c_str(), prop, true);
-      } else {
-	PropertiesType t;
-	if(!prop->getTypeOf(param.c_str(), &t)) /* doesn't exist */
-	  return false;
-	switch(t) {
-	case PropertiesType_Uint32:
-	  long val;
-	  char *ep;
-	  errno = 0;
-	  val = strtol(value.c_str(), &ep, 0);
-	  if(value.length() == 0 || *ep != '\0')  /* not a number */
-	    return false;
-	  if(errno == ERANGE)
-	    return false;
-	  prop->put(param.c_str(), (unsigned int)val, true);
-	  put(section.c_str(), prop, true);
-	  break;
-	case PropertiesType_char:
-	  prop->put(param.c_str(), value.c_str(), true);
-	  put(section.c_str(), prop, true);
-	  break;
-	default:
-	  return false;
-	}
-      }
-      break;
-    }
-  }
-  return true;
-#else
-  return false;
-#endif
-}

--- 1.6/ndb/src/mgmsrv/Config.hpp	2004-08-27 21:48:20 +10:00
+++ 1.7/ndb/src/mgmsrv/Config.hpp	2005-09-20 17:34:43 +10:00
@@ -60,16 +60,6 @@
     printConfigFile(ndb);
   }
 
-  Uint32 getGenerationNumber() const;
-  int setGenerationNumber(Uint32);
-
-  /** Change configuration
-   */
-  bool change(const BaseString &section,
-	      const BaseString &param,
-	      const BaseString &value);
-
-
   /**
    * Info
    */

--- 1.69/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-09-13 08:22:02 +10:00
+++ 1.70/ndb/src/mgmsrv/MgmtSrvr.cpp	2005-09-20 17:34:43 +10:00
@@ -2086,26 +2086,6 @@
   return 0;
 }
 
-
-NodeId
-MgmtSrvr::getPrimaryNode() const {
-#if 0
-  Uint32 tmp;
-  const Properties *prop = NULL;
-
-  getConfig()->get("SYSTEM", &prop);
-  if(prop == NULL)
-    return 0;
-
-  prop->get("PrimaryMGMNode", &tmp);
-  
-  return tmp;
-#else
-  return 0;
-#endif
-}
-
-
 MgmtSrvr::Allocated_resources::Allocated_resources(MgmtSrvr &m)
   : m_mgmsrv(m)
 {

--- 1.30/ndb/src/mgmsrv/MgmtSrvr.hpp	2005-09-13 08:22:02 +10:00
+++ 1.31/ndb/src/mgmsrv/MgmtSrvr.hpp	2005-09-20 17:34:43 +10:00
@@ -214,27 +214,6 @@
   // NO_CONTACT_WITH_PROCESS, PROCESS_NOT_CONFIGURED, WRONG_PROCESS_TYPE,
   // COULD_NOT_ALLOCATE_MEMORY, SEND_OR_RECEIVE_FAILED
 
-
-  /**
-   * Lock configuration
-   */
-  int lockConf();
-
-  /**
-   * Unlock configuration, and commit it if commit is true
-   */
-  int unlockConf(bool commit);
-
-  /**
-   * Commit new configuration
-   */
-  int commitConfig();
-
-  /**
-   * Rollback configuration
-   */
-  int rollbackConfig();
-
   /**
    * Save a configuration to permanent storage
    */
@@ -463,13 +442,6 @@
   const Config * getConfig() const;
 
   /**
-   *   Change configuration paramter
-   */
-  bool changeConfig(const BaseString &section,
-		    const BaseString &param,
-		    const BaseString &value);
-
-  /**
    * Returns the node count for the specified node type.
    *
    *  @param type The node type.
@@ -478,11 +450,6 @@
   int getNodeCount(enum ndb_mgm_node_type type) const;
 
   /**
-   * Returns the nodeId of the management master
-   */
-  NodeId getPrimaryNode() const;
-
-  /**
    * Returns the port number.
    * @return port number.
    */
@@ -571,9 +538,6 @@
   //  processId: Id of the dead process.
   // Returns: -
   //**************************************************************************
-
-  void handle_MGM_LOCK_CONFIG_REQ(NdbApiSignal *signal);
-  void handle_MGM_UNLOCK_CONFIG_REQ(NdbApiSignal *signal);
 
   //**************************************************************************
   // Specific signal handling data

--- 1.6/ndb/src/mgmsrv/MgmtSrvrConfig.cpp	2005-09-13 00:08:12 +10:00
+++ 1.7/ndb/src/mgmsrv/MgmtSrvrConfig.cpp	2005-09-20 17:34:43 +10:00
@@ -23,232 +23,6 @@
 #include <ConfigRetriever.hpp>
 #include <ndb_version.h>
 
-#if 0 // code must be rewritten to use SignalSender
-
-void
-MgmtSrvr::handle_MGM_LOCK_CONFIG_REQ(NdbApiSignal *signal) {
-  NodeId sender = refToNode(signal->theSendersBlockRef);
-  const MgmLockConfigReq * const req = CAST_CONSTPTR(MgmLockConfigReq,
signal->getDataPtr());
-
-  NdbApiSignal *reply = getSignal();
-  if(signal == NULL)
-    return; /** @todo handle allocation failure */
-
-  reply->set(TestOrd::TraceAPI,
-	      MGMSRV,
-	      GSN_MGM_LOCK_CONFIG_REP,
-	      MgmLockConfigRep::SignalLength);
-
-  MgmLockConfigRep *lockRep = CAST_PTR(MgmLockConfigRep, reply->getDataPtrSend());
-
-  lockRep->errorCode = MgmLockConfigRep::UNKNOWN_ERROR;
-
-  if(req->newConfigGeneration < m_nextConfigGenerationNumber) {
-    lockRep->errorCode = MgmLockConfigRep::GENERATION_MISMATCH;
-    goto done;
-  }
-  NdbMutex_Lock(m_configMutex);
-
-  m_nextConfigGenerationNumber = req->newConfigGeneration+1;
-
-  lockRep->errorCode = MgmLockConfigRep::OK;
-
- done:
-  sendSignal(sender, NO_WAIT, reply, true);
-  NdbMutex_Unlock(m_configMutex);
-  return;
-}
-
-void
-MgmtSrvr::handle_MGM_UNLOCK_CONFIG_REQ(NdbApiSignal *signal) {
-  NodeId sender = refToNode(signal->theSendersBlockRef);
-  const MgmUnlockConfigReq * const req = CAST_CONSTPTR(MgmUnlockConfigReq,
signal->getDataPtr());
-  MgmUnlockConfigRep *unlockRep;
-
-  NdbApiSignal *reply = getSignal();
-  if(signal == NULL)
-    goto error; /** @todo handle allocation failure */
-
-  reply->set(TestOrd::TraceAPI,
-	     MGMSRV,
-	     GSN_MGM_UNLOCK_CONFIG_REP,
-	     MgmUnlockConfigRep::SignalLength);
-
-  unlockRep = CAST_PTR(MgmUnlockConfigRep,  reply->getDataPtrSend());
-
-  unlockRep->errorCode = MgmUnlockConfigRep::UNKNOWN_ERROR;
-
-
-  NdbMutex_Lock(m_configMutex);
-
-  if(req->commitConfig == 1) {
-    m_newConfig = fetchConfig();
-    commitConfig();
-  } else
-    rollbackConfig();
-  
-  unlockRep->errorCode = MgmUnlockConfigRep::OK;
-
-  sendSignal(sender, NO_WAIT, reply, true);
- error:
-  NdbMutex_Unlock(m_configMutex);
-  return;
-}
-
-
-/**
- * Prepare all MGM nodes for configuration changes
- * 
- * @returns 0 on success, or -1 on failure
- */
-int
-MgmtSrvr::lockConf() {
-  int result = -1;
-  MgmLockConfigReq* lockReq;
-  NodeId node = 0;
-
-  /* Check if this is the master node */
-  if(getPrimaryNode() != _ownNodeId)
-    goto done;
-
-  if(NdbMutex_Trylock(m_configMutex) != 0)
-    return -1;
-
-  m_newConfig = new Config(*_config); /* copy the existing config */
-  _config = m_newConfig;
-  
-  m_newConfig = new Config(*_config);
-
-  m_nextConfigGenerationNumber++;
-
-  /* Make sure the new configuration _always_ is at least one step older */
-  if(m_nextConfigGenerationNumber < m_newConfig->getGenerationNumber()+1)
-    m_nextConfigGenerationNumber = _config->getGenerationNumber()+1;
-
-  m_newConfig->setGenerationNumber(m_nextConfigGenerationNumber);
-
-  node = 0;
-  while(getNextNodeId(&node, NDB_MGM_NODE_TYPE_MGM)) {
-    if(node != _ownNodeId) {
-      NdbApiSignal* signal = getSignal();
-      if (signal == NULL) {
-	result = COULD_NOT_ALLOCATE_MEMORY;
-	goto done;
-      }
-      
-      lockReq = CAST_PTR(MgmLockConfigReq, signal->getDataPtrSend());
-      signal->set(TestOrd::TraceAPI,
-		  MGMSRV,
-		  GSN_MGM_LOCK_CONFIG_REQ,
-		  MgmLockConfigReq::SignalLength);
-      
-      lockReq->newConfigGeneration = m_nextConfigGenerationNumber;
-      
-      result = sendSignal(node, NO_WAIT, signal, true);
-
-      NdbApiSignal *reply = 
-	m_signalRecvQueue.waitFor(GSN_MGM_LOCK_CONFIG_REP, 0);
-
-      if(reply == NULL) {
-	/** @todo handle timeout/error */
-	ndbout << __FILE__ << ":" << __LINE__ << endl;
-	result = -1;
-	goto done;
-      }
-
-    }
-  }
-
- done:
-  NdbMutex_Unlock(m_configMutex);
-  return result;
-}
-
-/**
- * Unlocks configuration
- * 
- * @returns 0 on success, ! 0 on error
- */
-int
-MgmtSrvr::unlockConf(bool commit) {
-  int result = -1;
-  MgmUnlockConfigReq* unlockReq;
-  NodeId node = 0;
-
-  /* Check if this is the master node */
-  if(getPrimaryNode() != _ownNodeId)
-    goto done;
-
-  errno = 0;
-  if(NdbMutex_Lock(m_configMutex) != 0)
-    return -1;
-
-  if(commit)
-    commitConfig();
-  else
-    rollbackConfig();
-
-  node = 0;
-  while(getNextNodeId(&node, NDB_MGM_NODE_TYPE_MGM)) {
-    if(node != _ownNodeId) {
-      NdbApiSignal* signal = getSignal();
-      if (signal == NULL) {
-	result = COULD_NOT_ALLOCATE_MEMORY;
-	goto done;
-      }
-      
-      unlockReq = CAST_PTR(MgmUnlockConfigReq, signal->getDataPtrSend());
-      signal->set(TestOrd::TraceAPI,
-		  MGMSRV,
-		  GSN_MGM_UNLOCK_CONFIG_REQ,
-		  MgmUnlockConfigReq::SignalLength);
-      unlockReq->commitConfig = commit;
-      
-      result = sendSignal(node, NO_WAIT, signal, true);
-
-      NdbApiSignal *reply = 
-	m_signalRecvQueue.waitFor(GSN_MGM_UNLOCK_CONFIG_REP, 0);
-
-      if(reply == NULL) {
-	/** @todo handle timeout/error */
-	result = -1;
-	goto done;
-      }
-
-    }
-  }
-
- done:
-  NdbMutex_Unlock(m_configMutex);
-  return result;
-}
-
-#endif // code must be rewritten to use SignalSender
-
-/**
- * Commit the new configuration
- */
-int
-MgmtSrvr::commitConfig() {
-  int ret = saveConfig(m_newConfig);
-  delete _config;
-  _config = m_newConfig;
-  m_newConfig = NULL;
-  ndbout << "commit " << ret << endl;
-  return ret;
-}
-
-/**
- * Rollback to the old configuration
- */
-int
-MgmtSrvr::rollbackConfig() {
-  delete m_newConfig;
-  m_newConfig = NULL;
-  ndbout << "rollback" << endl;
-  return saveConfig(_config);
-}
-
 /**
  * Save a configuration to the running configuration file
  */
@@ -291,13 +65,4 @@
     return conf;
   }
   return 0;
-}
-
-bool
-MgmtSrvr::changeConfig(const BaseString &section,
-		       const BaseString &param,
-		       const BaseString &value) {
-  if(m_newConfig == NULL)
-    return false;
-  return m_newConfig->change(section, param, value);
 }

--- 1.36/ndb/src/mgmsrv/Services.cpp	2005-09-13 00:08:12 +10:00
+++ 1.37/ndb/src/mgmsrv/Services.cpp	2005-09-20 17:34:43 +10:00
@@ -221,21 +221,6 @@
     MGM_ARG("level", Int, Mandatory, "Severety level"),
     MGM_ARG("enable", Int, Mandatory, "1=disable, 0=enable, -1=toggle"),
 
-  MGM_CMD("config lock", &MgmApiSession::configLock, ""),
-
-  MGM_CMD("config unlock", &MgmApiSession::configUnlock, ""),
-    MGM_ARG("commit", Int, Mandatory, "Commit changes"),
-
-  MGM_CMD("config change", &MgmApiSession::configChange, ""),
-    MGM_ARG("section", String, Mandatory, "Section"),
-    MGM_ARG("parameter", String, Mandatory, "Parameter"),
-    MGM_ARG("value", String, Mandatory, "Value"),
-
-  MGM_CMD("config lock", &MgmApiSession::configLock, ""),
-
-  MGM_CMD("config unlock", &MgmApiSession::configUnlock, ""),
-    MGM_ARG("commit", Int, Mandatory, "Commit changes"),
-
   MGM_CMD("set parameter", &MgmApiSession::setParameter, ""),
     MGM_ARG("node", String, Mandatory, "Node"),
     MGM_ARG("parameter", String, Mandatory, "Parameter"),
@@ -1197,50 +1182,6 @@
 
   m_output->println("set logfilter reply");
   m_output->println("result: %d", result);
-  m_output->println("");
-}
-
-void
-MgmApiSession::configLock(Parser_t::Context &,
-			   Properties const &) {
-#if 0 // not implemented
-  int ret = m_mgmsrv.lockConf();
-#else
-  int ret = -1;
-#endif
-  m_output->println("config lock reply");
-  m_output->println("result: %d", ret);
-  m_output->println("");
-}
-
-void
-MgmApiSession::configUnlock(Parser_t::Context &,
-			   Properties const &args) {
-  Uint32 commit;
-  args.get("commit", &commit);
-#if 0 // not implemented
-  int ret = m_mgmsrv.unlockConf(commit == 1);
-#else
-  int ret = -1;
-#endif
-  m_output->println("config unlock reply");
-  m_output->println("result: %d", ret);
-  m_output->println("");
-}
-
-void
-MgmApiSession::configChange(Parser_t::Context &,
-			    Properties const &args) {
-  BaseString section, param, value;
-  args.get("section", section);
-  args.get("parameter", param);
-  args.get("value", value);
-
-  int ret = m_mgmsrv.changeConfig(section.c_str(),
-				  param.c_str(),
-				  value.c_str());
-  m_output->println("config change reply");
-  m_output->println("result: %d", ret);
   m_output->println("");
 }
 

--- 1.8/ndb/src/mgmsrv/Services.hpp	2004-12-17 20:32:22 +11:00
+++ 1.9/ndb/src/mgmsrv/Services.hpp	2005-09-20 17:34:43 +10:00
@@ -83,9 +83,6 @@
   void setClusterLogLevel(Parser_t::Context &ctx, 
 			  const class Properties &args);
   void setLogFilter(Parser_t::Context &ctx, const class Properties &args);
-  void configLock(Parser_t::Context &ctx, const class Properties &args);
-  void configUnlock(Parser_t::Context &ctx, const class Properties &args);
-  void configChange(Parser_t::Context &ctx, const class Properties &args);
 
   void setParameter(Parser_t::Context &ctx, const class Properties &args);
   void listen_event(Parser_t::Context &ctx, const class Properties &args);
Thread
bk commit into 4.1 tree (stewart:1.2437)Stewart Smith20 Sep