List:Commits« Previous MessageNext Message »
From:jonas oreland Date:October 7 2011 2:35pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4582 to 4583)
View as plain text  
 4583 jonas oreland	2011-10-07
      ndb - add ndbinfo.transactions showing ongoing transactions
        (patch also remove unused states in TC)
        TODO: - SQL
              - verify all outstanding calculations
              - maybe use coord-trans type transaction id (not to confuse things too much)
              - expose transaction id per mysql-connection, maybe using information_schema
              - ndbinfo.operations (in LQH)

    modified:
      mysql-test/suite/ndb/r/ndbinfo.result
      storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp
      storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp
      storage/ndb/src/kernel/vm/Ndbinfo.hpp
      storage/ndb/src/kernel/vm/NdbinfoTables.cpp
 4582 Mauritz Sundell	2011-10-07
      ndb - New test case for bigger tables.
      
      Demonstrating effect of making static arrays for
      schema transactions dynamic.
      Handles more blob-columns in wide table.

    modified:
      mysql-test/suite/ndb/r/ndb_alter_table.result
      mysql-test/suite/ndb/t/ndb_alter_table.test
=== modified file 'mysql-test/suite/ndb/r/ndbinfo.result'
--- a/mysql-test/suite/ndb/r/ndbinfo.result	2011-10-07 09:28:24 +0000
+++ b/mysql-test/suite/ndb/r/ndbinfo.result	2011-10-07 14:34:14 +0000
@@ -39,9 +39,10 @@ table_id	table_name	comment
 10	diskpagebuffer	disk page buffer info
 11	threadblocks	which blocks are run in which threads
 12	threadstat	threadstat
+13	transactions	transactions
 SELECT COUNT(*) FROM ndb$tables;
 COUNT(*)
-13
+14
 SELECT * FROM ndb$tables WHERE table_id = 2;
 table_id	table_name	comment
 2	test	for testing
@@ -54,11 +55,12 @@ table_id	table_name	comment
 10	diskpagebuffer	disk page buffer info
 11	threadblocks	which blocks are run in which threads
 12	threadstat	threadstat
+13	transactions	transactions
 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(*)
-169
+196
 
 SELECT table_id, table_name, comment from ndb$tables
   WHERE table_id > 2 AND table_id <= 5 ORDER BY table_id;
@@ -83,6 +85,7 @@ table_id	table_name
 2	test
 11	threadblocks
 12	threadstat
+13	transactions
 4	transporters
 
 SELECT table_id, column_id, column_name FROM ndb$columns LIMIT 7;
@@ -132,6 +135,7 @@ table_id
 10
 11
 12
+13
 
 TRUNCATE ndb$tables;
 ERROR HY000: Table 'ndb$tables' is read only

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2011-07-04 13:37:56 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/Dbtc.hpp	2011-10-07 14:34:14 +0000
@@ -157,9 +157,6 @@ public:
     CS_DISCONNECTED = 1,
     CS_STARTED = 2,
     CS_RECEIVING = 3,
-    CS_PREPARED = 4,
-    CS_START_PREPARING = 5,
-    CS_REC_PREPARING = 6,
     CS_RESTART = 7,
     CS_ABORTING = 8,
     CS_COMPLETING = 9,
@@ -1989,6 +1986,10 @@ private:
 
   bool validate_filter(Signal*);
   bool match_and_print(Signal*, ApiConnectRecordPtr);
+  void ndbinfo_write_trans(Signal* signal,
+                           DbinfoScanReq * req,
+                           Ndbinfo::Ratelimit * rl,
+                           ApiConnectRecordPtr transPtr);
 
 #ifdef ERROR_INSERT
   bool testFragmentDrop(Signal* signal);

=== modified file 'storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-09-15 06:02:57 +0000
+++ b/storage/ndb/src/kernel/blocks/dbtc/DbtcMain.cpp	2011-10-07 14:34:14 +0000
@@ -106,9 +106,6 @@ operator<<(NdbOut& out, Dbtc::Connection
   case Dbtc::CS_DISCONNECTED: out << "CS_DISCONNECTED"; break;
   case Dbtc::CS_STARTED: out << "CS_STARTED"; break;
   case Dbtc::CS_RECEIVING: out << "CS_RECEIVING"; break;
-  case Dbtc::CS_PREPARED: out << "CS_PREPARED"; break;
-  case Dbtc::CS_START_PREPARING: out << "CS_START_PREPARING"; break;
-  case Dbtc::CS_REC_PREPARING: out << "CS_REC_PREPARING"; break;
   case Dbtc::CS_RESTART: out << "CS_RESTART"; break;
   case Dbtc::CS_ABORTING: out << "CS_ABORTING"; break;
   case Dbtc::CS_COMPLETING: out << "CS_COMPLETING"; break;
@@ -1055,17 +1052,6 @@ Dbtc::handleFailedApiNode(Signal* signal
         abort010Lab(signal);
         TloopCount = 256;
         break;
-      case CS_PREPARED:
-        jam();
-      case CS_REC_PREPARING:
-        jam();
-      case CS_START_PREPARING:
-        jam();
-        /*********************************************************************/
-        // Not implemented yet.
-        /*********************************************************************/
-        systemErrorLab(signal, __LINE__);
-        break;
       case CS_RESTART:
         jam();
       case CS_COMPLETING:
@@ -6582,16 +6568,6 @@ void Dbtc::execTC_COMMITREQ(Signal* sign
       /***********************************************************************/
       errorCode = ZSCANINPROGRESS;
       break;
-    case CS_PREPARED:
-      jam();
-      return;
-    case CS_START_PREPARING:
-      jam();
-      return;
-    case CS_REC_PREPARING:
-      jam();
-      return;
-      break;
     default:
       warningHandlerLab(signal, __LINE__);
       return;
@@ -6709,12 +6685,6 @@ void Dbtc::execTCROLLBACKREQ(Signal* sig
     jam();
     apiConnectptr.p->returnsignal = RS_TCROLLBACKCONF;
     break;
-  case CS_START_PREPARING:
-    jam();
-  case CS_PREPARED:
-    jam();
-  case CS_REC_PREPARING:
-    jam();
   default:
     goto TC_ROLL_system_error;
     break;
@@ -7739,12 +7709,6 @@ void Dbtc::timeOutFoundLab(Signal* signa
     jam();
   case CS_FAIL_COMMITTED:
     jam();
-  case CS_REC_PREPARING:
-    jam();
-  case CS_START_PREPARING:
-    jam();
-  case CS_PREPARED:
-    jam();
   case CS_RESTART:
     jam();
   case CS_FAIL_ABORTED:
@@ -13324,14 +13288,125 @@ void Dbtc::execDBINFO_SCANREQ(Signal *si
 
     break;
   }
+  case Ndbinfo::TRANSACTIONS_TABLEID:{
+    ApiConnectRecordPtr ptr;
+    ptr.i = cursor->data[0];
+    const Uint32 maxloop = 256;
+    for (Uint32 i = 0; i < maxloop; i++)
+    {
+      ptrCheckGuard(ptr, capiConnectFilesize, apiConnectRecord);
+      ndbinfo_write_trans(signal, &req, &rl, ptr);
 
+      ptr.i ++;
+      if (ptr.i == capiConnectFilesize)
+      {
+        goto done;
+      }
+      else if (rl.need_break(req))
+      {
+        break;
+      }
+    }
+    ndbinfo_send_scan_break(signal, req, rl, ptr.i);
+    return;
+  }
   default:
     break;
   }
 
+done:
   ndbinfo_send_scan_conf(signal, req, rl);
 }
 
+void
+Dbtc::ndbinfo_write_trans(Signal* signal,
+                          DbinfoScanReq * req,
+                          Ndbinfo::Ratelimit * rl,
+                          ApiConnectRecordPtr transPtr)
+{
+  Uint32 conState = transPtr.p->apiConnectstate;
+
+  if (conState == CS_ABORTING && transPtr.p->abortState == AS_IDLE)
+  {
+    /**
+     * These is for all practical purposes equal
+     */
+    conState = CS_CONNECTED;
+  }
+
+  if (conState == CS_CONNECTED ||
+      conState == CS_DISCONNECTED ||
+      conState == CS_RESTART)
+  {
+    return;
+  }
+
+  char transid[64];
+  BaseString::snprintf(transid, sizeof(transid),
+                       "%.8x.%.8x",
+                       transPtr.p->transid[0],
+                       transPtr.p->transid[1]);
+
+  Ndbinfo::Row row(signal, *req);
+  row.write_uint32(getOwnNodeId());
+  row.write_uint32(instance());   // block instance
+  row.write_uint32(transPtr.i);
+  row.write_uint32(transPtr.p->ndbapiBlockref);
+  row.write_string(transid);
+  row.write_uint32(conState);
+  row.write_uint32(transPtr.p->m_flags);
+  row.write_uint32(transPtr.p->lqhkeyreqrec);
+  Uint32 outstanding = 0;
+  switch((ConnectionState)conState) {
+  case CS_CONNECTED:
+  case CS_DISCONNECTED:
+    break;
+  case CS_STARTED:
+  case CS_RECEIVING:
+  case CS_REC_COMMITTING:
+  case CS_START_COMMITTING:
+  case CS_SEND_FIRE_TRIG_REQ:
+  case CS_WAIT_FIRE_TRIG_REQ:
+    outstanding = transPtr.p->lqhkeyreqrec - transPtr.p->lqhkeyconfrec;
+    break;
+  case CS_COMMITTING:
+  case CS_COMPLETING:
+  case CS_COMMIT_SENT:
+  case CS_COMPLETE_SENT:
+  case CS_ABORTING:
+    outstanding = transPtr.p->counter;
+    break;
+  case CS_PREPARE_TO_COMMIT:
+    break;
+  case CS_START_SCAN:
+    // TODO
+    break;
+  case CS_WAIT_ABORT_CONF:
+  case CS_WAIT_COMMIT_CONF:
+  case CS_WAIT_COMPLETE_CONF:
+    // not easily computed :-(
+    break;
+  case CS_FAIL_PREPARED:
+  case CS_FAIL_ABORTED:
+    // we're assembling a state...
+    break;
+  case CS_FAIL_COMMITTING:
+  case CS_FAIL_COMMITTED:
+  case CS_FAIL_ABORTING:
+  case CS_FAIL_COMPLETED:
+    // not easily computed :_(
+    break;
+  case CS_RESTART:
+    break;
+  }
+
+  row.write_uint32(outstanding);
+
+  Uint32 apiTimer = getApiConTimer(transPtr.i);
+  row.write_uint32(apiTimer ? (ctcTimer - apiTimer) / 100 : 0);
+  ndbinfo_send_row(signal, *req, row, *rl);
+}
+
 bool
 Dbtc::validate_filter(Signal* signal)
 {
@@ -13464,9 +13539,6 @@ Dbtc::match_and_print(Signal* signal, Ap
   case CS_FAIL_PREPARED:
   case CS_FAIL_COMMITTING:
   case CS_FAIL_COMMITTED:
-  case CS_REC_PREPARING:
-  case CS_START_PREPARING:
-  case CS_PREPARED:
   case CS_RESTART:
   case CS_FAIL_ABORTED:
   case CS_DISCONNECTED:

=== modified file 'storage/ndb/src/kernel/vm/Ndbinfo.hpp'
--- a/storage/ndb/src/kernel/vm/Ndbinfo.hpp	2011-10-07 08:07:21 +0000
+++ b/storage/ndb/src/kernel/vm/Ndbinfo.hpp	2011-10-07 14:34:14 +0000
@@ -48,7 +48,8 @@ public:
     NODES_TABLEID =              9,
     DISKPAGEBUFFER_TABLEID =     10,
     THREADBLOCKS_TABLEID =       11,
-    THREADSTAT_TABLEID =         12
+    THREADSTAT_TABLEID =         12,
+    TRANSACTIONS_TABLEID =       13
   };
 
   struct Table {

=== modified file 'storage/ndb/src/kernel/vm/NdbinfoTables.cpp'
--- a/storage/ndb/src/kernel/vm/NdbinfoTables.cpp	2011-10-07 08:07:21 +0000
+++ b/storage/ndb/src/kernel/vm/NdbinfoTables.cpp	2011-10-07 14:34:14 +0000
@@ -204,6 +204,22 @@ DECLARE_NDBINFO_TABLE(THREADSTAT, 18) =
   }
 };
 
+DECLARE_NDBINFO_TABLE(TRANSACTIONS, 10) =
+{ { "transactions", 10, 0, "transactions" },
+  {
+    {"node_id",             Ndbinfo::Number, ""},
+    {"block_instance",      Ndbinfo::Number, ""},
+    {"objid",               Ndbinfo::Number, ""},
+    {"apiref",              Ndbinfo::Number, ""},
+    {"transid",             Ndbinfo::String, ""},
+    {"state",               Ndbinfo::Number, ""},
+    {"flags",               Ndbinfo::Number, ""},
+    {"c_ops",               Ndbinfo::Number, "No of operations" },
+    {"outstanding",         Ndbinfo::Number, "Outstanding request" },
+    {"timer",               Ndbinfo::Number, "(in seconds)"},
+  }
+};
+
 #define DBINFOTBL(x) { Ndbinfo::x##_TABLEID, (Ndbinfo::Table*)&ndbinfo_##x }
 
 static
@@ -225,7 +241,8 @@ struct ndbinfo_table_list_entry {
   DBINFOTBL(NODES),
   DBINFOTBL(DISKPAGEBUFFER),
   DBINFOTBL(THREADBLOCKS),
-  DBINFOTBL(THREADSTAT)
+  DBINFOTBL(THREADSTAT),
+  DBINFOTBL(TRANSACTIONS)
 };
 
 static int no_ndbinfo_tables =

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (jonas.oreland:4582 to 4583) jonas oreland10 Oct