diff --git a/storage/ndb/include/kernel/signaldata/AllocNodeId.hpp b/storage/ndb/include/kernel/signaldata/AllocNodeId.hpp
index 40b30a573e1902019c2caad96eb861df1cf6b1fe..a204bb630592000f5ef6f82440e4e41987da8fc5 100644
--- a/storage/ndb/include/kernel/signaldata/AllocNodeId.hpp
+++ b/storage/ndb/include/kernel/signaldata/AllocNodeId.hpp
@@ -25,11 +25,12 @@
  */
 class AllocNodeIdReq {
 public:
-  STATIC_CONST( SignalLength = 3 );
+  STATIC_CONST( SignalLength = 4 );
 
   Uint32 senderRef;
   Uint32 senderData;
   Uint32 nodeId;
+  Uint32 nodeType;
 };
 
 class AllocNodeIdConf {
@@ -53,7 +54,8 @@ public:
     NotMaster  = 702,
     NodeReserved = 1701,
     NodeConnected = 1702,
-    NodeFailureHandlingNotCompleted = 1703
+    NodeFailureHandlingNotCompleted = 1703,
+    NodeTypeMismatch = 1704
   };
 
   Uint32 senderRef;
diff --git a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
index 4d5ac377a5a9fb6e0bc46bfaf6d2c78b76d59637..ebc40cb385da27d4e4173098afe58664558f5323 100644
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
@@ -4736,6 +4736,7 @@ Qmgr::execALLOC_NODEID_REQ(Signal * signal)
   const AllocNodeIdReq * req = (AllocNodeIdReq*)signal->getDataPtr();
   Uint32 senderRef = req->senderRef;
   Uint32 nodeId = req->nodeId;
+  Uint32 nodeType = req->nodeType;
   Uint32 error = 0;
 
   if (refToBlock(senderRef) != QMGR) // request from management server
@@ -4786,7 +4787,9 @@ Qmgr::execALLOC_NODEID_REQ(Signal * signal)
     NodeRecPtr nodePtr;
     nodePtr.i = nodeId;
     ptrAss(nodePtr, nodeRec);
-    if (nodePtr.p->failState != NORMAL)
+    if (nodeType != getNodeInfo(nodeId).m_type)
+      error = AllocNodeIdRef::NodeTypeMismatch;
+    else if (nodePtr.p->failState != NORMAL)
       error = AllocNodeIdRef::NodeFailureHandlingNotCompleted;
   }
 
diff --git a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
index 1e655c295174182045179521428a0dc1d8117d7f..dfa915d0c7b840dc69930e320350830e4d19e7eb 100644
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp
@@ -1927,7 +1927,7 @@ MgmtSrvr::get_connected_nodes(NodeBitmask &connected_nodes) const
 }
 
 int
-MgmtSrvr::alloc_node_id_req(Uint32 free_node_id)
+MgmtSrvr::alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type)
 {
   SignalSender ss(theFacade);
   ss.lock(); // lock will be released on exit
@@ -1940,6 +1940,7 @@ MgmtSrvr::alloc_node_id_req(Uint32 free_node_id)
   req->senderRef = ss.getOwnRef();
   req->senderData = 19;
   req->nodeId = free_node_id;
+  req->nodeType = type;
 
   int do_send = 1;
   NodeId nodeId = 0;
@@ -2140,7 +2141,7 @@ MgmtSrvr::alloc_node_id(NodeId * nodeId,
 
   if (id_found && client_addr != 0)
   {
-    int res = alloc_node_id_req(id_found);
+    int res = alloc_node_id_req(id_found, type);
     unsigned save_id_found = id_found;
     switch (res)
     {
diff --git a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
index 63134991ffeacc868546439a3ab53ee23a84414a..53130f95d246848d2dfc92d439d2bafba7af34fc 100644
--- a/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
+++ b/storage/ndb/src/mgmsrv/MgmtSrvr.hpp
@@ -520,7 +520,7 @@ private:
    */
   int getBlockNumber(const BaseString &blockName);
 
-  int alloc_node_id_req(Uint32 free_node_id);
+  int alloc_node_id_req(NodeId free_node_id, enum ndb_mgm_node_type type);
   //**************************************************************************
   
   int _blockNumber;
diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c
index c05924dacf86ed4f0866ef9d01f6471f70144be4..e53f581cf2b602ec1dbe61d2644732d833df238b 100644
--- a/storage/ndb/src/ndbapi/ndberror.c
+++ b/storage/ndb/src/ndbapi/ndberror.c
@@ -462,6 +462,7 @@ ErrorBundle ErrorCodes[] = {
   { 1701, DMEC, AE, "Node already reserved" },
   { 1702, DMEC, AE, "Node already connected" },
   { 1703, DMEC, AE, "Node failure handling not completed" },
+  { 1704, DMEC, AE, "Node type mismatch" },
   
   /**
    * Still uncategorized