From: Mauritz Sundell Date: November 14 2012 2:49pm Subject: bzr push into mysql-5.1-telco-7.1 branch (mauritz.sundell:4662 to 4663) List-Archive: http://lists.mysql.com/commits/145263 Message-Id: <201211141449.qAEEnrpW004961@acsmt357.oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4663 Mauritz Sundell 2012-11-14 [merge] Merge 7.0 -> 7.1 modified: mysql-test/suite/ndb/t/ndb_backup_rate.cnf storage/ndb/include/ndbapi/ndb_cluster_connection.hpp storage/ndb/src/ndbapi/DictCache.hpp storage/ndb/src/ndbapi/ndb_cluster_connection.cpp storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp storage/ndb/test/include/NDBT_Test.hpp storage/ndb/test/ndbapi/testMgm.cpp storage/ndb/test/src/NDBT_Test.cpp 4662 magnus.blaudd@stripped 2012-11-13 [merge] Merge removed: storage/ndb/compile-cluster added: storage/ndb/compile-cluster === modified file 'mysql-test/suite/ndb/t/ndb_backup_rate.cnf' --- a/mysql-test/suite/ndb/t/ndb_backup_rate.cnf 2012-09-13 20:18:47 +0000 +++ b/mysql-test/suite/ndb/t/ndb_backup_rate.cnf 2012-11-14 14:12:32 +0000 @@ -6,4 +6,7 @@ BackupMemory=15M BackupDataBufferSize=11M BackupLogBufferSize = 3M BackupMaxWriteSize=10M -DiskCheckpointSpeed=1M \ No newline at end of file +DiskCheckpointSpeed=1M + +[cluster_config.mysqld.1.1] +DefaultOperationRedoProblemAction=abort === modified file 'storage/ndb/include/ndbapi/ndb_cluster_connection.hpp' --- a/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp 2011-09-21 10:30:37 +0000 +++ b/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp 2012-11-14 14:40:14 +0000 @@ -221,6 +221,7 @@ private: friend class Ndb_cluster_connection_impl; friend class SignalSender; friend class NdbWaitGroup; + friend class NDBT_Context; class Ndb_cluster_connection_impl & m_impl; Ndb_cluster_connection(Ndb_cluster_connection_impl&); === modified file 'storage/ndb/src/ndbapi/DictCache.hpp' --- a/storage/ndb/src/ndbapi/DictCache.hpp 2011-02-01 23:27:25 +0000 +++ b/storage/ndb/src/ndbapi/DictCache.hpp 2012-11-14 14:19:51 +0000 @@ -19,7 +19,6 @@ #define DictCache_H #include -#include #include #include #include === modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection.cpp' --- a/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2012-03-05 13:02:16 +0000 +++ b/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp 2012-11-14 14:40:14 +0000 @@ -725,24 +725,28 @@ Ndb_cluster_connection_impl::configure(U m_config.m_batch_size= batch_size; } - // Configure timeouts - Uint32 timeout = 120000; - for (iter.first(); iter.valid(); iter.next()) - { - Uint32 tmp1 = 0, tmp2 = 0; - iter.get(CFG_DB_TRANSACTION_CHECK_INTERVAL, &tmp1); - iter.get(CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, &tmp2); - tmp1 += tmp2; - if (tmp1 > timeout) - timeout = tmp1; - } - m_config.m_waitfor_timeout = timeout; - Uint32 queue = 0; if (!iter.get(CFG_DEFAULT_OPERATION_REDO_PROBLEM_ACTION, &queue)) { m_config.m_default_queue_option = queue; } + + // Configure timeouts + { + Uint32 timeout = 120000; + // Use new iterator to leave iter valid. + ndb_mgm_configuration_iterator iterall(config, CFG_SECTION_NODE); + for (; iterall.valid(); iterall.next()) + { + Uint32 tmp1 = 0, tmp2 = 0; + iterall.get(CFG_DB_TRANSACTION_CHECK_INTERVAL, &tmp1); + iterall.get(CFG_DB_TRANSACTION_DEADLOCK_TIMEOUT, &tmp2); + tmp1 += tmp2; + if (tmp1 > timeout) + timeout = tmp1; + } + m_config.m_waitfor_timeout = timeout; + } } DBUG_RETURN(init_nodes_vector(nodeId, config)); } === modified file 'storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp' --- a/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2011-09-09 10:48:14 +0000 +++ b/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp 2012-11-14 14:20:25 +0000 @@ -23,6 +23,7 @@ #include #include #include "DictCache.hpp" +#include "kernel/ndb_limits.h" extern NdbMutex *g_ndb_connection_mutex; @@ -79,6 +80,7 @@ private: friend class Ndb_cluster_connection; friend class NdbEventBuffer; friend class SignalSender; + friend class NDBT_Context; struct Node { === modified file 'storage/ndb/test/include/NDBT_Test.hpp' --- a/storage/ndb/test/include/NDBT_Test.hpp 2011-12-16 13:57:51 +0000 +++ b/storage/ndb/test/include/NDBT_Test.hpp 2012-11-14 14:20:25 +0000 @@ -31,6 +31,7 @@ #include #include #include +#include "../../src/ndbapi/ndb_cluster_connection_impl.hpp" class NDBT_Step; class NDBT_TestCase; @@ -107,6 +108,10 @@ public: */ bool closeToTimeout(int safety_percent = 0); + /** + * Get config by beeing friend to ndb_cluster_connection_impl - ugly + */ + NdbApiConfig const& getConfig() const; private: friend class NDBT_Step; friend class NDBT_TestSuite; === modified file 'storage/ndb/test/ndbapi/testMgm.cpp' --- a/storage/ndb/test/ndbapi/testMgm.cpp 2011-12-02 08:24:09 +0000 +++ b/storage/ndb/test/ndbapi/testMgm.cpp 2012-11-14 14:40:14 +0000 @@ -2917,6 +2917,118 @@ runBug12928429(NDBT_Context* ctx, NDBT_S return NDBT_OK; } +int runTestNdbApiConfig(NDBT_Context* ctx, NDBT_Step* step) +{ + NdbMgmd mgmd; + + if (!mgmd.connect()) + return NDBT_FAILED; + + // Get connectstring from main connection + char constr[256]; + if (!ctx->m_cluster_connection.get_connectstring(constr, + sizeof(constr))) + { + g_err << "Too short buffer for connectstring" << endl; + return NDBT_FAILED; + } + + struct test_parameter + { + Uint32 key; + Uint32 NdbApiConfig::*ptr; + Uint32 values[2]; + } parameters[] = + { + { CFG_MAX_SCAN_BATCH_SIZE, &NdbApiConfig::m_scan_batch_size, { 10, 1000 } }, + { CFG_BATCH_BYTE_SIZE, &NdbApiConfig::m_batch_byte_size, { 10, 1000 } }, + { CFG_BATCH_SIZE, &NdbApiConfig::m_batch_size, { 10, 1000 } }, + { CFG_DEFAULT_OPERATION_REDO_PROBLEM_ACTION, &NdbApiConfig::m_default_queue_option, + { OPERATION_REDO_PROBLEM_ACTION_ABORT, OPERATION_REDO_PROBLEM_ACTION_QUEUE } } + }; + // Catch if new members are added to NdbApiConfig, + // if so add tests and adjust expected size + NDB_STATIC_ASSERT(sizeof(NdbApiConfig) == 20); + + for (size_t i = 0; i < NDB_ARRAY_SIZE(parameters[0].values) ; i ++) + { + /** + * Setup configuration + */ + + // Get the binary config + Config conf; + if (!mgmd.get_config(conf)) + return false; + + ConfigValues::Iterator iter(conf.m_configValues->m_config); + for (Uint32 section_no = 1; section_no < MAX_NODES; section_no ++) + { + Uint32 type; + if (!iter.openSection(CFG_SECTION_NODE, section_no)) + continue; + + if (iter.get(CFG_TYPE_OF_SECTION, &type) && + type == NDB_MGM_NODE_TYPE_API) + { + for (size_t param = 0; param < NDB_ARRAY_SIZE(parameters) ; param ++) + { + iter.set(parameters[param].key, parameters[param].values[i]); + } + } + + iter.closeSection(); + } + + // Set the modified config + if (!mgmd.set_config(conf)) + return false; + + /** + * Connect api + */ + + Ndb_cluster_connection con(constr); + + const int retries = 12; + const int retry_delay = 5; + const int verbose = 1; + if (con.connect(retries, retry_delay, verbose) != 0) + { + g_err << "Ndb_cluster_connection.connect failed" << endl; + return NDBT_FAILED; + } + + /** + * Check api configuration + */ + + NDBT_Context conctx(con); + + for (size_t param = 0; param < NDB_ARRAY_SIZE(parameters) ; param ++) + { + Uint32 expected = parameters[param].values[i]; + Uint32 got = conctx.getConfig().*parameters[param].ptr; + if (got != expected) + { + int j; + for(j = 0; j < ConfigInfo::m_NoOfParams ; j ++) + { + if (ConfigInfo::m_ParamInfo[j]._paramId == parameters[param].key) + break; + } + g_err << "Paramater "; + if (j < ConfigInfo::m_NoOfParams) + g_err << ConfigInfo::m_ParamInfo[j]._fname << " (" << parameters[param].key << ")"; + else + g_err << "Unknown (" << parameters[param].key << ")"; + g_err << ": Expected " << expected << " got " << got << endl; + } + } + } + return NDBT_OK; +} + NDBT_TESTSUITE(testMgm); DRIVER(DummyDriver); /* turn off use of NdbApi */ TESTCASE("ApiSessionFailure", @@ -3058,6 +3170,10 @@ TESTCASE("Bug12928429", "") { STEP(runBug12928429); } +TESTCASE("TestNdbApiConfig", "") +{ + STEP(runTestNdbApiConfig); +} NDBT_TESTSUITE_END(testMgm); int main(int argc, const char** argv){ === modified file 'storage/ndb/test/src/NDBT_Test.cpp' --- a/storage/ndb/test/src/NDBT_Test.cpp 2012-07-05 11:19:04 +0000 +++ b/storage/ndb/test/src/NDBT_Test.cpp 2012-11-14 14:20:25 +0000 @@ -1685,6 +1685,12 @@ NDBT_Context::closeToTimeout(int safety) return false; } +NdbApiConfig const& +NDBT_Context::getConfig() const +{ + return m_cluster_connection.m_impl.m_config; +} + template class Vector; template class Vector; template class Vector; No bundle (reason: useless for push emails).