From: Pekka Nousiainen Date: October 11 2011 3:35pm Subject: bzr push into mysql-5.1-telco-7.0 branch (pekka.nousiainen:4589 to 4590) List-Archive: http://lists.mysql.com/commits/141388 Message-Id: <20111011153513.3B4E85781A@cuda.localdomain> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit 4590 Pekka Nousiainen 2011-10-11 [merge] merge 7.0 to wl4124 added: mysql-test/suite/ndb_big/bug37983-master.opt mysql-test/suite/ndb_big/disabled.def modified: mysql-test/mysql-test-run.pl mysql-test/suite/ndb/r/ndbinfo.result storage/ndb/include/ndb_constants.h storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp storage/ndb/src/kernel/vm/Ndbinfo.hpp storage/ndb/src/kernel/vm/NdbinfoTables.cpp 4589 Pekka Nousiainen 2011-10-08 wl#4124 h05_update.diff tweak options modified: mysql-test/suite/ndb/r/ndb_basic.result mysql-test/suite/ndb/r/ndb_index_stat.result sql/ha_ndb_index_stat.cc === modified file 'mysql-test/mysql-test-run.pl' --- a/mysql-test/mysql-test-run.pl 2011-07-06 09:20:17 +0000 +++ b/mysql-test/mysql-test-run.pl 2011-10-10 14:28:05 +0000 @@ -1502,6 +1502,10 @@ sub command_line_setup { mtr_report("Running valgrind with options \"", join(" ", @valgrind_args), "\""); + + # Turn off check testcases to save time + mtr_report("Turning off --check-testcases to save time when valgrinding"); + $opt_check_testcases = 0; } mtr_report("Checking supported features..."); === modified file 'mysql-test/suite/ndb/r/ndbinfo.result' --- a/mysql-test/suite/ndb/r/ndbinfo.result 2011-10-07 14:34:14 +0000 +++ b/mysql-test/suite/ndb/r/ndbinfo.result 2011-10-11 08:11:15 +0000 @@ -40,9 +40,10 @@ table_id table_name comment 11 threadblocks which blocks are run in which threads 12 threadstat threadstat 13 transactions transactions +14 operations operations SELECT COUNT(*) FROM ndb$tables; COUNT(*) -14 +15 SELECT * FROM ndb$tables WHERE table_id = 2; table_id table_name comment 2 test for testing @@ -56,11 +57,12 @@ table_id table_name comment 11 threadblocks which blocks are run in which threads 12 threadstat threadstat 13 transactions transactions +14 operations operations 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(*) -196 +225 SELECT table_id, table_name, comment from ndb$tables WHERE table_id > 2 AND table_id <= 5 ORDER BY table_id; @@ -79,6 +81,7 @@ table_id table_name 6 logbuffers 5 logspaces 9 nodes +14 operations 3 pools 7 resources 0 tables @@ -136,6 +139,7 @@ table_id 11 12 13 +14 TRUNCATE ndb$tables; ERROR HY000: Table 'ndb$tables' is read only === added file 'mysql-test/suite/ndb_big/bug37983-master.opt' --- a/mysql-test/suite/ndb_big/bug37983-master.opt 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_big/bug37983-master.opt 2011-10-10 07:40:12 +0000 @@ -0,0 +1 @@ +--testcase-timeout=30 === added file 'mysql-test/suite/ndb_big/disabled.def' --- a/mysql-test/suite/ndb_big/disabled.def 1970-01-01 00:00:00 +0000 +++ b/mysql-test/suite/ndb_big/disabled.def 2011-10-10 07:40:12 +0000 @@ -0,0 +1 @@ +smoke : not ready for automated testing yet === modified file 'storage/ndb/include/ndb_constants.h' --- a/storage/ndb/include/ndb_constants.h 2011-08-11 17:11:30 +0000 +++ b/storage/ndb/include/ndb_constants.h 2011-10-11 08:11:15 +0000 @@ -124,4 +124,22 @@ #define NDB_INDEX_STAT_PREFIX "ndb_index_stat" +/** + * Defines for NDB$INFO.OPERATIONS + */ +#define NDB_INFO_OP_UNKNOWN 0 +#define NDB_INFO_OP_READ 1 +#define NDB_INFO_OP_READ_SH 2 +#define NDB_INFO_OP_READ_EX 3 +#define NDB_INFO_OP_INSERT 4 +#define NDB_INFO_OP_UPDATE 5 +#define NDB_INFO_OP_DELETE 6 +#define NDB_INFO_OP_WRITE 7 +#define NDB_INFO_OP_UNLOCK 8 +#define NDB_INFO_OP_REFRESH 9 +#define NDB_INFO_OP_SCAN_UNKNOWN (256 + 0) +#define NDB_INFO_OP_SCAN (256 + 1) +#define NDB_INFO_OP_SCAN_SH (256 + 2) +#define NDB_INFO_OP_SCAN_EX (256 + 3) + #endif === modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp' --- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp 2011-06-30 15:59:25 +0000 +++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp 2011-10-11 08:11:15 +0000 @@ -2687,6 +2687,10 @@ private: bool validate_filter(Signal*); bool match_and_print(Signal*, Ptr); + void ndbinfo_write_op(Signal* signal, + DbinfoScanReq * req, + Ndbinfo::Ratelimit * rl, + TcConnectionrecPtr tcPtr); void define_backup(Signal*); void execDEFINE_BACKUP_REF(Signal*); === modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp' --- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2011-09-26 07:58:35 +0000 +++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp 2011-10-11 08:11:15 +0000 @@ -23393,6 +23393,41 @@ void Dblqh::execDBINFO_SCANREQ(Signal *s } break; } + case Ndbinfo::OPERATIONS_TABLEID:{ + Uint32 bucket = cursor->data[0]; + + while (true) + { + if (rl.need_break(req)) + { + jam(); + ndbinfo_send_scan_break(signal, req, rl, bucket); + return; + } + + for (; bucket < NDB_ARRAY_SIZE(ctransidHash); bucket++) + { + if (ctransidHash[bucket] != RNIL) + break; + } + + if (bucket == NDB_ARRAY_SIZE(ctransidHash)) + { + break; + } + + TcConnectionrecPtr tcPtr; + tcPtr.i = ctransidHash[bucket]; + while (tcPtr.i != RNIL) + { + jam(); + ptrCheckGuard(tcPtr, ctcConnectrecFileSize, tcConnectionrec); + ndbinfo_write_op(signal, &req, &rl, tcPtr); + tcPtr.i = tcPtr.p->nextHashRec; + } + bucket++; + } + } default: break; @@ -23401,6 +23436,85 @@ void Dblqh::execDBINFO_SCANREQ(Signal *s ndbinfo_send_scan_conf(signal, req, rl); } +void +Dblqh::ndbinfo_write_op(Signal* signal, + DbinfoScanReq * req, + Ndbinfo::Ratelimit * rl, + TcConnectionrecPtr tcPtr) +{ + Ndbinfo::Row row(signal, *req); + row.write_uint32(getOwnNodeId()); + row.write_uint32(instance()); // block instance + row.write_uint32(tcPtr.i); // objid + row.write_uint32(tcPtr.p->tcBlockref); // tcref + row.write_uint32(tcPtr.p->applRef); // apiref + + char transid[64]; + BaseString::snprintf(transid, sizeof(transid), + "%.8x.%.8x", + tcPtr.p->transid[0], + tcPtr.p->transid[1]); + row.write_string(transid); + row.write_uint32(tcPtr.p->tableref); + row.write_uint32(tcPtr.p->fragmentid); + + if (tcPtr.p->tcScanRec != RNIL) + { + ScanRecordPtr sp; + sp.i = tcPtr.p->tcScanRec; + c_scanRecordPool.getPtr(sp); + + Uint32 op = NDB_INFO_OP_SCAN_UNKNOWN; + if (sp.p->scanLockMode) + op = NDB_INFO_OP_SCAN_EX; + else if (sp.p->scanLockHold) + op = NDB_INFO_OP_SCAN_SH; + else + op = NDB_INFO_OP_SCAN; + + row.write_uint32(op); + row.write_uint32(sp.p->scanState); + row.write_uint32(0); + } + else + { + Uint32 op = NDB_INFO_OP_UNKNOWN; + switch(tcPtr.p->operation){ + case ZREAD: + if (tcPtr.p->lockType) + op = NDB_INFO_OP_READ_EX; + else if (!tcPtr.p->dirtyOp) + op = NDB_INFO_OP_READ_SH; + else + op = NDB_INFO_OP_READ; + break; + case ZINSERT: + op = NDB_INFO_OP_INSERT; + break; + case ZUPDATE: + op = NDB_INFO_OP_UPDATE; + break; + case ZDELETE: + op = NDB_INFO_OP_DELETE; + break; + case ZWRITE: + op = NDB_INFO_OP_WRITE; + break; + case ZUNLOCK: + op = NDB_INFO_OP_UNLOCK; + break; + case ZREFRESH: + op = NDB_INFO_OP_REFRESH; + break; + } + row.write_uint32(op); + row.write_uint32(tcPtr.p->transactionState); + row.write_uint32(0); + } + + ndbinfo_send_row(signal, *req, row, *rl); +} + /* **************************************************************** */ /* ---------------------------------------------------------------- */ === modified file 'storage/ndb/src/kernel/vm/Ndbinfo.hpp' --- a/storage/ndb/src/kernel/vm/Ndbinfo.hpp 2011-10-07 14:34:14 +0000 +++ b/storage/ndb/src/kernel/vm/Ndbinfo.hpp 2011-10-11 08:11:15 +0000 @@ -49,7 +49,8 @@ public: DISKPAGEBUFFER_TABLEID = 10, THREADBLOCKS_TABLEID = 11, THREADSTAT_TABLEID = 12, - TRANSACTIONS_TABLEID = 13 + TRANSACTIONS_TABLEID = 13, + OPERATIONS_TABLEID = 14 }; struct Table { === modified file 'storage/ndb/src/kernel/vm/NdbinfoTables.cpp' --- a/storage/ndb/src/kernel/vm/NdbinfoTables.cpp 2011-10-07 14:34:14 +0000 +++ b/storage/ndb/src/kernel/vm/NdbinfoTables.cpp 2011-10-11 08:11:15 +0000 @@ -220,6 +220,23 @@ DECLARE_NDBINFO_TABLE(TRANSACTIONS, 10) } }; +DECLARE_NDBINFO_TABLE(OPERATIONS, 11) = +{ { "operations", 11, 0, "operations" }, + { + {"node_id", Ndbinfo::Number, ""}, + {"block_instance", Ndbinfo::Number, ""}, + {"objid", Ndbinfo::Number, ""}, + {"tcref", Ndbinfo::Number, ""}, + {"apiref", Ndbinfo::Number, ""}, + {"transid", Ndbinfo::String, ""}, + {"tableid", Ndbinfo::Number, ""}, + {"fragmentid", Ndbinfo::Number, ""}, + {"op", Ndbinfo::Number, ""}, + {"state", Ndbinfo::Number, ""}, + {"flags", Ndbinfo::Number, ""} + } +}; + #define DBINFOTBL(x) { Ndbinfo::x##_TABLEID, (Ndbinfo::Table*)&ndbinfo_##x } static @@ -242,7 +259,8 @@ struct ndbinfo_table_list_entry { DBINFOTBL(DISKPAGEBUFFER), DBINFOTBL(THREADBLOCKS), DBINFOTBL(THREADSTAT), - DBINFOTBL(TRANSACTIONS) + DBINFOTBL(TRANSACTIONS), + DBINFOTBL(OPERATIONS) }; static int no_ndbinfo_tables = No bundle (reason: useless for push emails).