List:Internals« Previous MessageNext Message »
From:tomas Date:May 24 2005 1:03pm
Subject:bk commit into 5.1 tree (tomas:1.1872)
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.1872 05/05/24 15:02:54 tomas@stripped +3 -0
      optimized unpack_row
      changed to use List<>

  sql/rpl_tblmap.h
    1.6 05/05/24 15:02:48 tomas@stripped +1 -2
    changed to use List<>

  sql/rpl_tblmap.cc
    1.8 05/05/24 15:02:48 tomas@stripped +15 -38
    changed to use List<>

  sql/log_event.cc
    1.194 05/05/24 15:02:48 tomas@stripped +14 -10
    optimized unpack_row

# 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/wl2325-test

--- 1.193/sql/log_event.cc	2005-05-11 09:08:54 +02:00
+++ 1.194/sql/log_event.cc	2005-05-24 15:02:48 +02:00
@@ -5007,18 +5007,22 @@
   // This assertion actually checks that there is at least as many
   // columns on the slave as on the master.
   DBUG_ASSERT(table->s->fields >= cols.size());
-  char const* ptr = row;
-  memcpy(record, ptr, table->s->null_bytes);
-  ptr += table->s->null_bytes;
-  for (size_t i = 0 ; i < table->s->fields ; ++i) 
+  Field **p_field= table->field, *field= *p_field;
+  int n_null_bytes= table->s->null_bytes;
+  ptrdiff_t const offset= record - (byte*) table->record[0];
+
+  memcpy(record, row, n_null_bytes);
+  char const* ptr= row+n_null_bytes;
+
+  for (size_t i= 0 ; field ; i++, p_field++, field= *p_field)
   {
-    if (cols.get_bit(i)) {
-      int const offset = table->field[i]->offset();
+    if (cols.get_bit(i))
+    {
       DBUG_PRINT("info", ("Unpacking length %d field '%s' from %p to %p + %d",
-			  table->field[i]->field_length, 
-			  table->field[i]->field_name,
-			  ptr, record, offset));    
-      ptr = table->field[i]->unpack(record + offset, ptr);
+			  field->field_length, 
+			  field->field_name,
+			  ptr, record,field->ptr + offset - record));    
+      ptr= field->unpack(field->ptr + offset, ptr);
     }
   }
   DBUG_RETURN(ptr);

--- 1.7/sql/rpl_tblmap.cc	2005-05-24 12:03:26 +02:00
+++ 1.8/sql/rpl_tblmap.cc	2005-05-24 15:02:48 +02:00
@@ -9,7 +9,7 @@
 
 table_mapping::
 table_mapping()
-  : m_array(0), m_free(0), m_reserve(0)
+  : m_free(0)
 {
   (void) hash_init(&m_table_ids,&my_charset_bin,TABLE_ID_HASH_SIZE,
 		   offsetof(entry,table_id),sizeof(ulong),
@@ -19,12 +19,10 @@
 table_mapping::
 ~table_mapping()
 {
-  {
-    for (int i= 0; i < m_reserve; i++)
-      my_free(reinterpret_cast<char*>(m_array[i]), MYF(MY_ALLOW_ZERO_PTR));
-    my_free(reinterpret_cast<char*>(m_array), MYF(MY_ALLOW_ZERO_PTR));
-    m_array = NULL;
-  }
+  List_iterator_fast<entry> it(m_array);
+  entry *e;
+  while ((e= it++))
+    my_free(reinterpret_cast<char*>(e), MYF(MY_ALLOW_ZERO_PTR));
 }
 
 st_table* table_mapping::
@@ -48,37 +46,16 @@
 int table_mapping::
 expand()
 {
-  int reserve= m_reserve+1;
-  {
-    entry **array;
-    if (m_array)
-      array= (entry **)my_realloc((char*) m_array, 
-				  reserve*sizeof(*m_array), 
-				  MYF(MY_WME));
-    else
-      array= (entry **)my_malloc(reserve*sizeof(*m_array), 
-				 MYF(MY_WME));
-    if (array == NULL)
-    {
-      return ERR_MEMORY_ALLOCATION; // Memory allocation failed
-    }
-    m_array = array;
-  }
-  {
-    entry *tmp= (entry *)my_malloc(TABLE_ID_CHUNK*sizeof(**m_array),MYF(MY_WME));
-    if (tmp == NULL)
-    {
-      return ERR_MEMORY_ALLOCATION; // Memory allocation failed
-    }
-    m_array[m_reserve]= tmp;
-    
-    entry *e_end= tmp+TABLE_ID_CHUNK-1;
-    for (entry *e= tmp; e < e_end; e++)
-      e->next= e;
-    e_end->next= m_free;
-    m_free= tmp;
-  }
-  m_reserve= reserve;
+  entry *tmp= (entry *)my_malloc(TABLE_ID_CHUNK*sizeof(entry),MYF(MY_WME));
+  if (tmp == NULL)
+    return ERR_MEMORY_ALLOCATION; // Memory allocation failed
+  m_array.push_back(tmp);
+
+  entry *e_end= tmp+TABLE_ID_CHUNK-1;
+  for (entry *e= tmp; e < e_end; e++)
+    e->next= e;
+  e_end->next= m_free;
+  m_free= tmp;
   return 0;
 }
 

--- 1.5/sql/rpl_tblmap.h	2005-05-24 12:03:26 +02:00
+++ 1.6/sql/rpl_tblmap.h	2005-05-24 15:02:48 +02:00
@@ -58,9 +58,8 @@
   }
   int expand();
 
-  entry **m_array;
+  List<entry> m_array;
   entry *m_free;
-  ulong m_reserve;
 
   HASH m_table_ids;
 };
Thread
bk commit into 5.1 tree (tomas:1.1872)tomas24 May