List:Internals« Previous MessageNext Message »
From:tomas Date:June 2 2005 8:23pm
Subject:bk commit into 5.1 tree (tomas:1.1925)
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.1925 05/06/02 20:23:24 tomas@stripped +10 -0
  fixed wrong usage of bitmap_init

  storage/ndb/test/ndbapi/test_event.cpp
    1.19 05/06/02 20:23:18 tomas@stripped +4 -5
    fixed wrong usage of bitmap_init

  storage/ndb/src/ndbapi/Ndb.cpp
    1.66 05/06/02 20:23:18 tomas@stripped +1 -2
    fixed wrong usage of bitmap_init

  storage/ndb/include/ndbapi/Ndb.hpp
    1.54 05/06/02 20:23:18 tomas@stripped +1 -4
    fixed wrong usage of bitmap_init

  sql/slave.cc
    1.253 05/06/02 20:23:18 tomas@stripped +1 -1
    fixed wrong usage of bitmap_init

  sql/opt_range.cc
    1.165 05/06/02 20:23:18 tomas@stripped +3 -3
    fixed wrong usage of bitmap_init

  sql/mysqld.cc
    1.474 05/06/02 20:23:18 tomas@stripped +1 -1
    fixed wrong usage of bitmap_init

  sql/log_event.h
    1.124 05/06/02 20:23:18 tomas@stripped +1 -1
    fixed wrong usage of bitmap_init

  sql/log_event.cc
    1.202 05/06/02 20:23:17 tomas@stripped +9 -10
    fixed wrong usage of bitmap_init

  sql/handler.cc
    1.177 05/06/02 20:23:17 tomas@stripped +22 -13
    fixed wrong usage of bitmap_init

  sql/ha_ndbcluster.cc
    1.270 05/06/02 20:23:17 tomas@stripped +11 -13
    fixed wrong usage of bitmap_init

# 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.176/sql/handler.cc	2005-06-02 19:19:52 +02:00
+++ 1.177/sql/handler.cc	2005-06-02 20:23:17 +02:00
@@ -2591,15 +2591,18 @@
   {
     MY_BITMAP cols;
     // Potential buffer for the bitmap
-    unsigned char bitbuf[BITMAP_STACKBUF_SIZE];
-    size_t const byte_count = (table->s->fields + 7) / 8;
-    bitmap_init(&cols, 
-                byte_count <= sizeof(bitbuf) ? bitbuf : NULL, 
-                byte_count, 
+    uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
+    uint n_fields= table->s->fields;
+    my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
+    bitmap_init(&cols,
+                use_bitbuf ? bitbuf : NULL, 
+                n_fields, 
                 false);
     bitmap_set_all(&cols);
     current_thd->write_row(table, table->file->has_transactions(), 
                            &cols, table->s->fields, buf);
+    if (!use_bitbuf)
+      bitmap_free(&cols);
   }
 #endif
   DBUG_PRINT("exit", ("error=%d", 0));
@@ -2633,16 +2636,19 @@
   {
     MY_BITMAP cols;
     // Potential buffer for the bitmap
-    unsigned char bitbuf[BITMAP_STACKBUF_SIZE];
-    size_t const byte_count = (table->s->fields + 7) / 8;
+    uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
+    uint n_fields= table->s->fields;
+    my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
     bitmap_init(&cols, 
-                byte_count <= sizeof(bitbuf) ? bitbuf : NULL, 
-                byte_count, 
+                use_bitbuf ? bitbuf : NULL, 
+                n_fields, 
                 false);
     bitmap_set_all(&cols);
     current_thd->update_row(table, table->file->has_transactions(), 
                             &cols, table->s->fields,
                             old_data, new_data);
+    if (!use_bitbuf)
+      bitmap_free(&cols);
   }
 #endif
   DBUG_PRINT("exit", ("error=%d", 0));
@@ -2676,15 +2682,18 @@
   {
     MY_BITMAP cols;
     // Potential buffer on the stack for the bitmap
-    unsigned char bitbuf[BITMAP_STACKBUF_SIZE];
-    size_t const byte_count = (table->s->fields + 7) / 8;
+    uint32 bitbuf[BITMAP_STACKBUF_SIZE/sizeof(uint32)];
+    uint n_fields= table->s->fields;
+    my_bool use_bitbuf= n_fields <= sizeof(bitbuf)*8;
     bitmap_init(&cols, 
-                byte_count <= sizeof(bitbuf) ? bitbuf : NULL, 
-                byte_count, 
+                use_bitbuf ? bitbuf : NULL, 
+                n_fields, 
                 false);
     bitmap_set_all(&cols);
     current_thd->delete_row(table, table->file->has_transactions(),
                             &cols, table->s->fields, buf);
+    if (!use_bitbuf)
+      bitmap_free(&cols);
   }
 #endif
   DBUG_PRINT("exit", ("error=%d", 0));

--- 1.201/sql/log_event.cc	2005-06-02 19:17:28 +02:00
+++ 1.202/sql/log_event.cc	2005-06-02 20:23:17 +02:00
@@ -4889,10 +4889,10 @@
   DBUG_ENTER("Rows_log_event::Rows_log_event(THD*, ...)");
   DBUG_PRINT("enter", ("cols->bitmap_size=%lu", cols->bitmap_size));
   bitmap_init(&m_cols, 
-              cols->bitmap_size < sizeof(m_bitbuf) ? m_bitbuf : NULL,
+              cols->bitmap_size <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL,
               cols->bitmap_size, 
               false);
-  memcpy(m_cols.bitmap, cols->bitmap, cols->bitmap_size);
+  memcpy(m_cols.bitmap, cols->bitmap, (cols->bitmap_size+7)/8);
   DBUG_VOID_RETURN;
 }
 #endif
@@ -4924,8 +4924,8 @@
   byte const* const ptr_width = var_begin;
   m_width = *reinterpret_cast<unsigned char const*>(ptr_width);
   DBUG_PRINT("info",("m_width=%u", m_width));
-
-  const char* const ptr_rows_data = var_begin + ((m_width + 7) / 8) + 1;
+  const uint byte_count= (m_width + 7) / 8;
+  const char* const ptr_rows_data = var_begin + byte_count + 1;
 
   size_t const data_size = event_len - (ptr_rows_data - buf);
   DBUG_PRINT("info",("data_size=%lu", data_size));
@@ -4933,10 +4933,9 @@
   m_rows_buf = my_malloc(data_size, MYF(0));
   if (m_rows_buf) 
   {
-    size_t const byte_count = (m_width + 7) / 8;
-    bitmap_init(&m_cols, 
-                byte_count <= sizeof(m_bitbuf) ? m_bitbuf : NULL, 
-                byte_count, 
+    bitmap_init(&m_cols,
+                m_width <= sizeof(m_bitbuf)*8 ? m_bitbuf : NULL, 
+                m_width,
                 false);
     memcpy(m_cols.bitmap, ptr_width + 1, byte_count);
 
@@ -5213,12 +5212,12 @@
   byte const sbuf[] = { m_width }; 
   ptrdiff_t const data_size = m_rows_cur - m_rows_buf;
   DBUG_PRINT("info", ("writing %d bytes", 
-		      sizeof(sbuf) + m_cols.bitmap_size + data_size));
+		      sizeof(sbuf) + (m_cols.bitmap_size+7)/8 + data_size));
   DBUG_PRINT("info", ("*m_cols.bitmap=0x%x", *m_cols.bitmap & 0xFF));
   DBUG_ASSERT(m_width < 128);
   DBUG_DUMP("rows_data", m_rows_buf, data_size);
   DBUG_RETURN(my_b_safe_write(file, sbuf, sizeof(sbuf)) || 
-              my_b_safe_write(file, reinterpret_cast<byte*>(m_cols.bitmap),
m_cols.bitmap_size) || 
+              my_b_safe_write(file, reinterpret_cast<byte*>(m_cols.bitmap),
(m_cols.bitmap_size+7)/8) || 
               my_b_safe_write(file, m_rows_buf, data_size));
 }
 

--- 1.123/sql/log_event.h	2005-06-01 01:25:29 +02:00
+++ 1.124/sql/log_event.h	2005-06-02 20:23:18 +02:00
@@ -1853,7 +1853,7 @@
   ulong       m_table_id;	// Table ID
   MY_BITMAP   m_cols;		// Bitmap denoting columns available
   size_t      m_width;          // The width of the columns bitmap
-  uchar       m_bitbuf[16];     // Bit buffer in the same memory as the class
+  uint32      m_bitbuf[128/(sizeof(uint32)*8)]; // Bit buffer in the same memory as the
class
 
   ulong m_thread_id;		// Thread ID
 

--- 1.473/sql/mysqld.cc	2005-06-02 19:17:28 +02:00
+++ 1.474/sql/mysqld.cc	2005-06-02 20:23:18 +02:00
@@ -2599,7 +2599,7 @@
   else
     sys_init_slave.value=my_strdup("",MYF(0));
 
-  if (use_temp_pool && bitmap_init(&temp_pool,0,1024/8,1))
+  if (use_temp_pool && bitmap_init(&temp_pool,0,1024,1))
     return 1;
   if (my_dbopt_init())
     return 1;

--- 1.164/sql/opt_range.cc	2005-06-02 19:20:43 +02:00
+++ 1.165/sql/opt_range.cc	2005-06-02 20:23:18 +02:00
@@ -1570,7 +1570,7 @@
   uint pk;
   if (!(tmp= (uint32*)alloc_root(param->mem_root,
     bytes_word_aligned(param->fields_bitmap_size))) ||
-      bitmap_init(&param->needed_fields, tmp, param->fields_bitmap_size,
+      bitmap_init(&param->needed_fields, tmp, param->fields_bitmap_size*8,
                   FALSE))
     return 1;
 
@@ -2328,7 +2328,7 @@
     DBUG_RETURN(NULL);
 
   if (bitmap_init(&ror_scan->covered_fields, bitmap_buf,
-                  param->fields_bitmap_size, FALSE))
+                  param->fields_bitmap_size*8, FALSE))
     DBUG_RETURN(NULL);
   bitmap_clear_all(&ror_scan->covered_fields);
 
@@ -2447,7 +2447,7 @@
   if (!(buf= (uint32*)alloc_root(param->mem_root,
                              bytes_word_aligned(param->fields_bitmap_size))))
     return NULL;
-  if (bitmap_init(&info->covered_fields, buf, param->fields_bitmap_size,
+  if (bitmap_init(&info->covered_fields, buf, param->fields_bitmap_size*8,
                   FALSE))
     return NULL;
   info->is_covering= FALSE;

--- 1.252/sql/slave.cc	2005-06-02 19:17:29 +02:00
+++ 1.253/sql/slave.cc	2005-06-02 20:23:18 +02:00
@@ -423,7 +423,7 @@
 void init_slave_skip_errors(const char* arg)
 {
   const char *p;
-  if (bitmap_init(&slave_error_mask,0,(MAX_SLAVE_ERROR + 7) / 8,0))
+  if (bitmap_init(&slave_error_mask,0,MAX_SLAVE_ERROR,0))
   {
     fprintf(stderr, "Badly out of memory, please check your system status\n");
     exit(1);

--- 1.53/storage/ndb/include/ndbapi/Ndb.hpp	2005-06-01 17:24:33 +02:00
+++ 1.54/storage/ndb/include/ndbapi/Ndb.hpp	2005-06-02 20:23:18 +02:00
@@ -1206,13 +1206,10 @@
    *
    * @param eventName
    *        unique identifier of the event
-   * @param bufferLength
-   *        circular buffer size for storing event data
    *
    * @return Object representing an event, NULL on failure
    */
-  NdbEventOperation* createEventOperation(const char* eventName,
-					  const int bufferLength);
+  NdbEventOperation* createEventOperation(const char* eventName);
   /**
    * Drop a subscription to an event
    *

--- 1.65/storage/ndb/src/ndbapi/Ndb.cpp	2005-06-01 17:24:34 +02:00
+++ 1.66/storage/ndb/src/ndbapi/Ndb.cpp	2005-06-02 20:23:18 +02:00
@@ -1199,8 +1199,7 @@
 }
 
 // ToDo set event buffer size
-NdbEventOperation* Ndb::createEventOperation(const char* eventName,
-					     const int bufferLength)
+NdbEventOperation* Ndb::createEventOperation(const char* eventName)
 {
   DBUG_ENTER("Ndb::createEventOperation");
   NdbEventOperation* tOp= theEventBuffer->createEventOperation(eventName,

--- 1.18/storage/ndb/test/ndbapi/test_event.cpp	2005-06-01 17:24:34 +02:00
+++ 1.19/storage/ndb/test/ndbapi/test_event.cpp	2005-06-02 20:23:18 +02:00
@@ -164,7 +164,7 @@
   Uint32 noEventColumnName = tab.getNoOfColumns();
 
   g_info << function << "create EventOperation\n";
-  pOp = pNdb->createEventOperation(eventName, 100);
+  pOp = pNdb->createEventOperation(eventName);
   if ( pOp == NULL ) {
     g_err << function << "Event operation creation failed\n";
     return NDBT_FAILED;
@@ -362,7 +362,7 @@
     }
 #else
     g_info << "create EventOperation\n";
-    pOp = pNdb->createEventOperation(eventName, 100);
+    pOp = pNdb->createEventOperation(eventName);
     if ( pOp == NULL ) {
       g_err << "Event operation creation failed\n";
       return NDBT_FAILED;
@@ -531,8 +531,7 @@
   
   sprintf(buf, "%s_EVENT", table->getName());
   NdbEventOperation *pOp, *pCreate = 0;
-  pCreate = pOp = GETNDB(step)->createEventOperation(buf, 
-						     10*ctx->getNumRecords());
+  pCreate = pOp = GETNDB(step)->createEventOperation(buf);
   if ( pOp == NULL ) {
     g_err << "Event operation creation failed on %s" << buf << endl;
     DBUG_RETURN(NDBT_FAILED);
@@ -1177,7 +1176,7 @@
   {
     char buf[1024];
     sprintf(buf, "%s_EVENT", pTabs[i]->getName());
-    NdbEventOperation *pOp= ndb->createEventOperation(buf, 1000);
+    NdbEventOperation *pOp= ndb->createEventOperation(buf);
     if ( pOp == NULL )
     {
       DBUG_RETURN(NDBT_FAILED);

--- 1.269/sql/ha_ndbcluster.cc	2005-06-02 19:17:27 +02:00
+++ 1.270/sql/ha_ndbcluster.cc	2005-06-02 20:23:17 +02:00
@@ -8704,7 +8704,7 @@
     DBUG_RETURN(-1);
   }
 
-  NdbEventOperation *op= injector_ndb->createEventOperation(event_name,100);
+  NdbEventOperation *op= injector_ndb->createEventOperation(event_name);
   if(!op)
   {
     pthread_mutex_unlock(&injector_mutex);
@@ -8985,11 +8985,10 @@
   uint n_fields= table_s->fields;
   MY_BITMAP b;
   // Potential buffer for the bitmap
-  unsigned char bitbuf[16];
-  size_t const byte_count = (n_fields + 7) / 8;
+  uint32 bitbuf[128/(sizeof(uint32)*8)];
   bitmap_init(&b, 
-	      byte_count <= sizeof(bitbuf) ? bitbuf : NULL, 
-	      byte_count, 
+	      n_fields <= sizeof(bitbuf)*8 ? bitbuf : NULL, 
+	      n_fields, 
 	      false);
   bitmap_set_all(&b);
 
@@ -9232,7 +9231,9 @@
     thd->set_time();
     
     // wait for event or 1000 ms
-    int res= ndb->pollEvents(1000,&ndb_latest_received_binlog_epoch);
+    Uint64 gci;
+    int res= ndb->pollEvents(1000,&gci);
+    ndb_latest_received_binlog_epoch= gci;
 
     if ( (abort_loop || do_ndbcluster_binlog_close_connection) &&
 	 ndb_latest_handled_binlog_epoch >= g_latest_trans_gci )
@@ -9274,17 +9275,14 @@
 	}
 	bzero((char*) &row,sizeof(row));
 	injector::transaction trans= inj->new_trans(thd);
-        Uint64 gci= pOp->getGCI();
+        gci= pOp->getGCI();
 	if (apply_status_share)
 	{
 	  TABLE *table= apply_status_share->table;
           MY_BITMAP b;
-          unsigned char bitbuf[16]; // Potential buffer for the bitmap
-          size_t const byte_count = (table->s->fields + 7) / 8;
-          bitmap_init(&b, 
-                      byte_count <= sizeof(bitbuf) ? bitbuf : NULL, 
-                      byte_count, 
-                      false);
+	  uint32 bitbuf;
+	  DBUG_ASSERT(table->s->fields <= sizeof(bitbuf)*8);
+	  bitmap_init(&b, &bitbuf, table->s->fields, false);
           bitmap_set_all(&b);
 	  table->field[0]->store((longlong)::server_id);
 	  table->field[1]->store((longlong)gci);
Thread
bk commit into 5.1 tree (tomas:1.1925)tomas2 Jun