List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:August 21 2008 2:21pm
Subject:bzr push into mysql-5.1 branch (stewart:2787 to 2788)
View as plain text  
 2788 Stewart Smith	2008-08-22 [merge]
      merge from telco-6.4
modified:
  sql/ha_ndbcluster_binlog.cc
  storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp
  storage/ndb/include/mgmapi/mgmapi_config_parameters.h
  storage/ndb/include/mgmapi/ndb_logevent.h
  storage/ndb/src/common/debugger/EventLogger.cpp
  storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp
  storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp
  storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp
  storage/ndb/src/mgmapi/ndb_logevent.cpp
  storage/ndb/src/mgmsrv/ConfigInfo.cpp

 2787 Stewart Smith	2008-08-22
      fix some compiler warnings introduced with ndb on win32 patches (WL4012 WL1744)
modified:
  storage/ndb/include/util/ndb_opts.h
  storage/ndb/src/common/util/ndb_opts.c
  storage/ndb/src/mgmsrv/Services.cpp

=== modified file 'sql/ha_ndbcluster_binlog.cc'
--- a/sql/ha_ndbcluster_binlog.cc	2008-08-10 19:01:25 +0000
+++ b/sql/ha_ndbcluster_binlog.cc	2008-08-20 16:18:38 +0000
@@ -502,6 +502,11 @@ static int ndbcluster_reset_logs(THD *th
   if (!ndb_binlog_running)
     return 0;
 
+  /* only reset master should reset logs */
+  if (!((thd->lex->sql_command == SQLCOM_RESET) &&
+        (thd->lex->type & REFRESH_MASTER)))
+    return 0;
+
   DBUG_ENTER("ndbcluster_reset_logs");
 
   /*

=== modified file 'storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp'
--- a/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2008-05-29 16:06:05 +0000
+++ b/storage/ndb/include/kernel/signaldata/DumpStateOrd.hpp	2008-08-21 14:04:53 +0000
@@ -61,6 +61,10 @@ public:
     _TCMin       = 101000,
     _TCMax       = 101999,
 
+    _LQHMin = 102000,
+    LQHLogFileInitStatus = 102000,
+    _LQHMax = 102999,
+
     // 1 QMGR Dump information about phase 1 variables
     // 13 CMVMI Dump signal counter
     // 13 NDBCNTR Dump start phase information

=== modified file 'storage/ndb/include/mgmapi/mgmapi_config_parameters.h'
--- a/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2008-05-29 16:16:50 +0000
+++ b/storage/ndb/include/mgmapi/mgmapi_config_parameters.h	2008-08-21 14:04:53 +0000
@@ -139,6 +139,8 @@
 #define CFG_DB_MAX_BUFFERED_EPOCHS    182
 #define CFG_DB_SUMA_HANDOVER_TIMEOUT  183
 
+#define CFG_DB_STARTUP_REPORT_FREQUENCY 184
+
 #define CFG_DB_SGA                    198 /* super pool mem */
 #define CFG_DB_DATA_MEM_2             199 /* used in special build in 5.1 */
 

=== modified file 'storage/ndb/include/mgmapi/ndb_logevent.h'
--- a/storage/ndb/include/mgmapi/ndb_logevent.h	2008-02-17 14:19:29 +0000
+++ b/storage/ndb/include/mgmapi/ndb_logevent.h	2008-08-21 14:04:53 +0000
@@ -190,11 +190,16 @@ extern "C" {
     NDB_LE_StartReport = 60,
 
     /* 61 (used in upcoming patch) */
-    /* 62-68 used */
+    /* 62-72 used */
     /** NDB_MGM_EVENT_SEVERITY_WARNING */
     NDB_LE_SubscriptionStatus = 69,
 
-    NDB_LE_MTSignalStatistics = 70
+    NDB_LE_MTSignalStatistics = 70,
+
+    /** NDB_MGM_EVENT_CATEGORY_FRAGLOGFILE */
+    NDB_LE_LogFileInitStatus = 71,
+    /** NDB_MGM_EVENT_CATEGORY_FRAGLOGFILE */
+    NDB_LE_LogFileInitCompStatus = 72
   };
 
   /**
@@ -712,6 +717,14 @@ extern "C" {
 	unsigned backup_id;
 	unsigned node_id;
       } RestoreCompleted;
+      /** Log event data @ref NDB_LE_LogFileInitStatus */
+      struct {
+        unsigned node_id;
+        unsigned total_files;
+        unsigned file_done;
+        unsigned total_mbytes;
+        unsigned mbytes_done;
+      } LogFileInitStatus;
       /** Log event data @ref NDB_LE_SingleUser */
       struct {
         unsigned type;

=== modified file 'storage/ndb/src/common/debugger/EventLogger.cpp'
--- a/storage/ndb/src/common/debugger/EventLogger.cpp	2008-04-23 13:42:17 +0000
+++ b/storage/ndb/src/common/debugger/EventLogger.cpp	2008-08-21 14:04:53 +0000
@@ -893,7 +893,29 @@ void getTextRestoreCompleted(QQQQ)
                        "Restore completed: backup %u from node %u",
                        theData[1], theData[2]);
 }
-
+void getTextLogFileInitStatus(QQQQ) {
+  if (theData[2])
+    BaseString::snprintf(m_text, m_text_len,
+                         "Local redo log file initialization status:\n"
+                         "#Total files: %lu, Completed: %lu\n"
+                         "#Total MBytes: %lu, Completed: %lu",
+//                         refToNode(theData[1]),
+                         theData[2], theData[3],
+                         theData[4], theData[5]);
+  else
+    BaseString::snprintf(m_text, m_text_len,
+                         "Node %u: Log file initializtion completed",
+                          refToNode(theData[1]));
+}
+void getTextLogFileInitCompStatus(QQQQ) {
+    BaseString::snprintf(m_text, m_text_len,
+                         "Local redo log file initialization completed:\n"
+                         "#Total files: %lu, Completed: %lu\n"
+                         "#Total MBytes: %lu, Completed: %lu",
+//                         refToNode(theData[1]),
+                         theData[2], theData[3],
+                         theData[4], theData[5]);
+}
 void getTextSingleUser(QQQQ) {
   switch (theData[1])
   {
@@ -1077,6 +1099,8 @@ const EventLoggerBase::EventRepLogLevelM
   ROW(StartLog,                LogLevel::llStartUp,    10, Logger::LL_INFO ),
   ROW(UNDORecordsExecuted,     LogLevel::llStartUp,    15, Logger::LL_INFO ),
   ROW(StartReport,             LogLevel::llStartUp,     4, Logger::LL_INFO ),
+  ROW(LogFileInitStatus,       LogLevel::llStartUp,     7, Logger::LL_INFO),
+  ROW(LogFileInitCompStatus,   LogLevel::llStartUp,     7, Logger::LL_INFO),
   
   // NODERESTART
   ROW(NR_CopyDict,             LogLevel::llNodeRestart, 8, Logger::LL_INFO ),

=== modified file 'storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp'
--- a/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2008-06-17 20:28:45 +0000
+++ b/storage/ndb/src/kernel/blocks/cmvmi/Cmvmi.cpp	2008-08-21 14:04:53 +0000
@@ -911,6 +911,10 @@ Cmvmi::execDUMP_STATE_ORD(Signal* signal
     else if (check_block(TC, val))
     {
     }
+    else if (check_block(LQH, val))
+    {
+      sendSignal(DBLQH_REF, GSN_DUMP_STATE_ORD, signal, signal->length(), JBB);
+    }
     return;
   }
 

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2008-08-07 11:52:50 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/Dblqh.hpp	2008-08-21 16:10:55 +0000
@@ -2051,7 +2051,15 @@ public:
     Uint32 stopPageNo;
     Uint32 fileNo;
   };
-  
+  //for statistic information about redo log initialization
+  Uint32 totalLogFiles;
+  Uint32 logFileInitDone;
+  Uint32 totallogMBytes;
+  Uint32 logMBytesInitDone;
+
+  Uint32 m_startup_report_frequency;
+  NDB_TICKS m_next_report_time;
+ 
 public:
   Dblqh(Block_context& ctx, Uint32 instanceNumber = 0);
   virtual ~Dblqh();
@@ -2560,7 +2568,19 @@ private:
   void send_restore_lcp(Signal * signal);
   void execRESTORE_LCP_REF(Signal* signal);
   void execRESTORE_LCP_CONF(Signal* signal);
-  
+  /**
+   * For periodic redo log file initialization status reporting 
+   * and explicit redo log file status reporting
+   */
+  /* Init at start of redo log file initialization, timers etc... */
+  void initReportStatus(Signal* signal);
+  /* Check timers for reporting at certain points */
+  void checkReportStatus(Signal* signal);
+  /* Send redo log file initialization status, invoked either periodically, or explicitly */
+  void reportStatus(Signal* signal);
+  /* redo log file initialization completed report*/
+  void logfileInitCompleteReport(Signal* signal);
+ 
   Dbtup* c_tup;
   Dbacc* c_acc;
 

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp	2008-08-15 11:01:41 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhInit.cpp	2008-08-21 14:04:53 +0000
@@ -64,6 +64,13 @@ void Dblqh::initData() 
   m_backup_ptr = RNIL;
   clogFileSize = 16;
   cmaxLogFilesInPageZero = 40;
+
+   totalLogFiles = 0;
+   logFileInitDone = 0;
+   totallogMBytes = 0;
+   logMBytesInitDone = 0;
+   m_startup_report_frequency = 0;
+
   c_active_add_frag_ptr_i = RNIL;
 }//Dblqh::initData()
 

=== modified file 'storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp'
--- a/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2008-08-11 12:48:03 +0000
+++ b/storage/ndb/src/kernel/blocks/dblqh/DblqhMain.cpp	2008-08-21 16:10:55 +0000
@@ -827,7 +827,11 @@ void Dblqh::startphase3Lab(Signal* signa
 /* ***************<< */
   cinitialStartOngoing = ZTRUE;
   ndbrequire(cnoLogFiles != 0);
-
+  if ((cstartType == NodeState::ST_INITIAL_START) ||
+      (cstartType == NodeState::ST_INITIAL_NODE_RESTART)) {
+    reportStatus(signal); 
+  }
+  initReportStatus(signal);
   for (logPartPtr.i = 0; logPartPtr.i < 4; logPartPtr.i++) {
     jam();
     ptrAss(logPartPtr, logPartRecord);
@@ -1070,6 +1074,12 @@ void Dblqh::execREAD_CONFIG_REQ(Signal* 
     ndbrequire(clogFileSize >= 4 && clogFileSize <= 1024);
   }
 
+  m_startup_report_frequency = 0;
+  ndb_mgm_get_int_parameter(p,CFG_DB_STARTUP_REPORT_FREQUENCY,
+                            &m_startup_report_frequency);
+  totalLogFiles = 4 * cnoLogFiles;
+  totallogMBytes = totalLogFiles * clogFileSize;
+
   cmaxLogFilesInPageZero = (ZPAGE_SIZE - ZPAGE_HEADER_SIZE - 128) /
     (ZFD_MBYTE_SIZE * clogFileSize);
 
@@ -13093,6 +13103,7 @@ void Dblqh::execFSCLOSECONF(Signal* sign
     return;
   case LogFileRecord::CLOSING_INIT:
     jam();
+    logFileInitDone++ ;
     closingInitLab(signal);
     return;
   case LogFileRecord::CLOSING_SR:
@@ -13350,6 +13361,7 @@ void Dblqh::execFSWRITECONF(Signal* sign
     return;
   case LogFileOperationRecord::INIT_FIRST_PAGE:
     jam();
+    logMBytesInitDone++;
     initFirstPageLab(signal);
     return;
   case LogFileOperationRecord::WRITE_GCI_ZERO:
@@ -13362,6 +13374,7 @@ void Dblqh::execFSWRITECONF(Signal* sign
     return;
   case LogFileOperationRecord::WRITE_INIT_MBYTE:
     jam();
+    logMBytesInitDone++;
     writeInitMbyteLab(signal);
     return;
   case LogFileOperationRecord::ACTIVE_WRITE_LOG:
@@ -13996,6 +14009,7 @@ CHECK_LOG_PARTS_LOOP:
       signal->theData[1] = logPartPtr.i;
       sendSignal(cownref, GSN_CONTINUEB, signal, 2, JBB);
     }//for
+    logfileInitCompleteReport(signal);
     return;
   } else {
     jam();
@@ -14421,6 +14435,7 @@ void Dblqh::writeInitMbyte(Signal* signa
   writeSinglePage(signal, logFilePtr.p->currentMbyte * ZPAGES_IN_MBYTE,
                   ZPAGE_SIZE - 1, __LINE__);
   lfoPtr.p->lfoState = LogFileOperationRecord::WRITE_INIT_MBYTE;
+  checkReportStatus(signal);
 }//Dblqh::writeInitMbyte()
 
 /* ------------------------------------------------------------------------- */
@@ -19832,6 +19847,10 @@ Dblqh::execDUMP_STATE_ORD(Signal* signal
     
     return;
   }
+  if (dumpState->args[0] == DumpStateOrd::LQHLogFileInitStatus){
+     reportStatus(signal);
+     return;
+  }
 
 #ifdef ERROR_INSERT
 #ifdef NDB_DEBUG_FULL
@@ -20424,6 +20443,53 @@ void Dblqh::writeDbgInfoPageHeader(LogPa
   logP.p->logPageWord[ZPOS_IN_WRITING]= 1;
 }
 
+void Dblqh::initReportStatus(Signal* signal){
+  NDB_TICKS current_time = NdbTick_CurrentMillisecond();
+  m_next_report_time = current_time + 
+                       ((NDB_TICKS)m_startup_report_frequency) * ((NDB_TICKS)1000);
+}
+
+void Dblqh::checkReportStatus(Signal* signal){
+  if (m_startup_report_frequency == 0)
+    return;
+
+  NDB_TICKS current_time = NdbTick_CurrentMillisecond();
+  if (current_time > m_next_report_time)
+  {
+    reportStatus(signal);
+    m_next_report_time = current_time +
+                         ((NDB_TICKS)m_startup_report_frequency) * ((NDB_TICKS)1000);
+  }
+}
+
+void Dblqh::reportStatus(Signal* signal){
+  const int signal_length = 6;
+
+  signal->theData[0] = NDB_LE_LogFileInitStatus;
+  signal->theData[1] = reference();
+  for (int i = 2; i < signal_length; i++)
+    signal->theData[i] = 0;
+  if (getNodeState().startLevel < NodeState::SL_STARTED){
+    signal->theData[2] = totalLogFiles;
+    signal->theData[3] = logFileInitDone;
+    signal->theData[4] = totallogMBytes;
+    signal->theData[5] = logMBytesInitDone;
+  }
+  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, signal_length, JBB);
+}
+
+void Dblqh::logfileInitCompleteReport(Signal* signal){
+  const int signal_length = 6;
+
+  signal->theData[0] = NDB_LE_LogFileInitCompStatus;
+  signal->theData[1] = reference();
+  signal->theData[2] = totalLogFiles;
+  signal->theData[3] = logFileInitDone;
+  signal->theData[4] = totallogMBytes;
+  signal->theData[5] = logMBytesInitDone;
+  sendSignal(CMVMI_REF, GSN_EVENT_REP, signal, signal_length, JBB);
+}
+
 #if defined ERROR_INSERT
 void
 Dblqh::TRACE_OP_DUMP(const Dblqh::TcConnectionrec* regTcPtr, const char * pos)
@@ -20456,3 +20522,5 @@ Dblqh::TRACE_OP_DUMP(const Dblqh::TcConn
   (* traceopout) << endl;
 }
 #endif
+
+

=== modified file 'storage/ndb/src/mgmapi/ndb_logevent.cpp'
--- a/storage/ndb/src/mgmapi/ndb_logevent.cpp	2008-08-21 06:32:09 +0000
+++ b/storage/ndb/src/mgmapi/ndb_logevent.cpp	2008-08-21 14:19:17 +0000
@@ -371,6 +371,13 @@ struct Ndb_logevent_body_row ndb_logeven
 
   ROW( SingleUser,          "type",	     1, type),
   ROW( SingleUser,          "node_id",	     2, node_id),
+
+  ROW( LogFileInitStatus,   "node_id",       1, node_id ),
+  ROW( LogFileInitStatus,   "total_files",   2, total_files),
+  ROW( LogFileInitStatus,   "file_done",     3, file_done),
+  ROW( LogFileInitStatus,   "total_mbytes",  4, total_mbytes),
+  ROW( LogFileInitStatus,   "mbytes_done",   5, mbytes_done),
+
   { NDB_LE_ILLEGAL_TYPE, 0, 0, 0, 0, 0}
 };
 

=== modified file 'storage/ndb/src/mgmsrv/ConfigInfo.cpp'
--- a/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2008-08-21 06:31:25 +0000
+++ b/storage/ndb/src/mgmsrv/ConfigInfo.cpp	2008-08-21 14:19:17 +0000
@@ -1499,7 +1499,19 @@ const ConfigInfo::ParamInfo ConfigInfo::
     "0",
     "0",
     STR_VALUE(MAX_INT_RNIL) },
-  
+
+   {
+    CFG_DB_STARTUP_REPORT_FREQUENCY,
+    "StartupStatusReportFrequency",
+    DB_TOKEN,
+    "Frequency of various status reports during startup in seconds",
+    ConfigInfo::CI_USED,
+    false,
+    ConfigInfo::CI_INT,
+    "0",
+    "0",
+    STR_VALUE(MAX_INT_RNIL) },
+ 
   {
     CFG_DB_O_DIRECT,
     "ODirect",

Thread
bzr push into mysql-5.1 branch (stewart:2787 to 2788) Stewart Smith21 Aug