From: Date: December 19 2008 3:07pm Subject: bzr commit into mysql-5.1 branch (jonas:3191) List-Archive: http://lists.mysql.com/commits/62100 Message-Id: <20081219140714.75BC78337AE@perch.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/jonas/src/telco-6.4/ 3191 Jonas Oreland 2008-12-19 ndb - check that atleast one of new nodes is alive during create nodegroup modified: storage/ndb/include/kernel/signaldata/CreateNodegroup.hpp storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp storage/ndb/src/mgmsrv/MgmtSrvr.cpp storage/ndb/src/mgmsrv/Services.cpp storage/ndb/src/ndbapi/ndberror.c === modified file 'storage/ndb/include/kernel/signaldata/CreateNodegroup.hpp' --- a/storage/ndb/include/kernel/signaldata/CreateNodegroup.hpp 2008-09-12 12:55:29 +0000 +++ b/storage/ndb/include/kernel/signaldata/CreateNodegroup.hpp 2008-12-19 14:07:00 +0000 @@ -72,10 +72,11 @@ struct CreateNodegroupRef { NoMoreObjectRecords = 710, InvalidFormat = 740, SingleUser = 299, - InvalidNoOfNodesInNodegroup = -1, - InvalidNodegroupId = -2, - NodeAlreadyInNodegroup = -3, - NodegroupInUse = -4 + InvalidNoOfNodesInNodegroup = 320, + InvalidNodegroupId = 321, + NodeAlreadyInNodegroup = 322, + NodegroupInUse = 323, + NoNodeAlive = 324 }; Uint32 senderData; === modified file 'storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-15 19:41:01 +0000 +++ b/storage/ndb/src/kernel/blocks/dbdih/DbdihMain.cpp 2008-12-19 14:07:00 +0000 @@ -17356,6 +17356,33 @@ Dbdih::execCREATE_NODEGROUP_IMPL_REQ(Sig goto error; } + if (rt == CreateNodegroupImplReq::RT_PARSE || rt == CreateNodegroupImplReq::RT_PREPARE) + { + /** + * Check that atleast one of the nodes are alive + */ + bool alive = false; + for (Uint32 i = 0; inodes[i]; + if (getNodeStatus(nodeId) == NodeRecord::ALIVE) + { + jam(); + alive = true; + break; + } + } + + jam(); + if (alive == false) + { + jam(); + err = CreateNodegroupRef::NoNodeAlive; + goto error; + } + } + if (rt == CreateNodegroupImplReq::RT_PARSE) { jam(); === modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp' --- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2008-12-17 16:18:23 +0000 +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2008-12-19 14:07:00 +0000 @@ -2161,9 +2161,10 @@ MgmtSrvr::createNodegroup(int *nodes, in case GSN_CREATE_NODEGROUP_REF:{ const CreateNodegroupRef * ref = CAST_CONSTPTR(CreateNodegroupRef, signal->getDataPtr()); + Uint32 err = ref->errorCode; endSchemaTrans(ss, nodeId, transId, transKey, SchemaTransEndReq::SchemaTransAbort); - return ref->errorCode; + return err; } case GSN_NF_COMPLETEREP: // ignore === modified file 'storage/ndb/src/mgmsrv/Services.cpp' --- a/storage/ndb/src/mgmsrv/Services.cpp 2008-12-17 16:09:53 +0000 +++ b/storage/ndb/src/mgmsrv/Services.cpp 2008-12-19 14:07:00 +0000 @@ -1749,6 +1749,7 @@ void MgmApiSession::create_nodegroup(Parser_t::Context &ctx, Properties const &args) { + int res = 0; BaseString nodestr; BaseString retval; int ng = -1; @@ -1764,28 +1765,27 @@ MgmApiSession::create_nodegroup(Parser_t int node; if ((res = sscanf(list[i].c_str(), "%u", &node)) != 1) { + nodes.clear(); result = "FAIL: Invalid format for nodes"; - goto end; + break; } nodes.push_back(node); } + + res = m_mgmsrv.createNodegroup(nodes.getBase(), nodes.size(), &ng); - if(nodes.size() == 0) +end: + m_output->println("create nodegroup reply"); + m_output->println("ng: %d", ng); + if (res) { - result= "FAIL: Must have at least 1 node in the node group"; - goto end; + m_output->println("error_code: %d", res); + m_output->println("result: %d-%s", res, get_error_text(res)); } - - int res; - if((res = m_mgmsrv.createNodegroup(nodes.getBase(), nodes.size(), &ng)) != 0) + else { - result.assfmt("error: %d", res); + m_output->println("result: Ok"); } - -end: - m_output->println("create nodegroup reply"); - m_output->println("ng: %d", ng); - m_output->println("result: %s", result.c_str()); m_output->println(""); } === modified file 'storage/ndb/src/ndbapi/ndberror.c' --- a/storage/ndb/src/ndbapi/ndberror.c 2008-11-13 15:23:48 +0000 +++ b/storage/ndb/src/ndbapi/ndberror.c 2008-12-19 14:07:00 +0000 @@ -319,6 +319,11 @@ ErrorBundle ErrorCodes[] = { { 892, DMEC, AE, "Unsupported type in scan filter" }, { 4256, DMEC, AE, "Must call Ndb::init() before this function" }, { 4257, DMEC, AE, "Tried to read too much - too many getValue calls" }, + { 320, DMEC, AE, "Invalid no of nodes specified for new nodegroup" }, + { 321, DMEC, AE, "Invalid nodegroup id" }, + { 322, DMEC, AE, "Invalid node(s) specified for new nodegroup, node already in nodegroup" }, + { 323, DMEC, AE, "Invalid nodegroup id, nodegroup already existing" }, + { 324, DMEC, AE, "Invalid node(s) specified for new nodegroup, no node in nodegroup is started" }, /** * Scan application errors