From: Date: June 17 2008 10:49am Subject: bzr commit into mysql-5.1-telco-6.2 branch (jonas:2625) Bug#37442 List-Archive: http://lists.mysql.com/commits/47969 X-Bug: 37442 Message-Id: <20080617084943.DE44A74FC1F@perch.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit #At file:///home/jonas/src/telco-6.2/ 2625 jonas@stripped 2008-06-17 ndb - bug#37442 remove node from c_subscriber_nodes-mask when last subscribers is removed modified: storage/ndb/src/kernel/blocks/suma/Suma.cpp storage/ndb/src/kernel/blocks/suma/Suma.hpp storage/ndb/src/kernel/blocks/suma/SumaInit.cpp storage/ndb/test/ndbapi/test_event.cpp storage/ndb/test/run-test/daily-basic-tests.txt per-file comments: storage/ndb/src/kernel/blocks/suma/Suma.cpp add counter of subscriptions per node storage/ndb/src/kernel/blocks/suma/Suma.hpp add counter of subscriptions per node storage/ndb/src/kernel/blocks/suma/SumaInit.cpp add counter of subscriptions per node storage/ndb/test/ndbapi/test_event.cpp testcase storage/ndb/test/run-test/daily-basic-tests.txt testcase === modified file 'storage/ndb/src/kernel/blocks/suma/Suma.cpp' --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2008-06-16 06:25:29 +0000 +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp 2008-06-17 08:49:39 +0000 @@ -733,6 +733,7 @@ void Suma::execAPI_FAILREQ(Signal* signa c_failedApiNodes.set(failedApiNode); c_subscriber_nodes.clear(failedApiNode); + c_subscriber_per_node[failedApiNode] = 0; check_start_handover(signal); @@ -2679,6 +2680,7 @@ Suma::report_sub_start_conf(Signal* sign list.add(ptr); c_subscriber_nodes.set(refToNode(ptr.p->m_senderRef)); + c_subscriber_per_node[refToNode(ptr.p->m_senderRef)]++; } else { @@ -3156,6 +3158,17 @@ Suma::report_sub_stop_conf(Signal* signa conf->senderData= senderData; sendSignal(senderRef, GSN_SUB_STOP_CONF, signal, SubStopConf::SignalLength, JBB); + + Uint32 nodeId = refToNode(ptr.p->m_senderRef); + if (c_subscriber_per_node[nodeId]) + { + c_subscriber_per_node[nodeId]--; + if (c_subscriber_per_node[nodeId] == 0) + { + jam(); + c_subscriber_nodes.clear(nodeId); + } + } } void === modified file 'storage/ndb/src/kernel/blocks/suma/Suma.hpp' --- a/storage/ndb/src/kernel/blocks/suma/Suma.hpp 2008-06-16 06:25:29 +0000 +++ b/storage/ndb/src/kernel/blocks/suma/Suma.hpp 2008-06-17 08:49:39 +0000 @@ -578,7 +578,8 @@ private: STATIC_CONST( NO_OF_BUCKETS = 24 ); // 24 = 4*3*2*1! Uint32 c_no_of_buckets; struct Bucket c_buckets[NO_OF_BUCKETS]; - + Uint32 c_subscriber_per_node[MAX_NODES]; + STATIC_CONST( BUCKET_MASK_SIZE = (((NO_OF_BUCKETS+31)>> 5)) ); typedef Bitmask Bucket_mask; Bucket_mask m_active_buckets; === modified file 'storage/ndb/src/kernel/blocks/suma/SumaInit.cpp' --- a/storage/ndb/src/kernel/blocks/suma/SumaInit.cpp 2008-02-20 09:04:29 +0000 +++ b/storage/ndb/src/kernel/blocks/suma/SumaInit.cpp 2008-06-17 08:49:39 +0000 @@ -124,6 +124,7 @@ Suma::Suma(Block_context& ctx) : m_gcp_monitor = 0; #endif m_missing_data = false; + bzero(c_subscriber_per_node, sizeof(c_subscriber_per_node)); } Suma::~Suma() === modified file 'storage/ndb/test/ndbapi/test_event.cpp' --- a/storage/ndb/test/ndbapi/test_event.cpp 2008-06-11 19:49:15 +0000 +++ b/storage/ndb/test/ndbapi/test_event.cpp 2008-06-17 08:49:39 +0000 @@ -2645,6 +2645,52 @@ runBug37338(NDBT_Context* ctx, NDBT_Step return NDBT_OK; } +int +runBug37442(NDBT_Context* ctx, NDBT_Step* step) +{ + NdbRestarter res; + if (res.getNumDbNodes() < 2) + { + ctx->stopTest(); + return NDBT_OK; + } + + int nodeId = res.getDbNodeId(rand() % res.getNumDbNodes()); + + Ndb* pNdb = GETNDB(step); + NdbDictionary::Dictionary* dict = pNdb->getDictionary(); + const NdbDictionary::Table* tab = dict->getTable(ctx->getTab()->getName()); + + if (runCreateEvent(ctx, step)) + { + return NDBT_FAILED; + } + + for (int i = 0; igetNumLoops(); i++) + { + NdbEventOperation * pOp = createEventOperation(GETNDB(step), *tab); + + res.restartOneDbNode(nodeId, + /** initial */ false, + /** nostart */ true, + /** abort */ true); + + res.waitNodesNoStart(&nodeId, 1); + + GETNDB(step)->dropEventOperation(pOp); + + res.startNodes(&nodeId, 1); + if (res.waitClusterStarted()) + { + return NDBT_FAILED; + } + } + + runDropEvent(ctx, step); + + return NDBT_OK; +} + NDBT_TESTSUITE(test_event); TESTCASE("BasicEventOperation", "Verify that we can listen to Events" @@ -2832,6 +2878,10 @@ TESTCASE("Bug37338", "") { INITIALIZER(runBug37338); } +TESTCASE("Bug37442", "") +{ + INITIALIZER(runBug37442); +} NDBT_TESTSUITE_END(test_event); int main(int argc, const char** argv){ === modified file 'storage/ndb/test/run-test/daily-basic-tests.txt' --- a/storage/ndb/test/run-test/daily-basic-tests.txt 2008-06-11 19:49:15 +0000 +++ b/storage/ndb/test/run-test/daily-basic-tests.txt 2008-06-17 08:49:39 +0000 @@ -1106,6 +1106,10 @@ max-time: 300 cmd: test_event args: -n Bug37338 T1 +max-time: 300 +cmd: test_event +args: -n Bug37442 T1 + # 2008-04-22 max-time: 1500 cmd: testNodeRestart