Commit a5cc93b9 authored by unknown's avatar unknown
Browse files

Add (optional) endian parameter to 'get nodeid' to warn on endian conflicts.


ndb/src/mgmapi/mgmapi.cpp:
  Send an extra (optional) parameter to 'get nodeid' to detect potential endianness conflicts.
  
  endian: big
  endian: small
  
  Server will deny our nodeid request if we're not compatible.
  
  If parameter is not specified, we behave how we used to (work or fail).
ndb/src/mgmsrv/Services.cpp:
  Add extra (optional) parameter to 'get nodeid' to detect potential endianness conflicts.
  
  endian: big
  endian: little
  
  we will deny the nodeid request if the endian parameter is provided and the endian doesn't match.
  
  This should preserve compatibility with all clients.
BitKeeper/etc/logging_ok:
  Logging to logging@openlogging.org accepted
parent f8cdf570
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -192,6 +192,7 @@ serg@sergbook.mylan
serg@sergbook.mysql.com
sergefp@mysql.com
sinisa@rhols221.adsl.netsonic.fi
stewart@mysql.com
tfr@beta.frontier86.ee
tfr@indrek.tfr.cafe.ee
tfr@sarvik.tfr.cafe.ee
+4 −0
Original line number Diff line number Diff line
@@ -1690,6 +1690,9 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
{
  CHECK_HANDLE(handle, 0);
  CHECK_CONNECTED(handle, 0);
  union { long l; char c[sizeof(long)]; } endian_check;

  endian_check.l = 1;

  int nodeid= handle->cfg._ownNodeId;

@@ -1700,6 +1703,7 @@ ndb_mgm_alloc_nodeid(NdbMgmHandle handle, unsigned int version, int nodetype)
  args.put("user", "mysqld");
  args.put("password", "mysqld");
  args.put("public key", "a public key");
  args.put("endian", (endian_check.c[sizeof(long)-1])?"big":"little");

  const ParserRow<ParserDummy> reply[]= {
    MGM_CMD("get nodeid reply", NULL, ""),
+14 −1
Original line number Diff line number Diff line
@@ -132,6 +132,7 @@ ParserRow<MgmApiSession> commands[] = {
    MGM_ARG("user", String, Mandatory, "Password"),
    MGM_ARG("password", String, Mandatory, "Password"),
    MGM_ARG("public key", String, Mandatory, "Public key"),
    MGM_ARG("endian", String, Optional, "Endianness"),

  MGM_CMD("get version", &MgmApiSession::getVersion, ""),
  
@@ -386,6 +387,8 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
  const char * user;
  const char * password;
  const char * public_key;
  const char * endian;
  union { long l; char c[sizeof(long)]; } endian_check;

  args.get("version", &version);
  args.get("nodetype", &nodetype);
@@ -394,6 +397,16 @@ MgmApiSession::get_nodeid(Parser_t::Context &,
  args.get("user", &user);
  args.get("password", &password);
  args.get("public key", &public_key);
  args.get("endian", &endian);

  endian_check.l = 1;
  if(endian 
     && strcmp(endian,(endian_check.c[sizeof(long)-1])?"big":"little")!=0) {
    m_output->println(cmd);
    m_output->println("result: Endianness of nodes does not match.");
    m_output->println("");
    return;
  }

  bool compatible;
  switch (nodetype) {