From eaff83cb0ace80ec2165d5dba9b45284b4500e15 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Apr 2007 10:05:01 +0200 Subject: [PATCH 1/2] ndb - bug#27728 (5.1) Make sure API is connected to nodes when subscribing storage/ndb/include/kernel/signaldata/SumaImpl.hpp: new error code storage/ndb/src/kernel/blocks/suma/Suma.cpp: make sure API is connected in SUB_START_REQ storage/ndb/src/ndbapi/ndberror.c: new error code --- storage/ndb/include/kernel/signaldata/SumaImpl.hpp | 3 ++- storage/ndb/src/kernel/blocks/suma/Suma.cpp | 10 ++++++++++ storage/ndb/src/ndbapi/ndberror.c | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/storage/ndb/include/kernel/signaldata/SumaImpl.hpp b/storage/ndb/include/kernel/signaldata/SumaImpl.hpp index 077ea8e879c..072c3955ac4 100644 --- a/storage/ndb/include/kernel/signaldata/SumaImpl.hpp +++ b/storage/ndb/include/kernel/signaldata/SumaImpl.hpp @@ -119,7 +119,8 @@ struct SubStartRef { Undefined = 1, NF_FakeErrorREF = 11, Busy = 701, - NotMaster = 702 + NotMaster = 702, + PartiallyConnected = 1421 }; STATIC_CONST( SignalLength = 7 ); diff --git a/storage/ndb/src/kernel/blocks/suma/Suma.cpp b/storage/ndb/src/kernel/blocks/suma/Suma.cpp index 1197ffdad94..717448ca03b 100644 --- a/storage/ndb/src/kernel/blocks/suma/Suma.cpp +++ b/storage/ndb/src/kernel/blocks/suma/Suma.cpp @@ -2394,6 +2394,16 @@ Suma::execSUB_START_REQ(Signal* signal){ sendSubStartRef(signal, 1412); DBUG_VOID_RETURN; } + + if (c_startup.m_restart_server_node_id == 0 && + !c_connected_nodes.get(refToNode(subscriberRef))) + + { + jam(); + sendSubStartRef(signal, SubStartRef::PartiallyConnected); + return; + } + DBUG_PRINT("info",("c_subscriberPool size: %d free: %d", c_subscriberPool.getSize(), c_subscriberPool.getNoOfFree())); diff --git a/storage/ndb/src/ndbapi/ndberror.c b/storage/ndb/src/ndbapi/ndberror.c index 13e6c95644c..ed3829ed74f 100644 --- a/storage/ndb/src/ndbapi/ndberror.c +++ b/storage/ndb/src/ndbapi/ndberror.c @@ -490,6 +490,7 @@ ErrorBundle ErrorCodes[] = { { 1419, DMEC, SE, "Subscription already dropped" }, { 1420, DMEC, TR, "Subscriber manager busy with adding/removing a table" }, + { 1421, DMEC, SE, "Partially connected API in NdbOperation::execute()" }, { 4004, DMEC, AE, "Attribute name or id not found in the table" }, From 01a007a5663adf2d63fbfbb55138642eb624fd1e Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 10 Apr 2007 10:15:35 +0200 Subject: [PATCH 2/2] ndb - bug#27651 (5.1) Only prepare "next" GCI if we're in the first 4 highest GCI's to avoid we can get several buckets with same GCI storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp: Only prepare "next" GCI if we're in the first 4 highest GCI's to avoid we can get several buckets with same GCI --- .../ndb/src/ndbapi/NdbEventOperationImpl.cpp | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp index 828ba51bc21..b75bfb16dd2 100644 --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp @@ -979,7 +979,7 @@ NdbEventOperationImpl::printAll() NdbEventBuffer::NdbEventBuffer(Ndb *ndb) : m_system_nodes(ndb->theImpl->theNoOfDBnodes), m_ndb(ndb), - m_latestGCI(0), + m_latestGCI(0), m_latest_complete_GCI(0), m_total_alloc(0), m_free_thresh(10), m_min_free_thresh(10), @@ -1470,7 +1470,7 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) , m_flush_gci #endif ); - + Uint32 idx = bucket - (Gci_container*)m_active_gci.getBase(); if (unlikely(bucket == 0)) { /** @@ -1515,8 +1515,20 @@ NdbEventBuffer::execSUB_GCP_COMPLETE_REP(const SubGcpCompleteRep * const rep) } reportStatus(); bzero(bucket, sizeof(Gci_container)); - bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE; - bucket->m_gcp_complete_rep_count = m_system_nodes; + if (likely(idx < ACTIVE_GCI_DIRECTORY_SIZE)) + { + /** + * Only "prepare" next GCI if we're in + * the first 4 highest GCI's...else + * this is somekind of "late" GCI... + * which is only initialized to 0 + * + * This to make sure we dont get several buckets with same GCI + */ + bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE; + bucket->m_gcp_complete_rep_count = m_system_nodes; + } + if(unlikely(m_latest_complete_GCI > gci)) { complete_outof_order_gcis();