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

parent dededf09
......@@ -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
......
......@@ -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, ""),
......
......@@ -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,7 +397,17 @@ 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) {
case NODE_TYPE_MGM:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment