List:Internals« Previous MessageNext Message »
From:tomas Date:May 31 2005 11:52pm
Subject:bk commit into 5.1 tree (tomas:1.1902)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of tomas. When tomas 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.1902 05/06/01 01:52:16 tomas@stripped +12 -0
  added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
  extended EventBufferUsage event to include gci/epoch status

  storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp
    1.32 05/06/01 01:52:00 tomas@stripped +4 -1
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp
    1.64 05/06/01 01:52:00 tomas@stripped +20 -5
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  storage/ndb/src/ndbapi/Ndb.cpp
    1.63 05/06/01 01:52:00 tomas@stripped +10 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  storage/ndb/src/mgmapi/ndb_logevent.cpp
    1.6 05/06/01 01:52:00 tomas@stripped +7 -3
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  storage/ndb/src/common/debugger/EventLogger.cpp
    1.26 05/06/01 01:52:00 tomas@stripped +5 -2
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  storage/ndb/include/ndbapi/Ndb.hpp
    1.52 05/06/01 01:51:59 tomas@stripped +2 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  storage/ndb/include/mgmapi/ndb_logevent.h
    1.6 05/06/01 01:51:59 tomas@stripped +4 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  sql/set_var.cc
    1.109 05/06/01 01:51:59 tomas@stripped +12 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  sql/mysqld.cc
    1.466 05/06/01 01:51:59 tomas@stripped +12 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  sql/log.cc
    1.170 05/06/01 01:51:59 tomas@stripped +1 -1
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  sql/ha_ndbcluster.h
    1.97 05/06/01 01:51:59 tomas@stripped +2 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

  sql/ha_ndbcluster.cc
    1.262 05/06/01 01:51:58 tomas@stripped +5 -0
    added control/thresholds for reporting binlog apply status to the cluster log/ndb log events
    extended EventBufferUsage event to include gci/epoch status

# 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:	tomas
# Host:	poseidon.ndb.mysql.com
# Root:	/home/tomas/mysql-5.1-wl2325

--- 1.169/sql/log.cc	2005-05-26 16:22:15 +02:00
+++ 1.170/sql/log.cc	2005-06-01 01:51:59 +02:00
@@ -76,7 +76,7 @@
 static int binlog_close_connection(THD *thd)
 {
   IO_CACHE *trans_log= (IO_CACHE*)thd->ha_data[binlog_hton.slot];
-  DBUG_ASSERT(mysql_bin_log.is_open() && !my_b_tell(trans_log));
+//  DBUG_ASSERT(mysql_bin_log.is_open() && !my_b_tell(trans_log));
   close_cached_file(trans_log);
   my_free((gptr)trans_log, MYF(0));
   return 0;

--- 1.465/sql/mysqld.cc	2005-05-25 10:09:12 +02:00
+++ 1.466/sql/mysqld.cc	2005-06-01 01:51:59 +02:00
@@ -4207,6 +4207,8 @@
   OPT_NDB_FORCE_SEND, OPT_NDB_AUTOINCREMENT_PREFETCH_SZ,
   OPT_NDB_SHM, OPT_NDB_OPTIMIZED_NODE_SELECTION, OPT_NDB_CACHE_CHECK_TIME,
   OPT_NDB_MGMD, OPT_NDB_NODEID,
+  OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
+  OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
   OPT_SKIP_SAFEMALLOC,
   OPT_TEMP_POOL, OPT_TX_ISOLATION, OPT_COMPLETION_TYPE,
   OPT_SKIP_STACK_TRACE, OPT_SKIP_SYMLINKS,
@@ -4791,6 +4793,16 @@
    (gptr*) &global_system_variables.ndb_force_send,
    (gptr*) &global_system_variables.ndb_force_send,
    0, GET_BOOL, OPT_ARG, 1, 0, 0, 0, 0, 0},
+  {"ndb-report-thresh-binlog-epoch-slip", OPT_NDB_REPORT_THRESH_BINLOG_EPOCH_SLIP,
+   "Threshold on number of epochs to be behind before reporting binlog status.",
+   (gptr*) &ndb_report_thresh_binlog_epoch_slip,
+   (gptr*) &ndb_report_thresh_binlog_epoch_slip,
+   0, GET_ULONG, REQUIRED_ARG, 3, 0, 256, 0, 0, 0},
+  {"ndb-report-thresh-binlog-mem-usage", OPT_NDB_REPORT_THRESH_BINLOG_MEM_USAGE,
+   "Threshold on percentage of being free before reporting binlog status.",
+   (gptr*) &ndb_report_thresh_binlog_mem_usage,
+   (gptr*) &ndb_report_thresh_binlog_mem_usage,
+   0, GET_ULONG, REQUIRED_ARG, 10, 0, 100, 0, 0, 0},
   {"ndb-use-exact-count", OPT_NDB_USE_EXACT_COUNT,
    "Use exact records count during query planning and for fast "
    "select count(*), disable for faster queries.",

--- 1.51/storage/ndb/include/ndbapi/Ndb.hpp	2005-05-31 17:30:13 +02:00
+++ 1.52/storage/ndb/include/ndbapi/Ndb.hpp	2005-06-01 01:51:59 +02:00
@@ -1250,6 +1250,8 @@
   void setWaitGCI(Uint64 gci);
   Uint64 getLatestGCI();
   void forceGCP();
+  void setReportThreshEventGCISlip(unsigned thresh);
+  void setReportThreshEventFreeMem(unsigned thresh);
 #endif
 
   /** @} *********************************************************************/

--- 1.25/storage/ndb/src/common/debugger/EventLogger.cpp	2005-05-26 16:22:16 +02:00
+++ 1.26/storage/ndb/src/common/debugger/EventLogger.cpp	2005-06-01 01:52:00 +02:00
@@ -571,10 +571,13 @@
 }
 void getTextEventBufferUsage(QQQQ) {
   BaseString::snprintf(m_text, m_text_len,
-		       "Event buffer usage: used=%d(%d\%) alloc=%d(%d\%) max=%d",
+		       "Event buffer usage: used=%d(%d%) alloc=%d(%d%) max=%d "
+		       "apply_gci=%lld latest_gci=%lld",
 		       theData[1], theData[2] ? (theData[1]*100)/theData[2] : 0,
 		       theData[2], theData[3] ? (theData[2]*100)/theData[3] : 0,
-		       theData[3]);
+		       theData[3],
+		       theData[4]+(((Uint64)theData[5])<<32),
+		       theData[6]+(((Uint64)theData[7])<<32));
 }
 void getTextWarningEvent(QQQQ) {
   BaseString::snprintf(m_text, m_text_len, (char *)&theData[1]);

--- 1.62/storage/ndb/src/ndbapi/Ndb.cpp	2005-05-31 17:30:13 +02:00
+++ 1.63/storage/ndb/src/ndbapi/Ndb.cpp	2005-06-01 01:52:00 +02:00
@@ -1290,6 +1290,16 @@
   return theEventBuffer->getLatestGCI();
 }
 
+void Ndb::setReportThreshEventGCISlip(unsigned thresh)
+{
+  theEventBuffer->m_gci_slip_thresh= thresh;
+}
+
+void Ndb::setReportThreshEventFreeMem(unsigned thresh)
+{
+  theEventBuffer->m_free_thresh= thresh;
+}
+
 #ifdef VM_TRACE
 #include <NdbMutex.h>
 extern NdbMutex *ndb_print_state_mutex;

--- 1.63/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2005-05-31 17:31:13 +02:00
+++ 1.64/storage/ndb/src/ndbapi/NdbEventOperationImpl.cpp	2005-06-01 01:52:00 +02:00
@@ -528,7 +528,8 @@
   m_latestGCI(0),
   m_waitGCI(0),
   m_total_alloc(0),
-  m_total_used(0),
+  m_free_thresh(10),
+  m_gci_slip_thresh(3),
   m_dropped_ev_op(0)
 {
 #ifdef VM_TRACE
@@ -839,6 +840,7 @@
   {
     if(likely(gci == m_latestGCI + 1 || m_latestGCI == 0))
     {
+      m_latestGCI = m_complete_data.m_gci = gci; // before reportUsage
       if(!bucket->m_data.is_empty())
       {
 #ifdef VM_TRACE
@@ -850,7 +852,6 @@
       bzero(bucket, sizeof(Gci_container));
       bucket->m_gci = gci + ACTIVE_GCI_DIRECTORY_SIZE;
       bucket->m_gcp_complete_rep_count = m_system_nodes;
-      m_latestGCI = m_complete_data.m_gci = gci;
       if(unlikely(m_latest_complete_GCI > gci))
       {
 	complete_outof_order_gcis();
@@ -1302,14 +1303,28 @@
 void
 NdbEventBuffer::reportUsage()
 {
-  if ((m_free_data_sz*100)/m_total_alloc < 10)
+  EventBufData *apply_buf= m_available_data.m_head;
+  Uint64 apply_gci, latest_gci= m_latestGCI;
+  if (apply_buf == 0)
+    apply_buf= m_complete_data.m_data.m_head;
+  if (apply_buf)
+    apply_gci= apply_buf->sdata->gci;
+  else
+    apply_gci= latest_gci;
+
+  if (m_free_data_sz*m_free_thresh < m_total_alloc ||
+      latest_gci-apply_gci >=  m_gci_slip_thresh)
   {
-    Uint32 data[4];
+    Uint32 data[8];
     data[0]= NDB_LE_EventBufferUsage;
     data[1]= m_total_alloc-m_free_data_sz;
     data[2]= m_total_alloc;
     data[3]= 0;
-    m_ndb->theImpl->send_event_report(data,4);
+    data[4]= apply_gci & ~(Uint32)0;
+    data[5]= apply_gci >> 32;
+    data[6]= latest_gci & ~(Uint32)0;
+    data[7]= latest_gci >> 32;
+    m_ndb->theImpl->send_event_report(data,8);
 #ifdef VM_TRACE
     assert(m_total_alloc >= m_free_data_sz);
 #endif

--- 1.31/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp	2005-05-31 17:30:13 +02:00
+++ 1.32/storage/ndb/src/ndbapi/NdbEventOperationImpl.hpp	2005-06-01 01:52:00 +02:00
@@ -266,7 +266,10 @@
   EventBufData_list m_used_data;
 
   unsigned m_total_alloc; // total allocated memory
-  unsigned m_total_used;  // used allocated memory
+
+  // threshholds to report status
+  unsigned m_free_thresh;
+  unsigned m_gci_slip_thresh;
 
   NdbError m_error;
 private:

--- 1.261/sql/ha_ndbcluster.cc	2005-05-31 02:54:58 +02:00
+++ 1.262/sql/ha_ndbcluster.cc	2005-06-01 01:51:58 +02:00
@@ -159,6 +159,8 @@
 pthread_cond_t COND_ndb_util_thread;
 extern "C" pthread_handler_decl(ndb_util_thread_func, arg);
 ulong ndb_cache_check_time;
+ulong ndb_report_thresh_binlog_epoch_slip;
+ulong ndb_report_thresh_binlog_mem_usage;
 
 /*
   Dummy buffer to read zero pack_length fields
@@ -9342,6 +9344,9 @@
       Binlog_index_row row;
       while ((pOp= ndb->nextEvent(ndb_latest_received_binlog_epoch)) != NULL)
       {
+	ndb->setReportThreshEventGCISlip(ndb_report_thresh_binlog_epoch_slip);
+	ndb->setReportThreshEventFreeMem(ndb_report_thresh_binlog_mem_usage);
+
         assert(pOp->getGCI() <= ndb_latest_received_binlog_epoch);
 	if (!apply_status_share)
 	{

--- 1.96/sql/ha_ndbcluster.h	2005-05-09 23:17:23 +02:00
+++ 1.97/sql/ha_ndbcluster.h	2005-06-01 01:51:59 +02:00
@@ -41,6 +41,8 @@
 // connectstring to cluster if given by mysqld
 extern const char *ndbcluster_connectstring;
 extern ulong ndb_cache_check_time;
+extern ulong ndb_report_thresh_binlog_epoch_slip;
+extern ulong ndb_report_thresh_binlog_mem_usage;
 
 typedef enum ndb_index_type {
   UNDEFINED_INDEX = 0,

--- 1.108/sql/set_var.cc	2005-05-09 23:17:24 +02:00
+++ 1.109/sql/set_var.cc	2005-06-01 01:51:59 +02:00
@@ -425,6 +425,12 @@
 				  &SV::ndb_autoincrement_prefetch_sz);
 sys_var_thd_bool
 sys_ndb_force_send("ndb_force_send", &SV::ndb_force_send);
+sys_var_long_ptr
+sys_ndb_report_thresh_binlog_epoch_slip("ndb_report_thresh_binlog_epoch_slip",
+					&ndb_report_thresh_binlog_epoch_slip);
+sys_var_long_ptr
+sys_ndb_report_thresh_binlog_mem_usage("ndb_report_thresh_binlog_mem_usage",
+				       &ndb_report_thresh_binlog_mem_usage);
 sys_var_thd_bool
 sys_ndb_use_exact_count("ndb_use_exact_count", &SV::ndb_use_exact_count);
 sys_var_thd_bool
@@ -715,6 +721,8 @@
   &sys_ndb_autoincrement_prefetch_sz,
   &sys_ndb_cache_check_time,
   &sys_ndb_force_send,
+  &sys_ndb_report_thresh_binlog_epoch_slip,
+  &sys_ndb_report_thresh_binlog_mem_usage,
   &sys_ndb_use_exact_count,
   &sys_ndb_use_transactions,
 #endif
@@ -901,6 +909,10 @@
   {sys_ndb_autoincrement_prefetch_sz.name,
    (char*) &sys_ndb_autoincrement_prefetch_sz,                      SHOW_SYS},
   {sys_ndb_force_send.name,   (char*) &sys_ndb_force_send,          SHOW_SYS},
+  {sys_ndb_report_thresh_binlog_epoch_slip.name,
+   (char*) &sys_ndb_report_thresh_binlog_epoch_slip,                SHOW_SYS},
+  {sys_ndb_report_thresh_binlog_mem_usage.name,
+   (char*) &sys_ndb_report_thresh_binlog_mem_usage,                 SHOW_SYS},
   {sys_ndb_use_exact_count.name,(char*) &sys_ndb_use_exact_count,   SHOW_SYS},
   {sys_ndb_use_transactions.name,(char*) &sys_ndb_use_transactions, SHOW_SYS},
   {sys_ndb_cache_check_time.name,(char*) &sys_ndb_cache_check_time, SHOW_SYS},

--- 1.5/storage/ndb/include/mgmapi/ndb_logevent.h	2005-05-26 16:22:16 +02:00
+++ 1.6/storage/ndb/include/mgmapi/ndb_logevent.h	2005-06-01 01:51:59 +02:00
@@ -574,6 +574,10 @@
 	unsigned usage;
 	unsigned alloc;
 	unsigned max;
+	unsigned apply_gci_l;
+	unsigned apply_gci_h;
+	unsigned latest_gci_l;
+	unsigned latest_gci_h;
       } EventBufferUsage;
 
       /** Log event data for @ref NDB_LE_BackupStarted */

--- 1.5/storage/ndb/src/mgmapi/ndb_logevent.cpp	2005-05-26 16:22:16 +02:00
+++ 1.6/storage/ndb/src/mgmapi/ndb_logevent.cpp	2005-06-01 01:52:00 +02:00
@@ -269,9 +269,13 @@
 	/* TODO */
 //  ROW( InfoEvent),
 
-  ROW( EventBufferUsage, "usage", 1, usage),
-  ROW( EventBufferUsage, "alloc", 2, alloc),
-  ROW( EventBufferUsage, "max",   3, max),
+  ROW( EventBufferUsage, "usage",        1, usage),
+  ROW( EventBufferUsage, "alloc",        2, alloc),
+  ROW( EventBufferUsage, "max",          3, max),
+  ROW( EventBufferUsage, "apply_gci_l",  4, apply_gci_l),
+  ROW( EventBufferUsage, "apply_gci_h",  5, apply_gci_h),
+  ROW( EventBufferUsage, "latest_gci_l", 6, latest_gci_l),
+  ROW( EventBufferUsage, "latest_gci_h", 7, latest_gci_h),
 
   // Backup
   ROW_FN( BackupStarted,    "starting_node", 1, starting_node, ref_to_node),
Thread
bk commit into 5.1 tree (tomas:1.1902)tomas1 Jun