4937 Mauritz Sundell 2012-06-07
ndb - fifo idle connection list
This ensures that the list of connections to the TC block is kept in a FIFO queue rather than a
LIFO queue. Using a LIFO queue gave very unbalanced accesses to the TC blocks, there could
be as much as a 10x difference between the different TC blocks in a node.
Part of Mikael Ronstroms "Patches used in benchmark tree with Intel"
modified:
storage/ndb/include/ndbapi/Ndb.hpp
storage/ndb/src/ndbapi/Ndb.cpp
storage/ndb/src/ndbapi/Ndbinit.cpp
storage/ndb/src/ndbapi/Ndblist.cpp
4936 Mauritz Sundell 2012-06-07
ndb - slowdown scans
Invokes slowdown of scans when we reach 60% fill level instead of at blocking level at
75% where primary key access is even stoppped (this is fill level of send buffer).
Part of Mikael Ronstroms "Patches used in benchmark tree with Intel"
modified:
storage/ndb/include/transporter/TransporterRegistry.hpp
storage/ndb/src/common/transporter/TCP_Transporter.cpp
storage/ndb/src/common/transporter/Transporter.cpp
storage/ndb/src/common/transporter/Transporter.hpp
storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
4935 Mauritz Sundell 2012-06-07
ndb - refactoring, rename of block variable
Variables declared in for loop header should be
assumed to be in same scope as loop body.
And so names of variables declared in loop header
should not be reused in loop body.
This is detected in gcc47 but not in earlier gcc-versions.
modified:
storage/ndb/src/common/util/HashMap2.cpp
=== modified file 'storage/ndb/include/ndbapi/Ndb.hpp'
--- a/storage/ndb/include/ndbapi/Ndb.hpp 2011-10-17 12:43:31 +0000
+++ b/storage/ndb/include/ndbapi/Ndb.hpp 2012-06-07 14:49:35 +0000
@@ -1927,6 +1927,12 @@ private:
* Returns NULL if none found
*/
NdbTransaction* getConnectedNdbTransaction(Uint32 nodeId, Uint32 instance);
+ /**
+ * Handle Connection Array lists
+ */
+ void appendConnectionArray(NdbTransaction *aCon, Uint32 nodeId);
+ void prependConnectionArray(NdbTransaction *aCon, Uint32 nodeId);
+ void removeConnectionArray(NdbTransaction *first, Uint32 nodeId);
// Release and disconnect from DBTC a connection
// and seize it to theConIdleList
@@ -2012,6 +2018,7 @@ private:
NdbTransaction* theTransactionList;
NdbTransaction** theConnectionArray;
+ NdbTransaction** theConnectionArrayLast;
Uint32 theMyRef; // My block reference
Uint32 theNode; // The node number of our node
=== modified file 'storage/ndb/include/transporter/TransporterRegistry.hpp'
--- a/storage/ndb/include/transporter/TransporterRegistry.hpp 2012-01-30 14:28:55 +0000
+++ b/storage/ndb/include/transporter/TransporterRegistry.hpp 2012-06-07 14:46:55 +0000
@@ -294,6 +294,13 @@ public:
const NodeBitmask& get_status_overloaded() const;
/**
+ * Set or clear slowdown bit.
+ * Query if any slowdown bit is set.
+ */
+ void set_status_slowdown(Uint32 nodeId, bool val);
+ const NodeBitmask& get_status_slowdown() const;
+
+ /**
* prepareSend
*
* When IOState is HaltOutput or HaltIO do not send or insert any
@@ -433,8 +440,10 @@ private:
/**
* Overloaded bits, for fast check.
+ * Similarly slowdown bits for fast check.
*/
NodeBitmask m_status_overloaded;
+ NodeBitmask m_status_slowdown;
/**
* Unpack signal data.
@@ -593,6 +602,8 @@ TransporterRegistry::set_status_overload
assert(nodeId < MAX_NODES);
if (val != m_status_overloaded.get(nodeId))
m_status_overloaded.set(nodeId, val);
+ if (val)
+ set_status_slowdown(nodeId, val);
}
inline const NodeBitmask&
@@ -601,4 +612,18 @@ TransporterRegistry::get_status_overload
return m_status_overloaded;
}
+inline void
+TransporterRegistry::set_status_slowdown(Uint32 nodeId, bool val)
+{
+ assert(nodeId < MAX_NODES);
+ if (val != m_status_slowdown.get(nodeId))
+ m_status_slowdown.set(nodeId, val);
+}
+
+inline const NodeBitmask&
+TransporterRegistry::get_status_slowdown() const
+{
+ return m_status_slowdown;
+}
+
#endif // Define of TransporterRegistry_H
=== modified file 'storage/ndb/src/common/transporter/TCP_Transporter.cpp'
--- a/storage/ndb/src/common/transporter/TCP_Transporter.cpp 2012-01-16 08:42:18 +0000
+++ b/storage/ndb/src/common/transporter/TCP_Transporter.cpp 2012-06-07 14:46:55 +0000
@@ -112,6 +112,10 @@ TCP_Transporter::TCP_Transporter(Transpo
setIf(sockOptTcpMaxSeg, conf->tcp.tcpMaxsegSize, 0);
m_overload_limit = overload_limit(conf);
+ /**
+ * Always set slowdown limit to 60% of overload limit
+ */
+ m_slowdown_limit = m_overload_limit * 6 / 10;
}
=== modified file 'storage/ndb/src/common/transporter/Transporter.cpp'
--- a/storage/ndb/src/common/transporter/Transporter.cpp 2012-04-24 08:33:27 +0000
+++ b/storage/ndb/src/common/transporter/Transporter.cpp 2012-06-07 14:46:55 +0000
@@ -43,7 +43,8 @@ Transporter::Transporter(TransporterRegi
: m_s_port(s_port), remoteNodeId(rNodeId), localNodeId(lNodeId),
isServer(lNodeId==serverNodeId),
m_packer(_signalId, _checksum), m_max_send_buffer(max_send_buffer),
- m_overload_limit(0xFFFFFFFF), isMgmConnection(_isMgmConnection),
+ m_overload_limit(0xFFFFFFFF), m_slowdown_limit(0xFFFFFFFF),
+ isMgmConnection(_isMgmConnection),
m_connected(false),
m_type(_type),
m_transporter_registry(t_reg)
=== modified file 'storage/ndb/src/common/transporter/Transporter.hpp'
--- a/storage/ndb/src/common/transporter/Transporter.hpp 2012-04-24 08:33:27 +0000
+++ b/storage/ndb/src/common/transporter/Transporter.hpp 2012-06-07 14:46:55 +0000
@@ -90,6 +90,8 @@ public:
{
m_transporter_registry.set_status_overloaded(remoteNodeId,
used >= m_overload_limit);
+ m_transporter_registry.set_status_slowdown(remoteNodeId,
+ used >= m_slowdown_limit);
}
virtual int doSend() = 0;
@@ -155,6 +157,7 @@ protected:
Uint32 m_max_send_buffer;
/* Overload limit, as configured with the OverloadLimit config parameter. */
Uint32 m_overload_limit;
+ Uint32 m_slowdown_limit;
private:
=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2012-05-31 14:42:04 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2012-06-07 14:46:55 +0000
@@ -11353,13 +11353,13 @@ void Dblqh::scanTupkeyConfLab(Signal* si
scanptr.p->m_curr_batch_size_rows = rows + 1;
scanptr.p->m_last_row = tdata5;
- const NodeBitmask& all = globalTransporterRegistry.get_status_overloaded();
+ const NodeBitmask& all = globalTransporterRegistry.get_status_slowdown();
if (unlikely(!all.isclear()))
{
if (all.get(refToNode(scanptr.p->scanApiBlockref)))
{
/**
- * End scan batch if transporter-buffer are overloaded
+ * End scan batch if transporter-buffer are in slowdown state
*
* TODO: We should have counters for this...
*/
=== modified file 'storage/ndb/src/ndbapi/Ndb.cpp'
--- a/storage/ndb/src/ndbapi/Ndb.cpp 2011-10-17 12:43:31 +0000
+++ b/storage/ndb/src/ndbapi/Ndb.cpp 2012-06-07 14:49:35 +0000
@@ -162,6 +162,8 @@ Ndb::NDB_connect(Uint32 tNode, Uint32 in
if (prev != 0)
{
prev->theNext = curr->theNext;
+ if (!curr->theNext)
+ theConnectionArrayLast[tNode] = prev;
curr->theNext = tConArray;
theConnectionArray[tNode] = curr;
}
@@ -210,12 +212,10 @@ Ndb::NDB_connect(Uint32 tNode, Uint32 in
//************************************************
// Send and receive was successful
//************************************************
- NdbTransaction* tPrevFirst = theConnectionArray[tNode];
tNdbCon->setConnectedNodeId(tNode, nodeSequence);
tNdbCon->setMyBlockReference(theMyRef);
- theConnectionArray[tNode] = tNdbCon;
- tNdbCon->theNext = tPrevFirst;
+ prependConnectionArray(tNdbCon, tNode);
DBUG_RETURN(1);
} else {
//****************************************************************************
@@ -261,6 +261,8 @@ Ndb::getConnectedNdbTransaction(Uint32 n
{
assert(false); // Should have been moved in NDB_connect
prev->theNext = next->theNext;
+ if (!next->theNext)
+ theConnectionArrayLast[nodeId] = prev;
goto found_middle;
}
else
@@ -276,7 +278,7 @@ Ndb::getConnectedNdbTransaction(Uint32 n
return 0;
}
found_first:
- theConnectionArray[nodeId] = next->theNext;
+ removeConnectionArray(next, nodeId);
found_middle:
next->theNext = NULL;
@@ -944,6 +946,48 @@ Ndb::startTransactionLocal(Uint32 aPrior
DBUG_RETURN(tConnection);
}//Ndb::startTransactionLocal()
+void
+Ndb::appendConnectionArray(NdbTransaction *aCon, Uint32 nodeId)
+{
+ NdbTransaction *last = theConnectionArrayLast[nodeId];
+ if (last)
+ {
+ last->theNext = aCon;
+ }
+ else
+ {
+ theConnectionArray[nodeId] = aCon;
+ }
+ aCon->theNext = NULL;
+ theConnectionArrayLast[nodeId] = aCon;
+}
+
+void
+Ndb::prependConnectionArray(NdbTransaction *aCon, Uint32 nodeId)
+{
+ NdbTransaction *first = theConnectionArray[nodeId];
+ aCon->theNext = first;
+ if (!first)
+ {
+ theConnectionArrayLast[nodeId] = aCon;
+ }
+ theConnectionArray[nodeId] = aCon;
+}
+
+void
+Ndb::removeConnectionArray(NdbTransaction *first, Uint32 nodeId)
+{
+ NdbTransaction *next = first->theNext;
+ if (!next)
+ {
+ theConnectionArray[nodeId] = theConnectionArrayLast[nodeId] = NULL;
+ }
+ else
+ {
+ theConnectionArray[nodeId] = next;
+ }
+}
+
/*****************************************************************************
void closeTransaction(NdbTransaction* aConnection);
@@ -1044,8 +1088,8 @@ Ndb::closeTransaction(NdbTransaction* aC
/**
* Put it back in idle list for that node
*/
- aConnection->theNext = theConnectionArray[nodeId];
- theConnectionArray[nodeId] = aConnection;
+ appendConnectionArray(aConnection, nodeId);
+
DBUG_VOID_RETURN;
} else {
aConnection->theReleaseOnClose = false;
=== modified file 'storage/ndb/src/ndbapi/Ndbinit.cpp'
--- a/storage/ndb/src/ndbapi/Ndbinit.cpp 2011-10-17 12:43:31 +0000
+++ b/storage/ndb/src/ndbapi/Ndbinit.cpp 2012-06-07 14:49:35 +0000
@@ -61,6 +61,7 @@ void Ndb::setup(Ndb_cluster_connection *
theMinNoOfEventsToWakeUp= 0;
theTransactionList= NULL;
theConnectionArray= NULL;
+ theConnectionArrayLast= NULL;
the_last_check_time= 0;
theFirstTransId= 0;
theRestartGCI= 0;
@@ -83,13 +84,15 @@ void Ndb::setup(Ndb_cluster_connection *
theError.code = 0;
theConnectionArray = new NdbConnection * [MAX_NDB_NODES];
+ theConnectionArrayLast = new NdbConnection * [MAX_NDB_NODES];
theCommitAckSignal = NULL;
theCachedMinDbNodeVersion = 0;
int i;
for (i = 0; i < MAX_NDB_NODES ; i++) {
theConnectionArray[i] = NULL;
- }//forg
+ theConnectionArrayLast[i] = NULL;
+ }//for
m_sys_tab_0 = NULL;
theImpl->m_dbname.assign(aDataBase);
@@ -158,6 +161,7 @@ Ndb::~Ndb()
releaseTransactionArrays();
delete []theConnectionArray;
+ delete []theConnectionArrayLast;
if(theCommitAckSignal != NULL){
delete theCommitAckSignal;
theCommitAckSignal = NULL;
=== modified file 'storage/ndb/src/ndbapi/Ndblist.cpp'
--- a/storage/ndb/src/ndbapi/Ndblist.cpp 2011-06-30 15:59:25 +0000
+++ b/storage/ndb/src/ndbapi/Ndblist.cpp 2012-06-07 14:49:35 +0000
@@ -44,6 +44,7 @@ Ndb::checkFailedNode()
*/
NdbTransaction * tNdbCon = theConnectionArray[node_id];
theConnectionArray[node_id] = NULL;
+ theConnectionArrayLast[node_id] = NULL;
while (tNdbCon != NULL) {
NdbTransaction* tempNdbCon = tNdbCon;
tNdbCon = tNdbCon->next();
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (mauritz.sundell:4935 to 4937) | Mauritz Sundell | 7 Jun |