From: Maitrayi Sabaratnam Date: September 1 2011 12:53pm Subject: bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:4491 to 4492) Bug#11766870 List-Archive: http://lists.mysql.com/commits/140883 X-Bug: 11766870 Message-Id: <20110901125340.5184.qmail@asator03> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4492 Maitrayi Sabaratnam 2011-09-01 BUG#11766870 60097: NDB_CONFIG TO DUMP CONFIG VERSION FOR DATA NODES - additional fixes modified: storage/ndb/src/mgmsrv/MgmtSrvr.cpp storage/ndb/src/mgmsrv/Services.cpp storage/ndb/tools/ndb_config.cpp 4491 Jan Wedvik 2011-09-01 This commit concerns pushed queries (i.e. using NdbQueryOperation etc.) with child scan operations. This commit does the following: 1) Earlier, the api would try to set batch size (in bytes and rows) high enough to run child scans with full parallelism, even if this meant exceeding configuration limits (as set by BatchByteSize, BatchSize, and MaxScanBatchSize). The downside of this was that you could potentially get very large batches. (With 64 fragments and 10k records you could get 64x64x10k=40M.) Since sequential child scans (+ adaptive parallelism) have now been implemented we no longer need to run child scans with full parallelism. Therefore, we no longer need to exceed the limits from the configuration. This commit therefore use the batch size (in bytes and rows) that NdbReceiver::calculate_batch_size() suggests. Child scans may then run with reduced parallelism if the allowed number of rows is lower that the number of fragments. (But the user may increase BatchByteSize and MaxScanBatchSize to counter this.) 2) This commit changes how QueryNodeParameters::batchSize is used. Instead of 16 bits for number of rows and 16 for number of bytes, there is now 11 bits for number of rows and 21 for number of bytes. The maximal values for the BatchByteSize and BatchSize configuration variables are 1 megabyte and 992 rows, so 16 bits was not enough for representing all legal values (large values were silently truncated). modified: storage/ndb/include/kernel/signaldata/QueryTree.hpp storage/ndb/src/kernel/blocks/dbspj/DbspjMain.cpp storage/ndb/src/ndbapi/NdbQueryOperation.cpp === modified file 'storage/ndb/src/mgmsrv/MgmtSrvr.cpp' --- a/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-07-04 13:37:56 +0000 +++ b/storage/ndb/src/mgmsrv/MgmtSrvr.cpp 2011-09-01 12:37:44 +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 13:37:56 +0000 +++ b/storage/ndb/src/mgmsrv/Services.cpp 2011-09-01 12:37:44 +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/tools/ndb_config.cpp' --- a/storage/ndb/tools/ndb_config.cpp 2011-07-04 13:37:56 +0000 +++ b/storage/ndb/tools/ndb_config.cpp 2011-09-01 12:37:44 +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).