4478 Jonas Oreland 2011-08-26
ndb - add handy methods to SpareBitmask (equal, overlaps, str, getBitNo)
modified:
storage/ndb/include/util/SparseBitmask.hpp
4477 Jonas Oreland 2011-08-25
ndb - remove some obfsuscation in Configuration.cpp wrt lock-to-cpu handling
modified:
storage/ndb/src/kernel/vm/Configuration.cpp
storage/ndb/src/kernel/vm/Configuration.hpp
4476 Jonas Oreland 2011-08-25
ndb - set ndb_index_stat_enable=TRUE in >= 7.2.0
modified:
sql/ha_ndbcluster.cc
=== modified file 'storage/ndb/include/util/SparseBitmask.hpp'
--- a/storage/ndb/include/util/SparseBitmask.hpp 2010-08-28 09:37:09 +0000
+++ b/storage/ndb/include/util/SparseBitmask.hpp 2011-08-26 09:20:08 +0000
@@ -20,6 +20,7 @@
#include <ndb_global.h>
#include <util/Vector.hpp>
+#include <util/BaseString.hpp>
class SparseBitmask {
unsigned m_max_size;
@@ -102,6 +103,11 @@ public:
bool isclear() const { return count() == 0; }
+ unsigned getBitNo(unsigned n) const {
+ assert(n < m_vec.size());
+ return m_vec[n];
+ }
+
void print(void) const {
for (unsigned i = 0; i < m_vec.size(); i++)
{
@@ -110,6 +116,38 @@ public:
}
}
+ bool equal(const SparseBitmask& obj) const {
+ if (obj.count() != count())
+ return false;
+
+ for (unsigned i = 0; i<count(); i++)
+ if (!obj.get(m_vec[i]))
+ return false;
+
+ return true;
+ }
+
+ bool overlaps(const SparseBitmask& obj) const {
+ for (unsigned i = 0; i<count(); i++)
+ if (!obj.get(m_vec[i]))
+ return true;
+
+ for (unsigned i = 0; i<obj.count(); i++)
+ if (!get(obj.getBitNo(i)))
+ return true;
+ return false;
+ }
+
+ BaseString str() const {
+ BaseString tmp;
+ const char* sep="";
+ for (unsigned i = 0; i<m_vec.size(); i++)
+ {
+ tmp.appfmt("%s%u", sep, m_vec[i]);
+ sep=",";
+ }
+ return tmp;
+ }
};
#endif
=== modified file 'storage/ndb/src/kernel/vm/Configuration.cpp'
--- a/storage/ndb/src/kernel/vm/Configuration.cpp 2011-07-04 13:37:56 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.cpp 2011-08-25 09:40:27 +0000
@@ -930,13 +930,16 @@ Configuration::setAllLockCPU(bool exec_t
Uint32 i;
for (i = 0; i < threadInfo.size(); i++)
{
- if (threadInfo[i].type != NotInUse)
+ if (threadInfo[i].type == NotInUse)
+ continue;
+
+ bool run =
+ (exec_thread && threadInfo[i].type == MainThread) ||
+ (!exec_thread && threadInfo[i].type != MainThread);
+
+ if (run)
{
- if (setLockCPU(threadInfo[i].pThread,
- threadInfo[i].type,
- exec_thread,
- FALSE))
- return;
+ setLockCPU(threadInfo[i].pThread, threadInfo[i].type);
}
}
}
@@ -966,11 +969,8 @@ Configuration::setRealtimeScheduler(NdbT
int
Configuration::setLockCPU(NdbThread * pThread,
- enum ThreadTypes type,
- bool exec_thread,
- bool init)
+ enum ThreadTypes type)
{
- (void)init;
Uint32 cpu_id;
int tid = NdbThread_GetTid(pThread);
if (tid == -1)
@@ -981,9 +981,6 @@ Configuration::setLockCPU(NdbThread * pT
We only set new lock CPU characteristics for the threads for which
it has changed
*/
- if ((exec_thread && type != MainThread) ||
- (!exec_thread && type == MainThread))
- return 0;
if (type == MainThread)
cpu_id = executeLockCPU();
else
@@ -1029,7 +1026,7 @@ Configuration::addThread(struct NdbThrea
* main threads are set in ThreadConfig::ipControlLoop
* as it's handled differently with mt
*/
- setLockCPU(pThread, type, (type == MainThread), TRUE);
+ setLockCPU(pThread, type);
}
return i;
}
=== modified file 'storage/ndb/src/kernel/vm/Configuration.hpp'
--- a/storage/ndb/src/kernel/vm/Configuration.hpp 2011-07-04 13:37:56 +0000
+++ b/storage/ndb/src/kernel/vm/Configuration.hpp 2011-08-25 09:40:27 +0000
@@ -86,10 +86,7 @@ public:
void setAllRealtimeScheduler();
void setAllLockCPU(bool exec_thread);
- int setLockCPU(NdbThread*,
- enum ThreadTypes type,
- bool exec_thread,
- bool init);
+ int setLockCPU(NdbThread*, enum ThreadTypes type);
int setRealtimeScheduler(NdbThread*,
enum ThreadTypes type,
bool real_time,
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4476 to 4478) | Jonas Oreland | 26 Aug |