4577 jonas oreland 2011-10-07
ndb - fix result files and rate-limit for threadblocks
modified:
mysql-test/suite/ndb/r/ndbinfo.result
mysql-test/suite/ndb/r/ndbinfo_dump.result
storage/ndb/src/kernel/blocks/thrman.cpp
4576 jonas oreland 2011-10-07
ndb - add --loops and --delay to ndbinfo_select_all (to get rudementary vmstat similarity)
modified:
storage/ndb/tools/ndbinfo_select_all.cpp
4575 jonas oreland 2011-10-07
ndb - add thread statistics
added:
storage/ndb/include/portlib/NdbGetRUsage.h
storage/ndb/src/common/portlib/NdbGetRUsage.cpp
storage/ndb/src/kernel/blocks/thrman.cpp
storage/ndb/src/kernel/blocks/thrman.hpp
modified:
storage/ndb/include/kernel/BlockNumbers.h
storage/ndb/src/common/debugger/BlockNames.cpp
storage/ndb/src/common/portlib/CMakeLists.txt
storage/ndb/src/common/portlib/Makefile.am
storage/ndb/src/kernel/SimBlockList.cpp
storage/ndb/src/kernel/blocks/CMakeLists.txt
storage/ndb/src/kernel/blocks/LocalProxy.cpp
storage/ndb/src/kernel/blocks/LocalProxy.hpp
storage/ndb/src/kernel/blocks/Makefile.am
storage/ndb/src/kernel/blocks/PgmanProxy.cpp
storage/ndb/src/kernel/blocks/PgmanProxy.hpp
storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp
storage/ndb/src/kernel/blocks/dblqh/DblqhProxy.cpp
storage/ndb/src/kernel/blocks/dbspj/DbspjProxy.hpp
storage/ndb/src/kernel/blocks/dbtc/DbtcProxy.hpp
storage/ndb/src/kernel/vm/Ndbinfo.hpp
storage/ndb/src/kernel/vm/NdbinfoTables.cpp
storage/ndb/src/kernel/vm/SimulatedBlock.hpp
storage/ndb/src/kernel/vm/dummy_nonmt.cpp
storage/ndb/src/kernel/vm/mt.cpp
storage/ndb/src/kernel/vm/mt.hpp
storage/ndb/src/kernel/vm/mt_thr_config.cpp
storage/ndb/src/kernel/vm/mt_thr_config.hpp
=== modified file 'mysql-test/suite/ndb/r/ndbinfo.result'
--- a/mysql-test/suite/ndb/r/ndbinfo.result 2011-05-23 13:45:57 +0000
+++ b/mysql-test/suite/ndb/r/ndbinfo.result 2011-10-07 09:28:24 +0000
@@ -37,9 +37,11 @@ table_id table_name comment
8 counters monotonic counters
9 nodes node status
10 diskpagebuffer disk page buffer info
+11 threadblocks which blocks are run in which threads
+12 threadstat threadstat
SELECT COUNT(*) FROM ndb$tables;
COUNT(*)
-11
+13
SELECT * FROM ndb$tables WHERE table_id = 2;
table_id table_name comment
2 test for testing
@@ -50,11 +52,13 @@ table_id table_name comment
8 counters monotonic counters
9 nodes node status
10 diskpagebuffer disk page buffer info
+11 threadblocks which blocks are run in which threads
+12 threadstat threadstat
SELECT * FROM ndb$tables WHERE table_name = 'LOGDESTINATION';
table_id table_name comment
SELECT COUNT(*) FROM ndb$tables t1, ndb$tables t2 WHERE t1.table_id = t1.table_id;
COUNT(*)
-121
+169
SELECT table_id, table_name, comment from ndb$tables
WHERE table_id > 2 AND table_id <= 5 ORDER BY table_id;
@@ -77,6 +81,8 @@ table_id table_name
7 resources
0 tables
2 test
+11 threadblocks
+12 threadstat
4 transporters
SELECT table_id, column_id, column_name FROM ndb$columns LIMIT 7;
@@ -124,6 +130,8 @@ table_id
8
9
10
+11
+12
TRUNCATE ndb$tables;
ERROR HY000: Table 'ndb$tables' is read only
=== modified file 'mysql-test/suite/ndb/r/ndbinfo_dump.result'
--- a/mysql-test/suite/ndb/r/ndbinfo_dump.result 2011-02-23 22:30:50 +0000
+++ b/mysql-test/suite/ndb/r/ndbinfo_dump.result 2011-10-07 09:28:24 +0000
@@ -1,7 +1,7 @@
USE ndbinfo;
select count(*) from blocks;
count(*)
-21
+22
select count(*) from blocks;
count(*)
-21
+22
=== modified file 'storage/ndb/src/kernel/blocks/thrman.cpp'
--- a/storage/ndb/src/kernel/blocks/thrman.cpp 2011-10-07 08:07:21 +0000
+++ b/storage/ndb/src/kernel/blocks/thrman.cpp 2011-10-07 09:28:24 +0000
@@ -52,7 +52,8 @@ Thrman::execDBINFO_SCANREQ(Signal* signa
Uint32 arr[NO_OF_BLOCKS];
Uint32 len = mt_get_blocklist(this, arr, NDB_ARRAY_SIZE(arr));
Uint32 pos = cursor->data[0];
- for (; pos < len; pos++) {
+ for (; ; )
+ {
Ndbinfo::Row row(signal, req);
row.write_uint32(getOwnNodeId());
row.write_uint32(getThreadId()); // thr_no
@@ -60,7 +61,13 @@ Thrman::execDBINFO_SCANREQ(Signal* signa
row.write_uint32(blockToInstance(arr[pos])); // block_instance
ndbinfo_send_row(signal, req, row, rl);
- if (rl.need_break(req))
+ pos++;
+ if (pos == len)
+ {
+ jam();
+ break;
+ }
+ else if (rl.need_break(req))
{
jam();
ndbinfo_send_scan_break(signal, req, rl, pos);
=== modified file 'storage/ndb/tools/ndbinfo_select_all.cpp'
--- a/storage/ndb/tools/ndbinfo_select_all.cpp 2011-10-05 11:21:23 +0000
+++ b/storage/ndb/tools/ndbinfo_select_all.cpp 2011-10-07 09:17:10 +0000
@@ -21,18 +21,25 @@
#include <NdbApi.hpp>
#include <NdbOut.hpp>
-#include <NDBT.hpp>
#include "../src/ndbapi/NdbInfo.hpp"
+#include <NdbSleep.h>
+static int loops = 1;
+static int delay = 5;
const char *load_default_groups[]= { "mysql_cluster",0 };
static struct my_option my_long_options[] =
{
NDB_STD_OPTS("ndbinfo_select_all"),
+ { "loops", 'l', "Run same select several times",
+ (uchar**) &loops, (uchar**) &loops, 0,
+ GET_INT, REQUIRED_ARG, loops, 0, 0, 0, 0, 0 },
+ { "delay", 256, "Delay between loops (in seconds)",
+ (uchar**) &delay, (uchar**) &delay, 0,
+ GET_INT, REQUIRED_ARG, delay, 0, 0, 0, 0, 0 },
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
-
static void short_usage_sub(void)
{
ndb_short_usage_sub(NULL);
@@ -85,90 +92,97 @@ main(int argc, char** argv)
const Uint32 batchsizerows = 32;
- for (int ii = 0; argv[ii] != 0; ii++)
+ for (int ll = 0; loops == 0 || ll < loops; ll++)
{
- ndbout << "== " << argv[ii] << " ==" << endl;
-
- const NdbInfo::Table * pTab = 0;
- int res = info.openTable(argv[ii], &pTab);
- if (res != 0)
+ for (int ii = 0; argv[ii] != 0; ii++)
{
- ndbout << "Failed to open: " << argv[ii] << ", res: " << res << endl;
- continue;
- }
+ ndbout << "== " << argv[ii] << " ==" << endl;
- unsigned cols = pTab->columns();
- for (unsigned i = 0; i<cols; i++)
- {
- const NdbInfo::Column * pCol = pTab->getColumn(i);
- ndbout << pCol->m_name.c_str() << "\t";
- }
- ndbout << endl;
+ const NdbInfo::Table * pTab = 0;
+ int res = info.openTable(argv[ii], &pTab);
+ if (res != 0)
+ {
+ ndbout << "Failed to open: " << argv[ii] << ", res: " << res << endl;
+ continue;
+ }
- NdbInfoScanOperation * pScan = 0;
- res= info.createScanOperation(pTab, &pScan, batchsizerows);
- if (res != 0)
- {
- ndbout << "Failed to createScan: " << argv[ii] << ", res: " << res<< endl;
- info.closeTable(pTab);
- continue;
- }
+ unsigned cols = pTab->columns();
+ for (unsigned i = 0; i<cols; i++)
+ {
+ const NdbInfo::Column * pCol = pTab->getColumn(i);
+ ndbout << pCol->m_name.c_str() << "\t";
+ }
+ ndbout << endl;
- if (pScan->readTuples() != 0)
- {
- ndbout << "scanOp->readTuples failed" << endl;
- return 1;
- }
+ NdbInfoScanOperation * pScan = 0;
+ res= info.createScanOperation(pTab, &pScan, batchsizerows);
+ if (res != 0)
+ {
+ ndbout << "Failed to createScan: " << argv[ii] << ", res: " << res<< endl;
+ info.closeTable(pTab);
+ continue;
+ }
- Vector<const NdbInfoRecAttr*> recAttrs;
- for (unsigned i = 0; i<cols; i++)
- {
- const NdbInfoRecAttr* pRec = pScan->getValue(i);
- if (pRec == 0)
+ if (pScan->readTuples() != 0)
{
- ndbout << "Failed to getValue(" << i << ")" << endl;
+ ndbout << "scanOp->readTuples failed" << endl;
return 1;
}
- recAttrs.push_back(pRec);
- }
- if(pScan->execute() != 0)
- {
- ndbout << "scanOp->execute failed" << endl;
- return 1;
- }
-
- while(pScan->nextResult() == 1)
- {
+ Vector<const NdbInfoRecAttr*> recAttrs;
for (unsigned i = 0; i<cols; i++)
{
- if (recAttrs[i]->isNULL())
+ const NdbInfoRecAttr* pRec = pScan->getValue(i);
+ if (pRec == 0)
{
- ndbout << "NULL";
+ ndbout << "Failed to getValue(" << i << ")" << endl;
+ return 1;
}
- else
+ recAttrs.push_back(pRec);
+ }
+
+ if(pScan->execute() != 0)
+ {
+ ndbout << "scanOp->execute failed" << endl;
+ return 1;
+ }
+
+ while(pScan->nextResult() == 1)
+ {
+ for (unsigned i = 0; i<cols; i++)
{
- switch(pTab->getColumn(i)->m_type){
- case NdbInfo::Column::String:
- ndbout << recAttrs[i]->c_str();
- break;
- case NdbInfo::Column::Number:
- ndbout << recAttrs[i]->u_32_value();
- break;
- case NdbInfo::Column::Number64:
- ndbout << recAttrs[i]->u_64_value();
- break;
+ if (recAttrs[i]->isNULL())
+ {
+ ndbout << "NULL";
+ }
+ else
+ {
+ switch(pTab->getColumn(i)->m_type){
+ case NdbInfo::Column::String:
+ ndbout << recAttrs[i]->c_str();
+ break;
+ case NdbInfo::Column::Number:
+ ndbout << recAttrs[i]->u_32_value();
+ break;
+ case NdbInfo::Column::Number64:
+ ndbout << recAttrs[i]->u_64_value();
+ break;
+ }
}
+ ndbout << "\t";
}
- ndbout << "\t";
+ ndbout << endl;
}
- ndbout << endl;
+
+ info.releaseScanOperation(pScan);
+ info.closeTable(pTab);
}
- info.releaseScanOperation(pScan);
- info.closeTable(pTab);
+ if ((loops == 0 || ll + 1 != loops) && delay > 0)
+ {
+ NdbSleep_SecSleep(delay);
+ }
}
-
return 0;
}
No bundle (reason: useless for push emails).
| Thread |
|---|
| • bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4575 to 4577) | jonas oreland | 7 Oct |