List:Commits« Previous MessageNext Message »
From:Maitrayi Sabaratnam Date:November 2 2012 6:21pm
Subject:bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:5017 to 5018)
Bug#13336549
View as plain text  
 5018 Maitrayi Sabaratnam	2012-11-02
      Bug#13336549 - ADDITIONAL LOGGING OF PRESIDENT ATTEMPTS FOR ARBITRATOR ELECTION

    modified:
      scripts/mysql_system_tables.sql
      storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp
      storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp
      storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp
      storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp
      storage/ndb/src/kernel/vm/Ndbinfo.hpp
      storage/ndb/src/kernel/vm/NdbinfoTables.cpp
      storage/ndb/tools/ndbinfo_sql.cpp
 5017 Martin Skold	2012-11-02 [merge]
      ndb - bump version to 7.0.37

    modified:
      configure.in
      storage/ndb/ndb_configure.m4
=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2012-09-28 23:36:17 +0000
+++ b/scripts/mysql_system_tables.sql	2012-11-02 16:51:46 +0000
@@ -176,6 +176,21 @@ PREPARE stmt FROM @str;
 EXECUTE stmt;
 DROP PREPARE stmt;
 
+SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`membership`','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`arbitrator_validity_detail`','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @str=IF(@have_ndbinfo,'DROP VIEW IF EXISTS `ndbinfo`.`arbitrator_validity_summary`','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
 # Drop any old lookup tables in ndbinfo
 SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS ndbinfo.blocks','SET @dummy = 0');
 PREPARE stmt FROM @str;
@@ -308,6 +323,17 @@ PREPARE stmt FROM @str;
 EXECUTE stmt;
 DROP PREPARE stmt;
 
+# ndbinfo.ndb$membership
+SET @str=IF(@have_ndbinfo,'DROP TABLE IF EXISTS `ndbinfo`.`ndb$membership`','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`ndb$membership` (`node_id` INT UNSIGNED COMMENT "node id",`group_id` INT UNSIGNED COMMENT "node group id",`left_node` INT UNSIGNED COMMENT "Left node in heart beat chain",`right_node` INT UNSIGNED COMMENT "Right node in heart beat chain",`president` INT UNSIGNED COMMENT "President nodeid",`successor` INT UNSIGNED COMMENT "President successor",`dynamic_id` INT COMMENT "President-configured_heartbeat order",`arbitrator` INT UNSIGNED COMMENT "Arbitrator nodeid",`arb_ticket` VARCHAR(512) COMMENT "Arbitrator ticket",`arb_state` INT UNSIGNED COMMENT "Arbitrator state",`arb_connected` INT UNSIGNED COMMENT "Arbitrator connected",`conn_rank1_arbs` VARCHAR(512) COMMENT "Connected rank 1 arbitrators",`conn_rank2_arbs` VARCHAR(512) COMMENT "Connected rank 2 arbitrators") COMMENT="membership" ENGINE=NDBINFO','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
 # ndbinfo.blocks
 SET @str=IF(@have_ndbinfo,'CREATE TABLE `ndbinfo`.`blocks` (block_number INT UNSIGNED PRIMARY KEY, block_name VARCHAR(512))','SET @dummy = 0');
 PREPARE stmt FROM @str;
@@ -377,3 +403,21 @@ SET @str=IF(@have_ndbinfo,'CREATE OR REP
 PREPARE stmt FROM @str;
 EXECUTE stmt;
 DROP PREPARE stmt;
+
+# ndbinfo.membership
+SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root@localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`membership` AS SELECT node_id, group_id, left_node, right_node, president, successor, dynamic_id & 0xFFFF AS succession_order, dynamic_id >> 16 AS Conf_HB_order, arbitrator, arb_ticket, CASE arb_state  WHEN 0 THEN "ARBIT_NULL"  WHEN 1 THEN "ARBIT_INIT"  WHEN 2 THEN "ARBIT_FIND"  WHEN 3 THEN "ARBIT_PREP1"  WHEN 4 THEN "ARBIT_PREP2"  WHEN 5 THEN "ARBIT_START"  WHEN 6 THEN "ARBIT_RUN"  WHEN 7 THEN "ARBIT_CHOOSE"  WHEN 8 THEN "ARBIT_CRASH"  ELSE "UNKNOWN" END AS arb_state, CASE arb_connected  WHEN 1 THEN "Yes"  ELSE "No" END AS arb_connected, conn_rank1_arbs AS connected_rank1_arbs, conn_rank2_arbs AS connected_rank2_arbs FROM `ndbinfo`.`ndb$membership`','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+# ndbinfo.arbitrator_validity_detail
+SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root@localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`arbitrator_validity_detail` AS SELECT node_id, arbitrator, arb_ticket, CASE arb_connected  WHEN 1 THEN "Yes"  ELSE "No" END AS arb_connected, CASE arb_state  WHEN 0 THEN "ARBIT_NULL"  WHEN 1 THEN "ARBIT_INIT"  WHEN 2 THEN "ARBIT_FIND"  WHEN 3 THEN "ARBIT_PREP1"  WHEN 4 THEN "ARBIT_PREP2"  WHEN 5 THEN "ARBIT_START"  WHEN 6 THEN "ARBIT_RUN"  WHEN 7 THEN "ARBIT_CHOOSE"  WHEN 8 THEN "ARBIT_CRASH"  ELSE "UNKNOWN" END AS arb_state FROM `ndbinfo`.`ndb$membership` ORDER BY arbitrator, arb_connected DESC','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;
+
+# ndbinfo.arbitrator_validity_summary
+SET @str=IF(@have_ndbinfo,'CREATE OR REPLACE DEFINER=`root@localhost` SQL SECURITY INVOKER VIEW `ndbinfo`.`arbitrator_validity_summary` AS SELECT arbitrator, arb_ticket, CASE arb_connected  WHEN 1 THEN "Yes"  ELSE "No" END AS arb_connected, count(*) as consensus_count FROM `ndbinfo`.`ndb$membership` GROUP BY arbitrator, arb_ticket, arb_connected','SET @dummy = 0');
+PREPARE stmt FROM @str;
+EXECUTE stmt;
+DROP PREPARE stmt;

=== modified file 'storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp'
--- a/storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp	2011-11-22 13:03:47 +0000
+++ b/storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp	2012-11-02 16:51:46 +0000
@@ -29,7 +29,7 @@
 
 Uint32 dbinfo_blocks[] = { DBACC, DBTUP, BACKUP, DBTC, SUMA, DBUTIL,
                            TRIX, DBTUX, DBDICT, CMVMI, DBLQH, LGMAN,
-                           PGMAN, DBSPJ, THRMAN, TRPMAN, 0};
+                           PGMAN, DBSPJ, THRMAN, TRPMAN, QMGR, 0};
 
 Dbinfo::Dbinfo(Block_context& ctx) :
   SimulatedBlock(DBINFO, ctx)

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2012-01-11 13:16:31 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/Qmgr.hpp	2012-11-02 16:51:46 +0000
@@ -364,6 +364,9 @@ private:
   void execNODE_PINGREQ(Signal* signal);
   void execNODE_PINGCONF(Signal* signal);
 
+  // Ndbinfo signal
+  void execDBINFO_SCANREQ(Signal *signal);
+
   // Statement blocks
   void check_readnodes_reply(Signal* signal, Uint32 nodeId, Uint32 gsn);
   Uint32 check_startup(Signal* signal);

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2012-01-11 13:16:31 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrInit.cpp	2012-11-02 16:51:46 +0000
@@ -208,6 +208,9 @@ Qmgr::Qmgr(Block_context& ctx)
   addRecSignal(GSN_NODE_PING_REQ, &Qmgr::execNODE_PINGREQ);
   addRecSignal(GSN_NODE_PING_CONF, &Qmgr::execNODE_PINGCONF);
 
+  // Ndbinfo signal
+  addRecSignal(GSN_DBINFO_SCANREQ, &Qmgr::execDBINFO_SCANREQ);
+
   initData();
 }//Qmgr::Qmgr()
 

=== modified file 'storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp'
--- a/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2012-11-01 19:13:39 +0000
+++ b/storage/ndb/src/kernel/blocks/qmgr/QmgrMain.cpp	2012-11-02 16:51:46 +0000
@@ -7159,3 +7159,97 @@ Qmgr::handleFailFromSuspect(Signal* sign
 
   failReportLab(signal, sourceNode, (FailRep::FailCause) reason, getOwnNodeId());
 }
+
+void
+Qmgr::execDBINFO_SCANREQ(Signal *signal)
+{
+  DbinfoScanReq req= *(DbinfoScanReq*)signal->theData;
+  Ndbinfo::Ratelimit rl;
+
+  jamEntry();
+  switch(req.tableId) {
+  case Ndbinfo::MEMBERSHIP_TABLEID:
+  {
+    jam();
+    Ndbinfo::Row row(signal, req);
+    row.write_uint32(getOwnNodeId());
+    row.write_uint32(getNodeState().nodeGroup);
+    row.write_uint32(cneighbourl);
+    row.write_uint32(cneighbourh);
+    row.write_uint32(cpresident);
+
+    Uint32 successor = 0; // President sucessor.
+    NodeRecPtr nodePtr;
+    UintR tfrMinDynamicId = (UintR)-1;
+    for (nodePtr.i = 1; nodePtr.i < MAX_NDB_NODES; nodePtr.i++) {
+      jam();
+      ptrAss(nodePtr, nodeRec);
+      if (nodePtr.p->phase == ZRUNNING) {
+        if ((nodePtr.p->ndynamicId & 0xFFFF) < tfrMinDynamicId) {
+          jam();
+          if (cpresident !=  nodePtr.i)
+          {
+            tfrMinDynamicId = (nodePtr.p->ndynamicId & 0xFFFF);
+            successor = nodePtr.i;
+          }
+        }
+      }
+    }//for
+    row.write_uint32(successor);
+
+    NodeRecPtr myNodePtr;
+    myNodePtr.i = getOwnNodeId();
+    ptrCheckGuard(myNodePtr, MAX_NDB_NODES, nodeRec);
+    row.write_uint32(myNodePtr.p->ndynamicId);
+
+    row.write_uint32(arbitRec.node); // arbitrator
+
+    char ticket[20]; // Need 16 characters + 1 for trailing '\0'
+    arbitRec.ticket.getText(ticket, sizeof(ticket));
+    row.write_string(ticket);
+
+    row.write_uint32(arbitRec.state);
+
+    // arbitrator connected
+    row.write_uint32(c_connectedNodes.get(arbitRec.node));
+
+    // Find the potential (rank1 and rank2) arbitrators that are connected.
+    NodeRecPtr aPtr;
+    // buf_size: Node nr (max 3 chars) and ', '  + trailing '\0'
+    const int buf_size = 5 * MAX_NODES + 1;
+    char buf[buf_size];
+
+    for (unsigned rank = 1; rank <= 2; rank++)
+    {
+      jam();
+      aPtr.i = 0;
+      const unsigned stop = NodeBitmask::NotFound;
+      int buf_offset = 0;
+      char* delimiter = "";
+
+      while ((aPtr.i = arbitRec.apiMask[rank].find(aPtr.i + 1)) != stop)
+      {
+        jam();
+        ptrAss(aPtr, nodeRec);
+        if (c_connectedNodes.get(aPtr.i))
+        {
+          buf_offset += BaseString::snprintf(buf + buf_offset,
+                                             buf_size - buf_offset,
+                                             "%s%u", delimiter, aPtr.i);
+          delimiter = ", ";
+        }
+      } // while
+
+      if (buf_offset == 0)
+        row.write_string("-");
+      else
+        row.write_string(buf);
+    } // for
+
+    ndbinfo_send_row(signal, req, row, rl);
+  } // case ARBITRATION_TABLEID
+  default:
+    break;
+  } // switch
+  ndbinfo_send_scan_conf(signal, req, rl);
+}

=== modified file 'storage/ndb/src/kernel/vm/Ndbinfo.hpp'
--- a/storage/ndb/src/kernel/vm/Ndbinfo.hpp	2011-12-13 12:53:03 +0000
+++ b/storage/ndb/src/kernel/vm/Ndbinfo.hpp	2012-11-02 16:51:46 +0000
@@ -50,7 +50,8 @@ public:
     THREADBLOCKS_TABLEID =       11,
     THREADSTAT_TABLEID =         12,
     TRANSACTIONS_TABLEID =       13,
-    OPERATIONS_TABLEID =         14
+    OPERATIONS_TABLEID =         14,
+    MEMBERSHIP_TABLEID =         15
   };
 
   struct Table {

=== modified file 'storage/ndb/src/kernel/vm/NdbinfoTables.cpp'
--- a/storage/ndb/src/kernel/vm/NdbinfoTables.cpp	2012-09-28 23:36:17 +0000
+++ b/storage/ndb/src/kernel/vm/NdbinfoTables.cpp	2012-11-02 16:51:46 +0000
@@ -243,6 +243,25 @@ DECLARE_NDBINFO_TABLE(OPERATIONS, 12) =
   }
 };
 
+DECLARE_NDBINFO_TABLE(MEMBERSHIP, 13) =
+{ { "membership", 13, 0, "membership" },
+  {
+    {"node_id",         Ndbinfo::Number, "node id"},
+    {"group_id",        Ndbinfo::Number, "node group id"},
+    {"left_node",       Ndbinfo::Number, "Left node in heart beat chain"},
+    {"right_node",      Ndbinfo::Number, "Right node in heart beat chain"},
+    {"president",       Ndbinfo::Number, "President nodeid"},
+    {"successor",       Ndbinfo::Number, "President successor"},
+    {"dynamic_id",      Ndbinfo::Number, "President, Configured_heartbeat order"},
+    {"arbitrator",      Ndbinfo::Number, "Arbitrator nodeid"},
+    {"arb_ticket",      Ndbinfo::String, "Arbitrator ticket"},
+    {"arb_state",       Ndbinfo::Number, "Arbitrator state"},
+    {"arb_connected",   Ndbinfo::Number, "Arbitrator connected"},
+    {"conn_rank1_arbs", Ndbinfo::String, "Connected rank 1 arbitrators"},
+    {"conn_rank2_arbs", Ndbinfo::String, "Connected rank 2 arbitrators"}
+  }
+};
+
 #define DBINFOTBL(x) { Ndbinfo::x##_TABLEID, (Ndbinfo::Table*)&ndbinfo_##x }
 
 static
@@ -266,7 +285,8 @@ struct ndbinfo_table_list_entry {
   DBINFOTBL(THREADBLOCKS),
   DBINFOTBL(THREADSTAT),
   DBINFOTBL(TRANSACTIONS),
-  DBINFOTBL(OPERATIONS)
+  DBINFOTBL(OPERATIONS),
+  DBINFOTBL(MEMBERSHIP)
 };
 
 static int no_ndbinfo_tables =

=== modified file 'storage/ndb/tools/ndbinfo_sql.cpp'
--- a/storage/ndb/tools/ndbinfo_sql.cpp	2012-09-28 23:36:17 +0000
+++ b/storage/ndb/tools/ndbinfo_sql.cpp	2012-11-02 16:51:46 +0000
@@ -254,6 +254,65 @@ struct view {
     "FROM `<NDBINFO_DB>`.cluster_operations o "
     "JOIN information_schema.ndb_transid_mysql_connection_map map"
     "  ON (map.ndb_transid >> 32) = (o.transid >> 32)"
+  },
+  { "membership",
+    "SELECT node_id, group_id, left_node, right_node, president, successor, "
+    "dynamic_id & 0xFFFF AS succession_order, "
+    "dynamic_id >> 16 AS Conf_HB_order, "
+    "arbitrator, arb_ticket, "
+    "CASE arb_state"
+    "  WHEN 0 THEN \"ARBIT_NULL\""
+    "  WHEN 1 THEN \"ARBIT_INIT\""
+    "  WHEN 2 THEN \"ARBIT_FIND\""
+    "  WHEN 3 THEN \"ARBIT_PREP1\""
+    "  WHEN 4 THEN \"ARBIT_PREP2\""
+    "  WHEN 5 THEN \"ARBIT_START\""
+    "  WHEN 6 THEN \"ARBIT_RUN\""
+    "  WHEN 7 THEN \"ARBIT_CHOOSE\""
+    "  WHEN 8 THEN \"ARBIT_CRASH\""
+    "  ELSE \"UNKNOWN\""
+    " END AS arb_state, "
+    "CASE arb_connected"
+    "  WHEN 1 THEN \"Yes\""
+    "  ELSE \"No\""
+    " END AS arb_connected, "
+    "conn_rank1_arbs AS connected_rank1_arbs, "
+    "conn_rank2_arbs AS connected_rank2_arbs "
+    "FROM `<NDBINFO_DB>`.`<TABLE_PREFIX>membership`"
+  },
+  { "arbitrator_validity_detail",
+    "SELECT node_id, "
+    "arbitrator, "
+    "arb_ticket, "
+    "CASE arb_connected"
+    "  WHEN 1 THEN \"Yes\""
+    "  ELSE \"No\""
+    " END AS arb_connected, "
+    "CASE arb_state"
+    "  WHEN 0 THEN \"ARBIT_NULL\""
+    "  WHEN 1 THEN \"ARBIT_INIT\""
+    "  WHEN 2 THEN \"ARBIT_FIND\""
+    "  WHEN 3 THEN \"ARBIT_PREP1\""
+    "  WHEN 4 THEN \"ARBIT_PREP2\""
+    "  WHEN 5 THEN \"ARBIT_START\""
+    "  WHEN 6 THEN \"ARBIT_RUN\""
+    "  WHEN 7 THEN \"ARBIT_CHOOSE\""
+    "  WHEN 8 THEN \"ARBIT_CRASH\""
+    "  ELSE \"UNKNOWN\""
+    " END AS arb_state "
+    "FROM `<NDBINFO_DB>`.`<TABLE_PREFIX>membership` "
+    "ORDER BY arbitrator, arb_connected DESC"
+  },
+  { "arbitrator_validity_summary",
+    "SELECT arbitrator, "
+    "arb_ticket, "
+    "CASE arb_connected"
+    "  WHEN 1 THEN \"Yes\""
+    "  ELSE \"No\""
+    " END AS arb_connected, "
+    "count(*) as consensus_count "
+    "FROM `<NDBINFO_DB>`.`<TABLE_PREFIX>membership` "
+    "GROUP BY arbitrator, arb_ticket, arb_connected"
   }
 };
 

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-5.1-telco-7.0 branch (maitrayi.sabaratnam:5017 to 5018)Bug#13336549Maitrayi Sabaratnam6 Nov