List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:January 2 2006 3:34am
Subject:bk commit into 5.1 tree (stewart:1.1984)
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.1984 06/01/02 14:34:45 stewart@stripped +16 -0
  WL#2076 Add more statistics for ndbd processes
  
  Import old patches for getting information via ndb_desc on files and filegroups.
  
  In a soon patch coming to you live via satellite you may even be able to
  query this information via SQL (again).

  storage/ndb/tools/desc.cpp
    1.22 06/01/02 14:34:41 stewart@stripped +55 -42
    Fixes to display information on files and filegroups

  storage/ndb/src/ndbapi/ndb_cluster_connection_impl.hpp
    1.5 06/01/02 14:34:41 stewart@stripped +0 -9
    make Ndb_cluster_connection_node_iter more public

  storage/ndb/src/ndbapi/ndb_cluster_connection.cpp
    1.36 06/01/02 14:34:41 stewart@stripped +12 -0
    a NDBAPI way to iterate through each node.

  storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp
    1.38 06/01/02 14:34:41 stewart@stripped +8 -7
    Prototypes for getting file info and filegroup info

  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp
    1.94 06/01/02 14:34:40 stewart@stripped +85 -10
    Add API parts for getting information on filegroups and files

  storage/ndb/src/ndbapi/NdbDictionary.cpp
    1.42 06/01/02 14:34:40 stewart@stripped +4 -5
    Add NdbDictionary::LogfileGroup::getUndoFreeWords()
    
    remove Undofile::getFree()

  storage/ndb/src/kernel/blocks/tsman.cpp
    1.2 06/01/02 14:34:40 stewart@stripped +12 -6
    minor fixes

  storage/ndb/src/kernel/blocks/lgman.hpp
    1.3 06/01/02 14:34:40 stewart@stripped +8 -0
    Add GET_TABINFOREQ

  storage/ndb/src/kernel/blocks/lgman.cpp
    1.3 06/01/02 14:34:40 stewart@stripped +72 -1
    Add GET_TABINFOREQ. Can now get info on logfile groups

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp
    1.23 06/01/02 14:34:40 stewart@stripped +5 -1
    pack filegroup into pages for lfg.

  storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp
    1.63 06/01/02 14:34:40 stewart@stripped +40 -2
    Get logfile group information

  storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp
    1.9 06/01/02 14:34:40 stewart@stripped +3 -1
    Add UndoFreeWords to DFGIMAP

  storage/ndb/include/ndbapi/ndb_cluster_connection.hpp
    1.13 06/01/02 14:34:40 stewart@stripped +16 -0
    Make Ndb_cluster_connection_node_iter more public so we can use it in ndb_desc

  storage/ndb/include/ndbapi/NdbDictionary.hpp
    1.58 06/01/02 14:34:40 stewart@stripped +2 -1
    add getUndoFreeWords() to logfile group

  storage/ndb/include/kernel/signaldata/GetTabInfo.hpp
    1.5 06/01/02 14:34:40 stewart@stripped +5 -1
    Add freeWordsHi and Lo to GetTabInfo

  storage/ndb/include/kernel/signaldata/DictTabInfo.hpp
    1.23 06/01/02 14:34:40 stewart@stripped +5 -1
    Add UndoFreeWordsHi and Lo to undofile group info.

# 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/dd-new-merge

--- 1.2/storage/ndb/src/kernel/blocks/lgman.cpp	2005-11-09 03:30:36 +11:00
+++ 1.3/storage/ndb/src/kernel/blocks/lgman.cpp	2006-01-02 14:34:40 +11:00
@@ -26,6 +26,7 @@
 #include <signaldata/LCP.hpp>
 #include <signaldata/SumaImpl.hpp>
 #include <signaldata/LgmanContinueB.hpp>
+#include <signaldata/GetTabInfo.hpp>
 #include "ndbfs/Ndbfs.hpp"
 #include "dbtup/Dbtup.hpp"
 
@@ -86,7 +87,9 @@
   addRecSignal(GSN_START_RECREQ, &Lgman::execSTART_RECREQ);
   
   addRecSignal(GSN_END_LCP_CONF, &Lgman::execEND_LCP_CONF);
-  
+
+  addRecSignal(GSN_GET_TABINFOREQ, &Lgman::execGET_TABINFOREQ);
+
   m_last_lsn = 0;
   m_logfile_group_pool.setSize(10);
   m_logfile_group_hash.setSize(10);
@@ -2946,3 +2949,71 @@
   }
 }
 #endif
+
+void Lgman::execGET_TABINFOREQ(Signal* signal)
+{
+  jamEntry();
+
+  if(!assembleFragments(signal))
+  {
+    return;
+  }
+
+  GetTabInfoReq * const req = (GetTabInfoReq *)&signal->theData[0];
+
+  const Uint32 reqType = req->requestType & (~GetTabInfoReq::LongSignalConf);
+  BlockReference retRef= req->senderRef;
+  Uint32 senderData= req->senderData;
+  Uint32 tableId= req->tableId;
+
+  if(reqType == GetTabInfoReq::RequestByName){
+    jam();
+    if(signal->getNoOfSections())
+      releaseSections(signal);
+
+    sendGET_TABINFOREF(signal, req, GetTabInfoRef::NoFetchByName);
+    return;
+  }
+
+  Logfile_group key;
+  key.m_logfile_group_id= tableId;
+  Ptr<Logfile_group> ptr;
+  m_logfile_group_hash.find(ptr, key);
+
+  if(ptr.p->m_logfile_group_id != tableId)
+  {
+    jam();
+    if(signal->getNoOfSections())
+      releaseSections(signal);
+
+    sendGET_TABINFOREF(signal, req, GetTabInfoRef::InvalidTableId);
+    return;
+  }
+
+
+  GetTabInfoConf *conf = (GetTabInfoConf *)&signal->theData[0];
+
+  conf->senderData= senderData;
+  conf->tableId= tableId;
+  conf->freeWordsHi= ptr.p->m_free_file_words >> 32;
+  conf->freeWordsLo= ptr.p->m_free_file_words & 0xFFFFFFFF;
+  conf->tableType= DictTabInfo::LogfileGroup;
+  conf->senderRef= reference();
+  sendSignal(retRef, GSN_GET_TABINFO_CONF, signal,
+	     GetTabInfoConf::SignalLength, JBB);
+}
+
+void Lgman::sendGET_TABINFOREF(Signal* signal,
+			       GetTabInfoReq * req,
+			       GetTabInfoRef::ErrorCode errorCode)
+{
+  jamEntry();
+  GetTabInfoRef * const ref = (GetTabInfoRef *)&signal->theData[0];
+  /**
+   * The format of GetTabInfo Req/Ref is the same
+   */
+  BlockReference retRef = req->senderRef;
+  ref->errorCode = errorCode;
+
+  sendSignal(retRef, GSN_GET_TABINFOREF, signal, signal->length(), JBB);
+}

--- 1.2/storage/ndb/src/kernel/blocks/lgman.hpp	2005-11-09 03:30:36 +11:00
+++ 1.3/storage/ndb/src/kernel/blocks/lgman.hpp	2006-01-02 14:34:40 +11:00
@@ -26,6 +26,7 @@
 #include <DLHashTable.hpp>
 #include <NodeBitmask.hpp>
 #include "diskpage.hpp"
+#include <signaldata/GetTabInfo.hpp>
 
 class Lgman : public SimulatedBlock
 {
@@ -66,6 +67,13 @@
   
   void execSTART_RECREQ(Signal*);
   void execEND_LCP_CONF(Signal*);
+
+  void execGET_TABINFOREQ(Signal*);
+
+  void sendGET_TABINFOREF(Signal* signal,
+			  GetTabInfoReq * req,
+			  GetTabInfoRef::ErrorCode errorCode);
+
 public:
   struct Log_waiter
   {

--- 1.1/storage/ndb/src/kernel/blocks/tsman.cpp	2005-11-07 22:19:15 +11:00
+++ 1.2/storage/ndb/src/kernel/blocks/tsman.cpp	2006-01-02 14:34:40 +11:00
@@ -2055,17 +2055,23 @@
   if(reqType == GetTabInfoReq::RequestByName){
     jam();
     releaseSections(signal);
-    
-    sendGET_TABINFOREF(signal, req, GetTabInfoRef::TableNameTooLong);
+
+    sendGET_TABINFOREF(signal, req, GetTabInfoRef::NoFetchByName);
     return;
   }
 
   DLHashTable<Datafile>::Iterator iter;
   ndbrequire(m_file_hash.first(iter));
+
   while(iter.curr.p->m_file_id != tableId && m_file_hash.next(iter))
     ;
-  ndbrequire(iter.curr.p->m_file_id == tableId);
-  
+
+  if(iter.curr.p->m_file_id != tableId)
+  {
+    sendGET_TABINFOREF(signal, req, GetTabInfoRef::InvalidTableId);
+    return;
+  }
+
   const Ptr<Datafile> &file_ptr= iter.curr;
 
   jam();
@@ -2073,9 +2079,9 @@
   Uint32 total_free_extents = file_ptr.p->m_online.m_data_pages;
   total_free_extents /= file_ptr.p->m_extent_size;
   total_free_extents -= file_ptr.p->m_online.m_used_extent_cnt;
-  
+
   GetTabInfoConf *conf = (GetTabInfoConf *)&signal->theData[0];
-  
+
   conf->senderData= senderData;
   conf->tableId= tableId;
   conf->freeExtents= total_free_extents;

--- 1.22/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp	2005-11-07 22:19:05 +11:00
+++ 1.23/storage/ndb/include/kernel/signaldata/DictTabInfo.hpp	2006-01-02 14:34:40 +11:00
@@ -609,7 +609,9 @@
     LF_UndoGrowSizeHi  = 2001,
     LF_UndoGrowSizeLo  = 2002,
     LF_UndoGrowPattern = 2003,
-    LF_UndoGrowMaxSize = 2004
+    LF_UndoGrowMaxSize = 2004,
+    LF_UndoFreeWordsHi = 2006,
+    LF_UndoFreeWordsLo = 2007,
   };
 
   // FragmentType constants
@@ -645,6 +647,8 @@
       GrowSpec LF_UndoGrow;
     };
     //GrowSpec LF_RedoGrow;
+    Uint32 LF_UndoFreeWordsHi;
+    Uint32 LF_UndoFreeWordsLo;
     void init();
   };
   static const Uint32 MappingSize;

--- 1.4/storage/ndb/include/kernel/signaldata/GetTabInfo.hpp	2005-11-07 22:19:05 +11:00
+++ 1.5/storage/ndb/include/kernel/signaldata/GetTabInfo.hpp	2006-01-02 14:34:40 +11:00
@@ -112,10 +112,14 @@
 public:
   Uint32 senderData;
   Uint32 tableId;
-  Uint32 gci; // For table
+  union {
+    Uint32 gci; // For table
+    Uint32 freeWordsHi; // for logfile group m_free_file_words
+  };
   union {
     Uint32 totalLen; // In words
     Uint32 freeExtents;
+    Uint32 freeWordsLo; // for logfile group m_free_file_words
   };
   Uint32 tableType;
   Uint32 senderRef;

--- 1.57/storage/ndb/include/ndbapi/NdbDictionary.hpp	2005-11-07 22:19:05 +11:00
+++ 1.58/storage/ndb/include/ndbapi/NdbDictionary.hpp	2006-01-02 14:34:40 +11:00
@@ -1194,6 +1194,8 @@
     void setAutoGrowSpecification(const AutoGrowSpecification&);
     const AutoGrowSpecification& getAutoGrowSpecification() const;
 
+    Uint64 getUndoFreeWords() const;
+
     /**
      * Get object status
      */
@@ -1295,7 +1297,6 @@
   
     void setSize(Uint64);
     Uint64 getSize() const;
-    Uint64 getFree() const;
 
     void setLogfileGroup(const char * name);
     void setLogfileGroup(const class LogfileGroup &);

--- 1.8/storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp	2005-11-07 22:19:06 +11:00
+++ 1.9/storage/ndb/src/common/debugger/signaldata/DictTabInfo.cpp	2006-01-02 14:34:40 +11:00
@@ -174,7 +174,9 @@
   DFGIMAP(Filegroup,  LF_UndoGrowSizeLo, LF_UndoGrow.GrowSizeLo),
   DFGIMAPS(Filegroup, LF_UndoGrowPattern, LF_UndoGrow.GrowPattern, 0,PATH_MAX),
   DFGIMAP(Filegroup,  LF_UndoGrowMaxSize, LF_UndoGrow.GrowMaxSize),
-  
+  DFGIMAP(Filegroup,  LF_UndoFreeWordsHi, LF_UndoFreeWordsHi),
+  DFGIMAP(Filegroup,  LF_UndoFreeWordsLo, LF_UndoFreeWordsLo),
+
   DFGIBREAK(FileName)
 };
 

--- 1.62/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2005-12-03 06:07:08 +11:00
+++ 1.63/storage/ndb/src/kernel/blocks/dbdict/Dbdict.cpp	2006-01-02 14:34:40 +11:00
@@ -353,7 +353,9 @@
   case DictTabInfo::LogfileGroup:{
     FilegroupPtr fg_ptr;
     ndbrequire(c_filegroup_hash.find(fg_ptr, tableId));
-    packFilegroupIntoPages(w, fg_ptr);
+    const Uint32 free_hi= signal->theData[4];
+    const Uint32 free_lo= signal->theData[5];
+    packFilegroupIntoPages(w, fg_ptr, free_hi, free_lo);
     break;
   }
   case DictTabInfo::Datafile:{
@@ -532,7 +534,9 @@
 
 void
 Dbdict::packFilegroupIntoPages(SimpleProperties::Writer & w,
-			       FilegroupPtr fg_ptr){
+			       FilegroupPtr fg_ptr,
+			       const Uint32 undo_free_hi,
+			       const Uint32 undo_free_lo){
   
   DictFilegroupInfo::Filegroup fg; fg.init();
   ConstRope r(c_rope_pool, fg_ptr.p->m_name);
@@ -553,6 +557,8 @@
     break;
   case DictTabInfo::LogfileGroup:
     fg.LF_UndoBufferSize = fg_ptr.p->m_logfilegroup.m_undo_buffer_size;
+    fg.LF_UndoFreeWordsHi= undo_free_hi;
+    fg.LF_UndoFreeWordsLo= undo_free_lo;
     //fg.LF_UndoGrow = ;
     break;
   default:
@@ -2979,6 +2985,26 @@
       signal->theData[4]= free_extents;
       sendSignal(reference(), GSN_CONTINUEB, signal, 5, JBB);
     }
+    else if(refToBlock(conf->senderRef) == LGMAN
+	    && (refToNode(conf->senderRef) == 0
+		|| refToNode(conf->senderRef) == getOwnNodeId()))
+    {
+      jam();
+      FilegroupPtr fg_ptr;
+      ndbrequire(c_filegroup_hash.find(fg_ptr, conf->tableId));
+      const Uint32 free_hi= conf->freeWordsHi;
+      const Uint32 free_lo= conf->freeWordsLo;
+      const Uint32 id= conf->tableId;
+      const Uint32 type= conf->tableType;
+      const Uint32 data= conf->senderData;
+      signal->theData[0]= ZPACK_TABLE_INTO_PAGES;
+      signal->theData[1]= id;
+      signal->theData[2]= type;
+      signal->theData[3]= data;
+      signal->theData[4]= free_hi;
+      signal->theData[5]= free_lo;
+      sendSignal(reference(), GSN_CONTINUEB, signal, 6, JBB);
+    }
     else
     {
       jam();
@@ -7059,6 +7085,18 @@
     req->tableId= obj_id;
 
     sendSignal(TSMAN_REF, GSN_GET_TABINFOREQ, signal,
+	       GetTabInfoReq::SignalLength, JBB);
+  }
+  else if(objEntry->m_tableType==DictTabInfo::LogfileGroup)
+  {
+    jam();
+    GetTabInfoReq *req= (GetTabInfoReq*)signal->theData;
+    req->senderData= c_retrieveRecord.retrievePage;
+    req->senderRef= reference();
+    req->requestType= GetTabInfoReq::RequestById;
+    req->tableId= obj_id;
+
+    sendSignal(LGMAN_REF, GSN_GET_TABINFOREQ, signal,
 	       GetTabInfoReq::SignalLength, JBB);
   }
   else

--- 1.22/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2005-11-07 22:19:06 +11:00
+++ 1.23/storage/ndb/src/kernel/blocks/dbdict/Dbdict.hpp	2006-01-02 14:34:40 +11:00
@@ -508,6 +508,7 @@
     Uint32 m_filegroup_id;
     Uint32 m_type;
     Uint64 m_file_size;
+    Uint64 m_file_free;
     RopeHandle m_path;
     
     Uint32 nextList;
@@ -2001,7 +2002,10 @@
 			     AttributeRecordPtr & attrPtr);
   void packTableIntoPages(Signal* signal);
   void packTableIntoPages(SimpleProperties::Writer &, TableRecordPtr, Signal* =0);
-  void packFilegroupIntoPages(SimpleProperties::Writer &, FilegroupPtr);
+  void packFilegroupIntoPages(SimpleProperties::Writer &,
+			      FilegroupPtr,
+			      const Uint32 undo_free_hi,
+			      const Uint32 undo_free_lo);
   void packFileIntoPages(SimpleProperties::Writer &, FilePtr, const Uint32);
   
   void sendGET_TABINFOREQ(Signal* signal,

--- 1.41/storage/ndb/src/ndbapi/NdbDictionary.cpp	2005-11-07 22:19:08 +11:00
+++ 1.42/storage/ndb/src/ndbapi/NdbDictionary.cpp	2006-01-02 14:34:40 +11:00
@@ -900,6 +900,10 @@
   return m_impl.m_grow_spec;
 }
 
+Uint64 NdbDictionary::LogfileGroup::getUndoFreeWords() const {
+  return m_impl.m_undo_free_words;
+}
+
 NdbDictionary::Object::Status
 NdbDictionary::LogfileGroup::getObjectStatus() const {
   return m_impl.m_status;
@@ -1022,11 +1026,6 @@
 Uint64
 NdbDictionary::Undofile::getSize() const {
   return m_impl.m_size;
-}
-
-Uint64
-NdbDictionary::Undofile::getFree() const {
-  return m_impl.m_free;
 }
 
 void 

--- 1.93/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2005-11-07 22:19:08 +11:00
+++ 1.94/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2006-01-02 14:34:40 +11:00
@@ -3776,10 +3776,10 @@
 NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst,
 				NdbDictionary::Object::Type type,
 				const char * name){
-  DBUG_ENTER("NdbDictInterface::get_filegroup"); 
+  DBUG_ENTER("NdbDictInterface::get_filegroup");
   NdbApiSignal tSignal(m_reference);
   GetTabInfoReq * req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
-  
+
   size_t strLen = strlen(name) + 1;
 
   req->senderRef = m_reference;
@@ -3794,7 +3794,7 @@
   LinearSectionPtr ptr[1];
   ptr[0].p  = (Uint32*)name;
   ptr[0].sz = (strLen + 3)/4;
-  
+
   int r = dictSignal(&tSignal, ptr, 1,
 		     -1, // any node
 		     WAIT_GET_TAB_INFO_REQ,
@@ -3804,18 +3804,17 @@
     DBUG_PRINT("info", ("get_filegroup failed dictSignal"));
     DBUG_RETURN(-1);
   }
-  
-  m_error.code = parseFilegroupInfo(dst, 
-				    (Uint32*)m_buffer.get_data(), 
+
+  m_error.code = parseFilegroupInfo(dst,
+				    (Uint32*)m_buffer.get_data(),
 				    m_buffer.length() / 4);
-  
+
   if(m_error.code)
   {
     DBUG_PRINT("info", ("get_filegroup failed parseFilegroupInfo %d",
                          m_error.code));
     DBUG_RETURN(m_error.code);
   }
-
   if(dst.m_type == type)
   {
     DBUG_RETURN(0);
@@ -3852,10 +3851,67 @@
   dst.m_undo_buffer_size = fg.LF_UndoBufferSize;
   dst.m_logfile_group_id = fg.TS_LogfileGroupId;
   dst.m_logfile_group_version = fg.TS_LogfileGroupVersion;
+  dst.m_undo_free_words= ((Uint64)fg.LF_UndoFreeWordsHi << 32)
+    | (fg.LF_UndoFreeWordsLo);
+
+  if(dst.m_type==NdbDictionary::Object::Tablespace)
+  {
+    NdbDictionary::LogfileGroup tmp;
+    get_filegroup(NdbLogfileGroupImpl::getImpl(tmp),
+		  NdbDictionary::Object::LogfileGroup,
+		  dst.m_logfile_group_id);
+    dst.m_logfile_group_name.assign(tmp.getName());
+  }
   return 0;
 }
 
 int
+NdbDictInterface::get_filegroup(NdbFilegroupImpl & dst,
+				NdbDictionary::Object::Type type,
+				Uint32 id){
+  DBUG_ENTER("NdbDictInterface::get_filegroup");
+  NdbApiSignal tSignal(m_reference);
+  GetTabInfoReq * req = CAST_PTR(GetTabInfoReq, tSignal.getDataPtrSend());
+
+  req->senderRef = m_reference;
+  req->senderData = 0;
+  req->requestType =
+    GetTabInfoReq::RequestById | GetTabInfoReq::LongSignalConf;
+  req->tableId = id;
+  tSignal.theReceiversBlockNumber = DBDICT;
+  tSignal.theVerId_signalNumber   = GSN_GET_TABINFOREQ;
+  tSignal.theLength = GetTabInfoReq::SignalLength;
+
+  int r = dictSignal(&tSignal, NULL, 1,
+		     -1, // any node
+		     WAIT_GET_TAB_INFO_REQ,
+		     WAITFOR_RESPONSE_TIMEOUT, 100);
+  if (r)
+  {
+    DBUG_PRINT("info", ("get_filegroup failed dictSignal"));
+    DBUG_RETURN(-1);
+  }
+
+  m_error.code = parseFilegroupInfo(dst,
+				    (Uint32*)m_buffer.get_data(),
+				    m_buffer.length() / 4);
+
+  if(m_error.code)
+  {
+    DBUG_PRINT("info", ("get_filegroup failed parseFilegroupInfo %d",
+                         m_error.code));
+    DBUG_RETURN(m_error.code);
+  }
+
+  if(dst.m_type == type)
+  {
+    DBUG_RETURN(0);
+  }
+  DBUG_PRINT("info", ("get_filegroup failed no such filegroup"));
+  DBUG_RETURN(m_error.code = GetTabInfoRef::TableNotDefined);
+}
+
+int
 NdbDictInterface::get_file(NdbFileImpl & dst,
 			   NdbDictionary::Object::Type type,
 			   int node,
@@ -3929,9 +3985,28 @@
   dst.m_id= f.FileNo;
 
   dst.m_size= ((Uint64)f.FileSizeHi << 32) | (f.FileSizeLo);
-  dst.m_free= f.FileFreeExtents;
   dst.m_path.assign(f.FileName);
-  //dst.m_filegroup_name
+
+  if(dst.m_type==NdbDictionary::Object::Undofile)
+  {
+    NdbDictionary::LogfileGroup tmp;
+    get_filegroup(NdbLogfileGroupImpl::getImpl(tmp),
+		  NdbDictionary::Object::LogfileGroup,
+		  f.FilegroupId);
+    dst.m_filegroup_name.assign(tmp.getName());
+  }
+  else if(dst.m_type==NdbDictionary::Object::Datafile)
+  {
+    NdbDictionary::Tablespace tmp;
+    get_filegroup(NdbTablespaceImpl::getImpl(tmp),
+		  NdbDictionary::Object::Tablespace,
+		  f.FilegroupId);
+    dst.m_filegroup_name.assign(tmp.getName());
+    dst.m_free= f.FileFreeExtents * tmp.getExtentSize();
+  }
+  else
+    dst.m_filegroup_name.assign("Not Yet Implemented");
+
   dst.m_filegroup_id= f.FilegroupId;
   dst.m_filegroup_version= f.FilegroupVersion;
 

--- 1.37/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2005-11-07 22:19:08 +11:00
+++ 1.38/storage/ndb/src/ndbapi/NdbDictionaryImpl.hpp	2006-01-02 14:34:41 +11:00
@@ -292,6 +292,7 @@
   BaseString m_logfile_group_name;
   Uint32 m_logfile_group_id;
   Uint32 m_logfile_group_version;
+  Uint64 m_undo_free_words;
 };
 
 class NdbTablespaceImpl : public NdbDictionary::Tablespace, 
@@ -402,18 +403,18 @@
 			    const Uint32 * data, Uint32 len,
 			    bool fullyQualifiedNames);
 
-  static int parseFileInfo(NdbFileImpl &dst, 
-			   const Uint32 * data, Uint32 len);
-  
-  static int parseFilegroupInfo(NdbFilegroupImpl &dst, 
-				const Uint32 * data, Uint32 len);
-  
+  int parseFileInfo(NdbFileImpl &dst,
+		    const Uint32 * data, Uint32 len);
+
+  int parseFilegroupInfo(NdbFilegroupImpl &dst,
+			 const Uint32 * data, Uint32 len);
+
   int create_file(const NdbFileImpl &, const NdbFilegroupImpl&, bool overwrite = false);
   int drop_file(const NdbFileImpl &);
   int create_filegroup(const NdbFilegroupImpl &);
   int drop_filegroup(const NdbFilegroupImpl &);
   
-  int get_filegroup(NdbFilegroupImpl&, NdbDictionary::Object::Type, int);
+  int get_filegroup(NdbFilegroupImpl&, NdbDictionary::Object::Type, Uint32);
   int get_filegroup(NdbFilegroupImpl&,NdbDictionary::Object::Type,const char*);
   int get_file(NdbFileImpl&, NdbDictionary::Object::Type, int, int);
   int get_file(NdbFileImpl&, NdbDictionary::Object::Type, int, const char *);

--- 1.21/storage/ndb/tools/desc.cpp	2005-11-07 22:19:10 +11:00
+++ 1.22/storage/ndb/tools/desc.cpp	2006-01-02 14:34:41 +11: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;
@@ -123,6 +123,7 @@
   ndbout << "Name: " << lfg.getName() << endl;
   ndbout << "UndoBuffer size: " << lfg.getUndoBufferSize() << endl;
   ndbout << "Version: " << lfg.getObjectVersion() << endl;
+  ndbout << "Free Words: " << lfg.getUndoFreeWords() << endl;
 
   desc_AutoGrowSpecification(lfg.getAutoGrowSpecification());
 
@@ -149,62 +150,74 @@
   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 << "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.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	2006-01-02 14:34:40 +11: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.35/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2005-12-19 04:02:37 +11:00
+++ 1.36/storage/ndb/src/ndbapi/ndb_cluster_connection.cpp	2006-01-02 14:34:41 +11: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	2006-01-02 14:34:41 +11: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.1984)Stewart Smith2 Jan