summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <stewart@mysql.com[stewart]>2004-12-06 11:41:16 +1100
committerunknown <stewart@mysql.com[stewart]>2004-12-06 11:41:16 +1100
commita5cc93b9235f58aefa96b23bb12cc589195ddaca (patch)
tree3555ba80d8d6b39c79fe18f0e08ab5e1b8816bee
parentf8cdf570979c550ef04c53f691118ed2b1296a7c (diff)
downloadmariadb-git-a5cc93b9235f58aefa96b23bb12cc589195ddaca.tar.gz
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
-rw-r--r--BitKeeper/etc/logging_ok1
-rw-r--r--ndb/src/mgmapi/mgmapi.cpp4
-rw-r--r--ndb/src/mgmsrv/Services.cpp15
3 files changed, 19 insertions, 1 deletions
diff --git a/BitKeeper/etc/logging_ok b/BitKeeper/etc/logging_ok
index b8043910a11..6c673fdc2bd 100644
--- a/BitKeeper/etc/logging_ok
+++ b/BitKeeper/etc/logging_ok
@@ -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
diff --git a/ndb/src/mgmapi/mgmapi.cpp b/ndb/src/mgmapi/mgmapi.cpp
index e22ceffe773..0768a9844af 100644
--- a/ndb/src/mgmapi/mgmapi.cpp
+++ b/ndb/src/mgmapi/mgmapi.cpp
@@ -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, ""),
diff --git a/ndb/src/mgmsrv/Services.cpp b/ndb/src/mgmsrv/Services.cpp
index 5834d40cc78..2b3fb346d72 100644
--- a/ndb/src/mgmsrv/Services.cpp
+++ b/ndb/src/mgmsrv/Services.cpp
@@ -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: