Commit c7e20e20 authored by unknown's avatar unknown
Browse files

Merge tulin@bk-internal.mysql.com:/home/bk/mysql-5.1-new

into  poseidon.ndb.mysql.com:/home/tomas/mysql-5.1-new

parents a22bd444 67e16225
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -5813,7 +5813,11 @@ static bool ndbcluster_init()
                        opt_ndbcluster_connectstring));
    goto ndbcluster_init_error;
  }

  {
    char buf[128];
    my_snprintf(buf, sizeof(buf), "mysqld --server-id=%d", server_id);
    g_ndb_cluster_connection->set_name(buf);
  }
  g_ndb_cluster_connection->set_optimized_node_selection
    (opt_ndb_optimized_node_selection);

+8 −0
Original line number Diff line number Diff line
@@ -468,6 +468,14 @@ extern "C" {
   */
  void ndb_mgm_destroy_handle(NdbMgmHandle * handle);

  /**
   * Set a name of the handle.  Name is reported in cluster log.
   *
   * @param   handle        Management handle
   * @param   name          Name
   */
  void ndb_mgm_set_name(NdbMgmHandle handle, const char *name);

  /** @} *********************************************************************/
  /**
   * @name Functions: Connect/Disconnect Management Server
+8 −0
Original line number Diff line number Diff line
@@ -54,6 +54,14 @@ public:
  Ndb_cluster_connection(const char * connectstring = 0);
  ~Ndb_cluster_connection();

  /**
   * Set a name on the connection, which will be reported in cluster log
   *
   * @param name
   *
   */
  void set_name(const char *name);

  /**
   * Connect to a cluster management server
   *
+13 −0
Original line number Diff line number Diff line
@@ -102,6 +102,7 @@ struct ndb_mgm_handle {
  FILE* logfile;
#endif
  FILE *errstream;
  char *m_name;
};

#define SET_ERROR(h, e, s) setError(h, e, __LINE__, s)
@@ -156,6 +157,7 @@ ndb_mgm_create_handle()
  h->write_timeout   = 100;
  h->cfg_i           = -1;
  h->errstream       = stdout;
  h->m_name          = 0;

  strncpy(h->last_error_desc, "No error", NDB_MGM_MAX_ERR_DESC_SIZE);

@@ -170,6 +172,14 @@ ndb_mgm_create_handle()
  DBUG_RETURN(h);
}

extern "C"
void
ndb_mgm_set_name(NdbMgmHandle handle, const char *name)
{
  my_free(handle->m_name, MYF(MY_ALLOW_ZERO_PTR));
  handle->m_name= my_strdup(name, MYF(MY_WME));
}

extern "C"
int
ndb_mgm_set_connectstring(NdbMgmHandle handle, const char * mgmsrv)
@@ -216,6 +226,7 @@ ndb_mgm_destroy_handle(NdbMgmHandle * handle)
  }
#endif
  (*handle)->cfg.~LocalConfig();
  my_free((*handle)->m_name, MYF(MY_ALLOW_ZERO_PTR));
  my_free((char*)* handle,MYF(MY_ALLOW_ZERO_PTR));
  * handle = 0;
  DBUG_VOID_RETURN;
@@ -1875,6 +1886,8 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
  args.put("password", "mysqld");
  args.put("public key", "a public key");
  args.put("endian", (endian_check.c[sizeof(long)-1])?"big":"little");
  if (handle->m_name)
    args.put("name", handle->m_name);

  const ParserRow<ParserDummy> reply[]= {
    MGM_CMD("get nodeid reply", NULL, ""),
+7 −0
Original line number Diff line number Diff line
@@ -35,6 +35,7 @@
#include <base64.h>

extern bool g_StopServer;
extern EventLogger g_eventLogger;

static const unsigned int MAX_READ_TIMEOUT = 1000 ;
static const unsigned int MAX_WRITE_TIMEOUT = 100 ;
@@ -135,6 +136,7 @@ ParserRow<MgmApiSession> commands[] = {
    MGM_ARG("password", String, Mandatory, "Password"),
    MGM_ARG("public key", String, Mandatory, "Public key"),
    MGM_ARG("endian", String, Optional, "Endianness"),
    MGM_ARG("name", String, Optional, "Name of connection"),

  MGM_CMD("get version", &MgmApiSession::getVersion, ""),
  
@@ -411,6 +413,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
  const char * password;
  const char * public_key;
  const char * endian= NULL;
  const char * name= NULL;
  union { long l; char c[sizeof(long)]; } endian_check;

  args.get("version", &version);
@@ -421,6 +424,7 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
  args.get("password", &password);
  args.get("public key", &public_key);
  args.get("endian", &endian);
  args.get("name", &name);

  endian_check.l = 1;
  if(endian 
@@ -489,6 +493,9 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
  m_output->println("");
  m_allocated_resources->reserve_node(tmp);
  
  if (name)
    g_eventLogger.info("Node %d: %s", tmp, name);

  return;
}

Loading