List:Internals« Previous MessageNext Message »
From:Stewart Smith Date:October 4 2005 7:25am
Subject:bk commit into 5.1 tree (stewart:1.2032)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of stewart. When stewart does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2032 05/10/04 17:25:15 stewart@stripped +6 -0
  WL#2076 Add more statistics for NDBD
  
  Display information on the undofile and datafile for each db node in the cluster.
  
  The information can vary depending on the node.

  storage/ndb/tools/desc.cpp
    1.23 05/10/04 17:24:58 stewart@stripped +55 -42
    iterate through all the db nodes to get information on undofile and datafile.

  storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
    1.5 05/10/04 17:24:58 stewart@stripped +0 -9
    make Ndb_cluster_connection_node_iter more public

  storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
    1.34 05/10/04 17:24:58 stewart@stripped +12 -0
    pass connection node iter down to cluster connection impl

  storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
    1.13 05/10/04 17:24:58 stewart@stripped +16 -0
    Make Ndb_cluster_connection_node_iter a more public API so that we can
    cycle through the db node ids to get datafile and undofile information

  sql/sql_show.cc
    1.273 05/10/04 17:24:58 stewart@stripped +1 -0
    add CLUSTER_NODE to INFORMATION_SCHEMA.DATAFILES.

  sql/ha_ndbcluster.cc
    1.154 05/10/04 17:24:58 stewart@stripped +19 -10
    Display datafile information for each db node in the cluster

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	stewart
# Host:	willster.(none)
# Root:	/home/stewart/Documents/MySQL/5.1/ndb-dd

--- 1.272/sql/sql_show.cc	2005-09-29 16:31:13 +10:00
+++ 1.273/sql/sql_show.cc	2005-10-04 17:24:58 +10:00
@@ -4121,6 +4121,7 @@
 {
   {"NAME", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
   {"ENGINE", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
+  {"CLUSTER_NODE", 1, MYSQL_TYPE_LONG, 0, 0, 0},
   {"PATH", NAME_LEN, MYSQL_TYPE_STRING, 0, 0, 0},
   {"SIZE", 1, MYSQL_TYPE_LONG, 0, 0, 0},
   {"FREE", 1, MYSQL_TYPE_LONG, 0, 0, 0},

--- 1.22/storage/ndb/tools/desc.cpp	2005-09-28 23:01:38 +10:00
+++ 1.23/storage/ndb/tools/desc.cpp	2005-10-04 17:24:58 +10:00
@@ -21,8 +21,8 @@
 
 void desc_AutoGrowSpecification(struct NdbDictionary::AutoGrowSpecification ags);
 int desc_logfilegroup(Ndb *myndb, char* name);
-int desc_undofile(Ndb *myndb, char* name);
-int desc_datafile(Ndb *myndb, char* name);
+int desc_undofile(Ndb_cluster_connection &con, Ndb *myndb, char* name);
+int desc_datafile(Ndb_cluster_connection &con, Ndb *myndb, char* name);
 int desc_tablespace(Ndb *myndb,char* name);
 int desc_table(Ndb *myndb,char* name);
 
@@ -91,9 +91,9 @@
       ;
     else if(desc_logfilegroup(&MyNdb,argv[i]))
       ;
-    else if(desc_datafile(&MyNdb, argv[i]))
+    else if(desc_datafile(con, &MyNdb, argv[i]))
       ;
-    else if(desc_undofile(&MyNdb, argv[i]))
+    else if(desc_undofile(con, &MyNdb, argv[i]))
       ;
     else
       ndbout << "No such object: " << argv[i] << endl << endl;
@@ -149,62 +149,75 @@
   return 1;
 }
 
-int desc_undofile(Ndb *myndb, char* name)
+int desc_undofile(Ndb_cluster_connection &con, Ndb *myndb, char* name)
 {
+  unsigned id;
   NdbDictionary::Dictionary *dict= myndb->getDictionary();
-  assert(dict);
-  NdbDictionary::Undofile uf= dict->getUndofile(0, name);
-  NdbError err= dict->getNdbError();
-  if(err.classification!=ndberror_cl_none)
-    return 0;
+  Ndb_cluster_connection_node_iter iter;
 
-  ndbout << "Type: Undofile" << endl;
-  ndbout << "Name: " << name << endl;
-  ndbout << "Path: " << uf.getPath() << endl;
-  ndbout << "Size: " << uf.getSize() << endl;
-  ndbout << "Free: " << uf.getFree() << endl;
+  assert(dict);
 
-  ndbout << "Logfile Group: " << uf.getLogfileGroup() << endl;
+  con.init_get_next_node(iter);
 
-  /** FIXME: are these needed, the functions aren't there
-      but the prototypes are...
+  while(id= con.get_next_node(iter))
+  {
+    NdbDictionary::Undofile uf= dict->getUndofile(0, name);
+    NdbError err= dict->getNdbError();
+    if(err.classification!=ndberror_cl_none)
+      return 0;
+
+    ndbout << "Type: Undofile" << endl;
+    ndbout << "Name: " << name << endl;
+    ndbout << "Node: " << id << endl;
+    ndbout << "Path: " << uf.getPath() << endl;
+    ndbout << "Size: " << uf.getSize() << endl;
+    ndbout << "Free: " << uf.getFree() << endl;
+
+    ndbout << "Logfile Group: " << uf.getLogfileGroup() << endl;
 
-      ndbout << "Node: " << uf.getNode() << endl;
+    /** FIXME: are these needed, the functions aren't there
+	but the prototypes are...
 
-      ndbout << "Number: " << uf.getFileNo() << endl;
-  */
+	ndbout << "Number: " << uf.getFileNo() << endl;
+    */
 
-  ndbout << endl;
+    ndbout << endl;
+  }
 
   return 1;
 }
 
-int desc_datafile(Ndb *myndb, char* name)
+int desc_datafile(Ndb_cluster_connection &con, Ndb *myndb, char* name)
 {
+  unsigned id;
   NdbDictionary::Dictionary *dict= myndb->getDictionary();
   assert(dict);
-  NdbDictionary::Datafile df= dict->getDatafile(0, name);
-  NdbError err= dict->getNdbError();
-  if(err.classification!=ndberror_cl_none)
-    return 0;
-
-  ndbout << "Type: Datafile" << endl;
-  ndbout << "Name: " << name << endl;
-  ndbout << "Path: " << df.getPath() << endl;
-  ndbout << "Size: " << df.getSize() << endl;
-  ndbout << "Free: " << df.getFree() << endl;
-
-  ndbout << "Tablespace: " << df.getTablespace() << endl;
+  Ndb_cluster_connection_node_iter iter;
 
-  /** FIXME: are these needed, the functions aren't there
-      but the prototypes are...
+  con.init_get_next_node(iter);
 
-      ndbout << "Node: " << uf.getNode() << endl;
-
-      ndbout << "Number: " << uf.getFileNo() << endl;
-  */
+  while(id= con.get_next_node(iter))
+  {
+    NdbDictionary::Datafile df= dict->getDatafile(id, name);
+    NdbError err= dict->getNdbError();
+    if(err.classification!=ndberror_cl_none)
+      return 0;
+
+    ndbout << "Type: Datafile" << endl;
+    ndbout << "Name: " << name << endl;
+    ndbout << "Node: " << id << endl;
+    ndbout << "Path: " << df.getPath() << endl;
+    ndbout << "Size: " << df.getSize() << endl;
+    ndbout << "Free: " << df.getFree() << endl;
+
+    ndbout << "Tablespace: " << df.getTablespace() << endl;
+
+    /** We probably don't need to display this ever...
+	ndbout << "Number: " << uf.getFileNo() << endl;
+    */
 
-  ndbout << endl;
+    ndbout << endl;
+  }
 
   return 1;
 }

--- 1.153/sql/ha_ndbcluster.cc	2005-09-29 16:31:13 +10:00
+++ 1.154/sql/ha_ndbcluster.cc	2005-10-04 17:24:58 +10:00
@@ -7929,17 +7929,26 @@
   for(unsigned i= 0;i < tslist.count;i++)
   {
     NdbDictionary::Dictionary::List::Element& elt = tslist.elements[i];
-    NdbDictionary::Datafile df= dict->getDatafile(0,elt.name);
+    Ndb_cluster_connection_node_iter iter;
+    unsigned id;
 
-    table->field[0]->store(elt.name,strlen(elt.name),system_charset_info);
-    table->field[1]->store("NDB",3,system_charset_info);
-    table->field[2]->store(df.getPath(),strlen(df.getPath()),
-			   system_charset_info);
-    table->field[3]->store(df.getSize());
-    table->field[4]->store(df.getFree());
-    table->field[5]->store(df.getTablespace(),strlen(df.getTablespace()),
-			   system_charset_info);
-    schema_table_store_record(thd, table);
+    g_ndb_cluster_connection->init_get_next_node(iter);
+
+    while(id= g_ndb_cluster_connection->get_next_node(iter))
+    {
+      NdbDictionary::Datafile df= dict->getDatafile(id,elt.name);
+
+      table->field[0]->store(elt.name,strlen(elt.name),system_charset_info);
+      table->field[1]->store("NDB",3,system_charset_info);
+      table->field[2]->store(id);
+      table->field[3]->store(df.getPath(),strlen(df.getPath()),
+			     system_charset_info);
+      table->field[4]->store(df.getSize());
+      table->field[5]->store(df.getFree());
+      table->field[6]->store(df.getTablespace(),strlen(df.getTablespace()),
+			     system_charset_info);
+      schema_table_store_record(thd, table);
+    }
   }
 }
 

--- 1.12/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp	2005-09-15 18:42:02 +10:00
+++ 1.13/storage/ndb/include/ndbapi/ndb_cluster_connection.hpp	2005-10-04 17:24:58 +10:00
@@ -18,6 +18,19 @@
 #ifndef CLUSTER_CONNECTION_HPP
 #define CLUSTER_CONNECTION_HPP
 
+class Ndb_cluster_connection_node_iter
+{
+  friend class Ndb_cluster_connection_impl;
+public:
+  Ndb_cluster_connection_node_iter() : scan_state(~0),
+				       init_pos(0),
+				       cur_pos(0) {};
+private:
+  unsigned char scan_state;
+  unsigned char init_pos;
+  unsigned char cur_pos;
+};
+
 /**
  * @class Ndb_cluster_connection
  * @brief Represents a connection to a cluster of storage nodes.
@@ -88,6 +101,9 @@
 
   unsigned no_db_nodes();
   unsigned node_id();
+
+  void init_get_next_node(Ndb_cluster_connection_node_iter &iter);
+  unsigned int get_next_node(Ndb_cluster_connection_node_iter &iter);
 #endif
 
 private:

--- 1.33/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2005-09-17 01:06:46 +10:00
+++ 1.34/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2005-10-04 17:24:58 +10:00
@@ -556,5 +556,17 @@
   DBUG_VOID_RETURN;
 }
 
+void
+Ndb_cluster_connection::init_get_next_node(Ndb_cluster_connection_node_iter &iter)
+{
+  m_impl.init_get_next_node(iter);
+}
+
+Uint32
+Ndb_cluster_connection::get_next_node(Ndb_cluster_connection_node_iter &iter)
+{
+  return m_impl.get_next_node(iter);
+}
+
 template class Vector<Ndb_cluster_connection_impl::Node>;
 

--- 1.4/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp	2005-09-15 18:42:04 +10:00
+++ 1.5/storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp	2005-10-04 17:24:58 +10:00
@@ -26,15 +26,6 @@
 class NdbThread;
 class ndb_mgm_configuration;
 
-struct Ndb_cluster_connection_node_iter {
-  Ndb_cluster_connection_node_iter() : scan_state(~0),
-				       init_pos(0),
-				       cur_pos(0) {};
-  Uint8 scan_state;
-  Uint8 init_pos;
-  Uint8 cur_pos;
-};
-
 extern "C" {
   void* run_ndb_cluster_connection_connect_thread(void*);
 }
Thread
bk commit into 5.1 tree (stewart:1.2032)Stewart Smith4 Oct