From: Maitrayi Sabaratnam Date: September 1 2011 1:13pm Subject: bzr push into mysql-5.1-telco-7.1 branch (maitrayi.sabaratnam:4263 to 4264) List-Archive: http://lists.mysql.com/commits/140882 Message-Id: <20110901131323.19721.qmail@asator03> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4264 Maitrayi Sabaratnam 2011-09-01 [merge] Merge from 7.0 modified: storage/ndb/include/kernel/signaldata/QueryTree.hpp storage/ndb/include/mgmapi/mgmapi_config_parameters.h storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp storage/ndb/src/kernel/ndbd.cpp storage/ndb/src/kernel/vm/CMakeLists.txt storage/ndb/src/kernel/vm/Configuration.cpp storage/ndb/src/kernel/vm/Configuration.hpp storage/ndb/src/kernel/vm/Makefile.am storage/ndb/src/kernel/vm/mt.cpp storage/ndb/src/kernel/vm/mt_thr_config.cpp storage/ndb/src/kernel/vm/mt_thr_config.hpp storage/ndb/src/mgmsrv/MgmtSrvr.cpp storage/ndb/src/mgmsrv/Services.cpp storage/ndb/src/ndbapi/NdbQueryOperation.cpp storage/ndb/tools/ndb_config.cpp 4263 Craig L Russell 2011-08-29 Update error messages for clusterj-core modified: storage/ndb/clusterj/clusterj-core/src/main/java/com/mysql/clusterj/core/SessionImpl.java storage/ndb/clusterj/clusterj-core/src/main/resources/com/mysql/clusterj/core/Bundle.properties === modified file 'storage/ndb/include/kernel/signaldata/QueryTree.hpp' --- a/storage/ndb/include/kernel/signaldata/QueryTree.hpp 2011-05-04 11:45:33 +0000 +++ b/storage/ndb/include/kernel/signaldata/QueryTree.hpp 2011-09-01 11:46:45 +0000 @@ -271,9 +271,11 @@ struct QN_ScanIndexParameters { Uint32 len; Uint32 requestInfo; - Uint32 batchSize; // (bytes << 16) | (rows) + Uint32 batchSize; // (bytes << 11) | (rows) Uint32 resultData; // Api connect ptr STATIC_CONST ( NodeSize = 4 ); + // Number of bits for representing row count in 'batchSize'. + STATIC_CONST ( BatchRowBits = 11 ); enum ScanIndexParamBits { === modified file 'storage/ndb/include/mgmapi/mgmapi_config_parameters.h' --- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2011-07-04 16:30:34 +0000 +++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h 2011-09-01 13:09:24 +0000 @@ -195,6 +195,7 @@ #define CFG_DB_INDEX_STAT_UPDATE_DELAY 626 #define CFG_DB_MAX_DML_OPERATIONS_PER_TRANSACTION 627 +#define CFG_DB_MT_THREAD_CONFIG 628 #define CFG_NODE_ARBIT_RANK 200 #define CFG_NODE_ARBIT_DELAY 201 === modified file 'storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp' --- a/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-08-25 06:30:20 +0000 +++ b/storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp 2011-09-01 13:09:24 +0000 @@ -4326,15 +4326,17 @@ Dbspj::scanIndex_build(Build_context& ct treeNodePtr.p->m_info = &g_ScanIndexOpInfo; treeNodePtr.p->m_bits |= TreeNode::T_ATTR_INTERPRETED; treeNodePtr.p->m_bits |= TreeNode::T_NEED_REPORT_BATCH_COMPLETED; - treeNodePtr.p->m_batch_size = batchSize & 0xFFFF; + treeNodePtr.p->m_batch_size = + batchSize & ~(0xFFFFFFFF << QN_ScanIndexParameters::BatchRowBits); ScanFragReq*dst=(ScanFragReq*)treeNodePtr.p->m_scanindex_data.m_scanFragReq; dst->senderData = treeNodePtr.i; dst->resultRef = reference(); dst->resultData = treeNodePtr.i; dst->savePointId = ctx.m_savepointId; - dst->batch_size_rows = batchSize & 0xFFFF; - dst->batch_size_bytes = batchSize >> 16; + dst->batch_size_rows = + batchSize & ~(0xFFFFFFFF << QN_ScanIndexParameters::BatchRowBits); + dst->batch_size_bytes = batchSize >> QN_ScanIndexParameters::BatchRowBits; Uint32 transId1 = requestPtr.p->m_transId[0]; Uint32 transId2 = requestPtr.p->m_transId[1]; @@ -5020,12 +5022,13 @@ Dbspj::scanIndex_parent_batch_complete(S * When parent's batch is complete, we send our batch */ const ScanFragReq * org = (const ScanFragReq*)data.m_scanFragReq; - ndbassert(org->batch_size_rows >= data.m_fragCount - data.m_frags_complete); + ndbrequire(org->batch_size_rows > 0); if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL) { jam(); - data.m_parallelism = data.m_fragCount - data.m_frags_complete; + data.m_parallelism = MIN(data.m_fragCount - data.m_frags_complete, + org->batch_size_rows); } else if (data.m_firstExecution) { @@ -5051,8 +5054,9 @@ Dbspj::scanIndex_parent_batch_complete(S * in the other direction is more costly). */ Int32 parallelism = - static_cast(data.m_parallelismStat.getMean() - - 2 * data.m_parallelismStat.getStdDev()); + static_cast(MIN(data.m_parallelismStat.getMean() + - 2 * data.m_parallelismStat.getStdDev(), + org->batch_size_rows)); if (parallelism < 1) { @@ -5117,17 +5121,9 @@ Dbspj::scanIndex_parent_batch_complete(S data.m_firstExecution = false; - if (treeNodePtr.p->m_bits & TreeNode::T_SCAN_PARALLEL) - { - ndbrequire((data.m_frags_outstanding + data.m_frags_complete) == - data.m_fragCount); - } - else - { - ndbrequire(static_cast(data.m_frags_outstanding + - data.m_frags_complete) <= - data.m_fragCount); - } + ndbrequire(static_cast(data.m_frags_outstanding + + data.m_frags_complete) <= + data.m_fragCount); data.m_batch_chunks = 1; requestPtr.p->m_cnt_active++; @@ -5575,7 +5571,8 @@ Dbspj::scanIndex_execSCAN_NEXTREQ(Signal data.m_largestBatchBytes < org->batch_size_bytes/data.m_parallelism) { jam(); - data.m_parallelism = data.m_fragCount - data.m_frags_complete; + data.m_parallelism = MIN(data.m_fragCount - data.m_frags_complete, + org->batch_size_rows); if (data.m_largestBatchRows > 0) { jam(); @@ -5624,7 +5621,8 @@ Dbspj::scanIndex_execSCAN_NEXTREQ(Signal else { jam(); - data.m_parallelism = data.m_fragCount - data.m_frags_complete; + data.m_parallelism = MIN(data.m_fragCount - data.m_frags_complete, + org->batch_size_rows); } const Uint32 bs_rows = org->batch_size_rows/data.m_parallelism; === modified file 'storage/ndb/src/kernel/ndbd.cpp' --- a/storage/ndb/src/kernel/ndbd.cpp 2011-01-30 23:13:49 +0000 +++ b/storage/ndb/src/kernel/ndbd.cpp 2011-08-30 12:00:48 +0000 @@ -297,69 +297,45 @@ get_multithreaded_config(EmulatorData& e { // multithreaded is compiled in ndbd/ndbmtd for now globalData.isNdbMt = SimulatedBlock::isMultiThreaded(); - if (!globalData.isNdbMt) { + if (!globalData.isNdbMt) + { ndbout << "NDBMT: non-mt" << endl; return 0; } - ndb_mgm_configuration * conf = ed.theConfiguration->getClusterConfig(); - if (conf == 0) - { - abort(); - } - - ndb_mgm_configuration_iterator * p = - ndb_mgm_create_configuration_iterator(conf, CFG_SECTION_NODE); - if (ndb_mgm_find(p, CFG_NODE_ID, globalData.ownId)) - { - abort(); - } + THRConfig & conf = ed.theConfiguration->m_thr_config; - Uint32 mtthreads = 0; - ndb_mgm_get_int_parameter(p, CFG_DB_MT_THREADS, &mtthreads); - ndbout << "NDBMT: MaxNoOfExecutionThreads=" << mtthreads << endl; + Uint32 threadcount = conf.getThreadCount(); + ndbout << "NDBMT: MaxNoOfExecutionThreads=" << threadcount << endl; globalData.isNdbMtLqh = true; { - Uint32 classic = 0; - ndb_mgm_get_int_parameter(p, CFG_NDBMT_CLASSIC, &classic); - if (classic) - globalData.isNdbMtLqh = false; - - const char* p = NdbEnv_GetEnv("NDB_MT_LQH", (char*)0, 0); - if (p != 0) + if (conf.getMtClassic()) { - if (strstr(p, "NOPLEASE") != 0) - globalData.isNdbMtLqh = false; - else - globalData.isNdbMtLqh = true; + globalData.isNdbMtLqh = false; } } if (!globalData.isNdbMtLqh) return 0; - Uint32 threads = 0; - switch(mtthreads){ - case 0: - case 1: - case 2: - case 3: - threads = 1; // TC + receiver + SUMA + LQH - break; - case 4: - case 5: - case 6: - threads = 2; // TC + receiver + SUMA + 2 * LQH - break; - default: - threads = 4; // TC + receiver + SUMA + 4 * LQH - } - - ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_THREADS, &threads); + Uint32 threads = conf.getThreadCount(THRConfig::T_LDM); Uint32 workers = threads; - ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_WORKERS, &workers); + { + ndb_mgm_configuration * conf = ed.theConfiguration->getClusterConfig(); + if (conf == 0) + { + abort(); + } + ndb_mgm_configuration_iterator * p = + ndb_mgm_create_configuration_iterator(conf, CFG_SECTION_NODE); + if (ndb_mgm_find(p, CFG_NODE_ID, globalData.ownId)) + { + abort(); + } + ndb_mgm_get_int_parameter(p, CFG_NDBMT_LQH_WORKERS, &workers); + } #ifdef VM_TRACE // testing @@ -368,9 +344,6 @@ get_multithreaded_config(EmulatorData& e p = NdbEnv_GetEnv("NDBMT_LQH_WORKERS", (char*)0, 0); if (p != 0) workers = atoi(p); - p = NdbEnv_GetEnv("NDBMT_LQH_THREADS", (char*)0, 0); - if (p != 0) - threads = atoi(p); } #endif @@ -654,10 +627,11 @@ ndbd_run(bool foreground, int report_fd, // Ignore error } + theConfig->setupConfiguration(); + if (get_multithreaded_config(globalEmulatorData)) ndbd_exit(-1); - theConfig->setupConfiguration(); systemInfo(* theConfig, * theConfig->m_logLevel); NdbThread* pWatchdog = globalEmulatorData.theWatchDog->doStart(); === modified file 'storage/ndb/src/kernel/vm/CMakeLists.txt' --- a/storage/ndb/src/kernel/vm/CMakeLists.txt 2011-02-02 00:40:07 +0000 +++ b/storage/ndb/src/kernel/vm/CMakeLists.txt 2011-08-30 12:00:48 +0000 @@ -38,6 +38,7 @@ ADD_LIBRARY(ndbkernel STATIC Ndbinfo.cpp NdbinfoTables.cpp ArenaPool.cpp + mt_thr_config.cpp ) ADD_LIBRARY(ndbsched STATIC === modified file 'storage/ndb/src/kernel/vm/Configuration.cpp' --- a/storage/ndb/src/kernel/vm/Configuration.cpp 2011-08-27 12:57:27 +0000 +++ b/storage/ndb/src/kernel/vm/Configuration.cpp 2011-09-01 13:09:24 +0000 @@ -33,6 +33,7 @@ #include #include +#include #include @@ -392,7 +393,77 @@ Configuration::setupConfiguration(){ t = globalEmulatorData.theWatchDog ->setCheckInterval(t); _timeBetweenWatchDogCheckInitial = t; } - + + const char * thrconfigstring = NdbEnv_GetEnv("NDB_MT_THREAD_CONFIG", + (char*)0, 0); + if (thrconfigstring || + iter.get(CFG_DB_MT_THREAD_CONFIG, &thrconfigstring) == 0) + { + int res = m_thr_config.do_parse(thrconfigstring); + if (res != 0) + { + ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, + "Invalid configuration fetched, invalid ThreadConfig", + m_thr_config.getErrorMessage()); + } + } + else + { + const char * mask; + if (iter.get(CFG_DB_EXECUTE_LOCK_CPU, &mask) == 0) + { + int res = m_thr_config.setLockExecuteThreadToCPU(mask); + if (res < 0) + { + // Could not parse LockExecuteThreadToCPU mask + g_eventLogger->warning("Failed to parse 'LockExecuteThreadToCPU=%s' " + "(error: %d), ignoring it!", + mask, res); + } + } + + Uint32 maintCPU = NO_LOCK_CPU; + iter.get(CFG_DB_MAINT_LOCK_CPU, &maintCPU); + if (maintCPU == 65535) + maintCPU = NO_LOCK_CPU; // Ignore old default(may come from old mgmd) + if (maintCPU != NO_LOCK_CPU) + m_thr_config.setLockMaintThreadsToCPU(maintCPU); + + Uint32 mtthreads = 0; + iter.get(CFG_DB_MT_THREADS, &mtthreads); + + Uint32 classic = 0; + iter.get(CFG_NDBMT_CLASSIC, &classic); + const char* p = NdbEnv_GetEnv("NDB_MT_LQH", (char*)0, 0); + if (p != 0) + { + if (strstr(p, "NOPLEASE") != 0) + classic = 1; + } + + Uint32 lqhthreads = 0; + iter.get(CFG_NDBMT_LQH_THREADS, &lqhthreads); + + int res = m_thr_config.do_parse(mtthreads, lqhthreads, classic); + if (res != 0) + { + ERROR_SET(fatal, NDBD_EXIT_INVALID_CONFIG, + "Invalid configuration fetched, invalid thread configuration", + m_thr_config.getErrorMessage()); + } + } + if (thrconfigstring) + { + ndbout_c("ThreadConfig: input: %s parsed: %s", + thrconfigstring, + m_thr_config.getConfigString()); + } + else + { + ndbout_c("ThreadConfig (old ndb_mgmd): parsed: %s", + m_thr_config.getConfigString()); + } + ConfigValues* cf = ConfigValuesFactory::extractCurrentSection(iter.m_config); if(m_clusterConfigIter) === modified file 'storage/ndb/src/kernel/vm/Configuration.hpp' --- a/storage/ndb/src/kernel/vm/Configuration.hpp 2011-08-27 12:57:27 +0000 +++ b/storage/ndb/src/kernel/vm/Configuration.hpp 2011-09-01 13:09:24 +0000 @@ -27,6 +27,7 @@ #include #include #include +#include "mt_thr_config.hpp" enum ThreadTypes { @@ -124,6 +125,7 @@ public: ndb_mgm_configuration* getClusterConfig() const { return m_clusterConfig; } Uint32 get_config_generation() const; + THRConfigApplier m_thr_config; private: friend class Cmvmi; friend class Qmgr; === modified file 'storage/ndb/src/kernel/vm/Makefile.am' --- a/storage/ndb/src/kernel/vm/Makefile.am 2011-08-26 09:57:03 +0000 +++ b/storage/ndb/src/kernel/vm/Makefile.am 2011-08-30 12:00:48 +0000 @@ -39,7 +39,8 @@ libkernel_a_SOURCES = VMSignal.cpp \ SafeMutex.cpp \ Ndbinfo.cpp \ NdbinfoTables.cpp \ - ArenaPool.cpp + ArenaPool.cpp \ + mt_thr_config.cpp libsched_a_SOURCES = TimeQueue.cpp \ ThreadConfig.cpp \ === modified file 'storage/ndb/src/kernel/vm/mt.cpp' --- a/storage/ndb/src/kernel/vm/mt.cpp 2011-08-27 12:57:27 +0000 +++ b/storage/ndb/src/kernel/vm/mt.cpp 2011-09-01 13:09:24 +0000 @@ -3251,28 +3251,11 @@ sendprioa_STOP_FOR_CRASH(const struct th */ static thr_job_buffer dummy_buffer; - /* - * Before we had three main threads with fixed block assignment. - * Now there is also worker instances (we send to LQH instance). + /** + * Pick any instance running in this thread */ - Uint32 main = 0; - Uint32 instance = 0; - if (dst == 0) - main = NDBCNTR; - else if (dst == 1) - main = DBLQH; - else if (dst >= NUM_MAIN_THREADS && dst < NUM_MAIN_THREADS + num_lqh_threads) - { - main = DBLQH; - instance = dst - NUM_MAIN_THREADS + 1; - } - else if (dst == receiver_thread_no) - main = CMVMI; - else - require(false); - Uint32 bno = numberToBlock(main, instance); - require(block2ThreadId(main, instance) == dst); struct thr_data * dstptr = rep->m_thread + dst; + Uint32 bno = dstptr->m_instance_list[0]; memset(&signalT.header, 0, sizeof(SignalHeader)); signalT.header.theVerId_signalNumber = GSN_STOP_FOR_CRASH; === modified file 'storage/ndb/src/kernel/vm/mt_thr_config.cpp' --- a/storage/ndb/src/kernel/vm/mt_thr_config.cpp 2011-08-26 09:57:03 +0000 +++ b/storage/ndb/src/kernel/vm/mt_thr_config.cpp 2011-08-30 14:13:15 +0000 @@ -500,6 +500,34 @@ THRConfig::getConfigString() return m_cfg_string.c_str(); } +Uint32 +THRConfig::getThreadCount() const +{ + // Note! not counting T_MAINT + Uint32 cnt = 0; + for (Uint32 i = 0; i < NDB_ARRAY_SIZE(m_threads); i++) + { + if (i != T_MAINT) + { + cnt += m_threads[i].size(); + } + } + return cnt; +} + +Uint32 +THRConfig::getThreadCount(T_Type type) const +{ + for (Uint32 i = 0; i < NDB_ARRAY_SIZE(m_threads); i++) + { + if (i == (Uint32)type) + { + return m_threads[i].size(); + } + } + return 0; +} + const char * THRConfig::getErrorMessage() const { @@ -516,7 +544,7 @@ static char * skipblank(char * str) { - while (isblank(* str)) + while (isspace(* str)) str++; return str; } @@ -564,7 +592,7 @@ parseUnsigned(char *& str, unsigned * ds str = skipblank(str); char * endptr = 0; errno = 0; - long val = strtoll(str, &endptr, 0); + long val = strtol(str, &endptr, 0); if (errno == ERANGE) return -1; if (val < 0 || Int64(val) > 0xFFFFFFFF) @@ -585,7 +613,7 @@ parseBitmask(char *& str, SparseBitmask if (len == 0) return -1; - while (isblank(str[len-1])) + while (isspace(str[len-1])) len--; if (str[len-1] == ',') len--; @@ -830,7 +858,7 @@ THRConfig::do_parse(const char * ThreadC unsigned THRConfig::createCpuSet(const SparseBitmask& mask) { - for (size_t i = 0; i < m_cpu_sets.size(); i++) + for (unsigned i = 0; i < m_cpu_sets.size(); i++) if (m_cpu_sets[i].equal(mask)) return i; === modified file 'storage/ndb/src/kernel/vm/mt_thr_config.hpp' --- a/storage/ndb/src/kernel/vm/mt_thr_config.hpp 2011-08-26 09:57:03 +0000 +++ b/storage/ndb/src/kernel/vm/mt_thr_config.hpp 2011-08-30 12:00:48 +0000 @@ -64,6 +64,9 @@ public: const char * getErrorMessage() const; const char * getInfoMessage() const; + Uint32 getThreadCount() const; // Don't count FS/MAINT thread + Uint32 getThreadCount(T_Type) const; + Uint32 getMtClassic() const { return m_classic; } private: struct T_Thread { === modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp' --- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-07-04 16:30:34 +0000 +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-09-01 13:09:24 +0000 @@ -760,7 +760,7 @@ MgmtSrvr::get_packed_config_from_node(No if (getNodeType(nodeId) != NDB_MGM_NODE_TYPE_NDB) { - error.assfmt("Node %d is not an NDB node. ", nodeId); + error.assfmt("Node %d is not a data node. ", nodeId); DBUG_RETURN(false); } === modified file 'storage/ndb/src/mgmsrv/Services.cpp' --- a/storage/ndb/src/mgmsrv/Services.cpp 2011-07-04 16:30:34 +0000 +++ b/storage/ndb/src/mgmsrv/Services.cpp 2011-09-01 13:09:24 +0000 @@ -623,12 +623,12 @@ MgmApiSession::getConfig(Parser_t::Conte UtilBuffer packed; - bool success = - (from_node == 0 || from_node == m_mgmsrv.getOwnNodeId()) ? - m_mgmsrv.get_packed_config((ndb_mgm_node_type)nodetype, - pack64, error) : - m_mgmsrv.get_packed_config_from_node(from_node, - pack64, error); + bool success = (from_node > 0) ? + m_mgmsrv.get_packed_config_from_node(from_node, + pack64, error) : + m_mgmsrv.get_packed_config((ndb_mgm_node_type)nodetype, + pack64, error); + if (!success) { m_output->println("result: %s", error.c_str()); === modified file 'storage/ndb/src/ndbapi/NdbQueryOperation.cpp' --- a/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2011-08-22 12:56:56 +0000 +++ b/storage/ndb/src/ndbapi/NdbQueryOperation.cpp 2011-09-01 11:46:45 +0000 @@ -47,7 +47,8 @@ */ #define UNUSED(x) ((void)(x)) -//#define TEST_NEXTREQ +// To force usage of SCAN_NEXTREQ even for small scans resultsets +static const bool testNextReq = false; /* Various error codes that are not specific to NdbQuery. */ static const int Err_TupleNotFound = 626; @@ -4255,18 +4256,11 @@ NdbQueryOperationImpl if (myClosestScan != NULL) { -#ifdef TEST_NEXTREQ // To force usage of SCAN_NEXTREQ even for small scans resultsets - if (this == &getRoot()) + if (testNextReq) { m_maxBatchRows = 1; } - else - { - m_maxBatchRows = - myClosestScan->getQueryOperationDef().getTable().getFragmentCount(); - } -#endif const Ndb& ndb = *getQuery().getNdbTransaction().getNdb(); @@ -4312,14 +4306,6 @@ NdbQueryOperationImpl if (m_operationDef.isScanOperation()) { - if (myClosestScan != &getRoot()) - { - /** Each SPJ block instance will scan each fragment, so the batch size - * cannot be smaller than the number of fragments.*/ - maxBatchRows = - MAX(maxBatchRows, myClosestScan->getQueryOperationDef(). - getTable().getFragmentCount()); - } // Use this value for current op and all lookup descendants. m_maxBatchRows = maxBatchRows; // Return max(Unit32) to avoid interfering with batch size calculation @@ -4478,16 +4464,20 @@ NdbQueryOperationImpl::prepareAttrInfo(U batchRows, batchByteSize, firstBatchRows); - assert(batchRows==getMaxBatchRows()); - assert(batchRows==firstBatchRows); + assert(batchRows == firstBatchRows); + assert(batchRows == getMaxBatchRows()); assert(m_parallelism == Parallelism_max || m_parallelism == Parallelism_adaptive); if (m_parallelism == Parallelism_max) { requestInfo |= QN_ScanIndexParameters::SIP_PARALLEL; } - param->requestInfo = requestInfo; - param->batchSize = ((Uint16)batchByteSize << 16) | (Uint16)firstBatchRows; + param->requestInfo = requestInfo; + // Check that both values fit in param->batchSize. + assert(getMaxBatchRows() < (1<batchSize * 8 + - QN_ScanIndexParameters::BatchRowBits))); + param->batchSize = (batchByteSize << 11) | getMaxBatchRows(); param->resultData = getIdOfReceiver(); QueryNodeParameters::setOpLen(param->len, paramType, length); } === modified file 'storage/ndb/tools/ndb_config.cpp' --- a/storage/ndb/tools/ndb_config.cpp 2011-07-04 16:30:34 +0000 +++ b/storage/ndb/tools/ndb_config.cpp 2011-09-01 13:09:24 +0000 @@ -21,11 +21,15 @@ * in xml format (--xml). * * Config can be retrieved from only one of the following sources: - ** config stored at mgmd (default. The options --config_from_node=0, - ** or --config_from_node=1 also give the same results.) - ** config stored at a data node (--config_from_node) - ** my.cnf (--mycnf=) - ** config.file (--config_file= + ** 1) config stored at mgmd (default) + ** 2) config stored at a data node (--config_from_node=) + *** (Note: + *** Node numbers less than 1 give error: + *** "Given value is not a valid node number." + *** Non-data node numbers give error: + *** "Node is not a data node.") + ** 3) my.cnf (--mycnf=) + ** 4) config.file (--config_file= * * Config variables are displayed from only one of the following * sections of the retrieved config: @@ -53,7 +57,7 @@ ** ndb_config --config_from_node=2 --connections --query=type ** ndb_config --config_from_node=2 --query=id,NoOfFragmentLogFiles * - ** Display results for only node 2: + ** Get config from eg. node 2 and display results for node 2 only: *** ndb_config --config_from_node=2 --query=id,NoOfFragmentLogFiles --nodeid=2 */ @@ -139,7 +143,7 @@ static struct my_option my_long_options[ 0, GET_BOOL, NO_ARG, 0, 0, 0, 0, 0, 0}, { "config_from_node", NDB_OPT_NOSHORT, "Use current config from node with given nodeid", (uchar**) &g_config_from_node, (uchar**) &g_config_from_node, - 0, GET_INT, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, + 0, GET_INT, REQUIRED_ARG, INT_MIN, INT_MIN, 0, 0, 0, 0}, { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0} }; @@ -602,13 +606,23 @@ fetch_configuration(int from_node) ndb_mgm_get_connected_host(mgm), ndb_mgm_get_connected_port(mgm)); } - - if (from_node > 1) + + if (from_node == INT_MIN) { - conf = ndb_mgm_get_configuration_from_node(mgm, from_node); + // from_node option is not requested. + // Retrieve config from the default src: mgmd + conf = ndb_mgm_get_configuration(mgm, 0); + } + else if (from_node < 1) + { + fprintf(stderr, "Invalid node number %d is given for --config_from_node.\n", from_node); + goto noconnect; } else - conf = ndb_mgm_get_configuration(mgm, 0); + { + // Retrieve config from the given data node + conf = ndb_mgm_get_configuration_from_node(mgm, from_node); + } if(conf == 0) { No bundle (reason: useless for push emails).