From: Date: September 14 2008 10:00pm Subject: bzr push into mysql-5.1 branch (jonas:2760 to 2761) List-Archive: http://lists.mysql.com/commits/54045 Message-Id: <20080914200027.80DAC21DAB@perch.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 2761 Jonas Oreland 2008-09-14 ndb - nasty hack for handling dataevent *prior* to sub_start_conf modified: storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2760 Jonas Oreland 2008-09-14 ndb - argh...create/get fragmentation are crazy modified: storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp === modified file 'storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp' --- a/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2008-09-14 07:38:10 +0000 +++ b/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp 2008-09-14 19:11:05 +0000 @@ -640,7 +640,6 @@ Dbdict::execCREATE_FRAGMENTATION_REQ(Sig if (req->primaryTableId == RNIL) { jam(); - req->requestInfo = CreateFragmentationReq::RI_GET_FRAGMENTATION; EXECUTE_DIRECT(DBDIH, GSN_CREATE_FRAGMENTATION_REQ, signal, CreateFragmentationReq::SignalLength); return; @@ -653,7 +652,11 @@ Dbdict::execCREATE_FRAGMENTATION_REQ(Sig if (te->m_tableState != SchemaFile::SF_CREATE) { jam(); - req->requestInfo = CreateFragmentationReq::RI_GET_FRAGMENTATION; + if (req->requestInfo == 0) + { + jam(); + req->requestInfo |= CreateFragmentationReq::RI_GET_FRAGMENTATION; + } EXECUTE_DIRECT(DBDIH, GSN_CREATE_FRAGMENTATION_REQ, signal, CreateFragmentationReq::SignalLength); return; === modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp' --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2008-09-13 09:55:40 +0000 +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp 2008-09-14 20:00:09 +0000 @@ -611,8 +611,9 @@ NdbEventOperationImpl::execute_nolock() Uint32 buckets = 0; int r= NdbDictionaryImpl::getImpl(*myDict).executeSubscribeEvent(*this, buckets); - if (r == 0) { - m_ndb->theEventBuffer->m_total_buckets = buckets; + if (r == 0) + { + m_ndb->theEventBuffer->set_total_buckets(buckets); if (theMainOp == NULL) { DBUG_PRINT("info", ("execute blob ops")); @@ -1042,10 +1043,10 @@ NdbEventOperationImpl::printAll() * Class NdbEventBuffer * Each Ndb object has a Object. */ - +#define TOTAL_BUCKETS_INIT (1 << 15) NdbEventBuffer::NdbEventBuffer(Ndb *ndb) : - m_total_buckets(0), + m_total_buckets(TOTAL_BUCKETS_INIT), m_min_gci_index(0), m_max_gci_index(0), m_ndb(ndb), @@ -2195,6 +2196,42 @@ NdbEventBuffer::handle_change_nodegroup( } void +NdbEventBuffer::set_total_buckets(Uint32 cnt) +{ + if (m_total_buckets == cnt) + return; + + assert(m_total_buckets == TOTAL_BUCKETS_INIT); + m_total_buckets = cnt; + + Uint64 * array = m_known_gci.getBase(); + Uint32 mask = m_known_gci.size() - 1; + Uint32 minpos = m_min_gci_index; + Uint32 maxpos = m_max_gci_index; + + bool found = false; + Uint32 pos = minpos; + for (; pos != maxpos; pos = (pos + 1) & mask) + { + Gci_container* tmp = find_bucket(array[pos]); + assert(tmp->m_gcp_complete_rep_count >= TOTAL_BUCKETS_INIT); + tmp->m_gcp_complete_rep_count -= TOTAL_BUCKETS_INIT; + if (tmp->m_gcp_complete_rep_count == 0) + { + found = true; + if (0) + ndbout_c("set_total_buckets(%u) complete %u/%u", + cnt, Uint32(tmp->m_gci >> 32), Uint32(tmp->m_gci)); + complete_bucket(tmp); + } + } + if (found) + { + NdbCondition_Signal(p_cond); + } +} + +void NdbEventBuffer::report_node_connected(Uint32 node_id) { NdbEventOperation* op= m_ndb->getEventOperation(0); === modified file 'storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp' --- a/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2008-09-12 12:55:29 +0000 +++ b/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp 2008-09-14 20:00:09 +0000 @@ -666,6 +666,9 @@ private: void resize_known_gci(); void handle_change_nodegroup(const SubGcpCompleteRep*); + +public: + void set_total_buckets(Uint32); }; inline