List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:March 6 2007 5:06pm
Subject:bk commit into 5.1 tree (kaa:1.2434) BUG#5731
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of kaa. When kaa 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@stripped, 2007-03-06 20:06:23+03:00, kaa@stripped +15 -0
  5.1 part of the fix for bug #5731 "key_buffer_size not properly restricted to 4GB".
  
  - Changed interfaces for my_large_malloc() and my_large_free() to ensure the proper free method is used.
  - Replaced my_size_t with platform-defined size_t.

  include/keycache.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +1 -0
    Added block_flags field to the KEY_CACHE structure to track how block_mem was allocated

  include/my_global.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +0 -7
    Removed definition of my_size_t, as it is no longer used

  include/my_sys.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +2 -2
    Changed interfaces of my_large_malloc() and my_large_free() to be able to track if the memory was allocated from HugeTLB pool or conventional memory

  include/my_vle.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +1 -1
    Replaced my_size_t with size_t

  mysys/mf_keycache.c@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +4 -4
    Changed usage of my_large_malloc() and my_large_free() to match new interfaces.

  mysys/my_largepage.c@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +34 -12
    Changed interfaces of my_large_malloc() and my_large_free() to be able to track if the memory was allocated from HugeTLB pool or conventional memory

  mysys/my_vle.c@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +3 -3
    Replaced my_size_t with size_t

  sql/field.cc@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +2 -2
    Replaced my_size_t with size_t

  sql/field.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +4 -4
    Replaced my_size_t with size_t

  sql/log_event.cc@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +13 -13
    Replaced my_size_t with size_t

  sql/log_event.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +6 -6
    Replaced my_size_t with size_t

  sql/rpl_utility.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +3 -3
    Replaced my_size_t with size_t

  sql/sql_binlog.cc@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +2 -2
    Replaced my_size_t with size_t

  sql/sql_class.cc@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +22 -22
    Replaced my_size_t with size_t

  sql/sql_class.h@stripped, 2007-03-06 20:06:16+03:00, kaa@stripped +9 -9
    Replaced my_size_t with size_t

# 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:	kaa
# Host:	polly.local
# Root:	/tmp/maint/bug5731/my51-bug5731

--- 1.218/include/my_sys.h	2007-03-06 20:06:32 +03:00
+++ 1.219/include/my_sys.h	2007-03-06 20:06:32 +03:00
@@ -174,8 +174,8 @@ extern char *my_strndup(const char *from
 
 #ifdef HAVE_LARGE_PAGES
 extern uint my_get_large_page_size(void);
-extern gptr my_large_malloc(size_t size, myf my_flags);
-extern void my_large_free(gptr ptr, myf my_flags);
+extern gptr my_large_malloc(size_t size, uint *my_free_flag, myf my_flags);
+extern void my_large_free(gptr ptr, uint my_free_flag, myf my_flags);
 #else
 #define my_get_large_page_size() (0)
 #define my_large_malloc(A,B) my_malloc_lock((A),(B))

--- 1.63/mysys/mf_keycache.c	2007-03-06 20:06:32 +03:00
+++ 1.64/mysys/mf_keycache.c	2007-03-06 20:06:33 +03:00
@@ -341,7 +341,7 @@ int init_key_cache(KEY_CACHE *keycache, 
       /* Allocate memory for cache page buffers */
       if ((keycache->block_mem=
 	   my_large_malloc((ulong) blocks * keycache->key_cache_block_size,
-			  MYF(MY_WME))))
+			  &keycache->block_flags, MYF(MY_WME))))
       {
         /*
 	  Allocate memory for blocks, hash_links and hash entries;
@@ -350,7 +350,7 @@ int init_key_cache(KEY_CACHE *keycache, 
         if ((keycache->block_root= (BLOCK_LINK*) my_malloc((uint) length,
                                                            MYF(0))))
           break;
-        my_large_free(keycache->block_mem, MYF(0));
+        my_large_free(keycache->block_mem, keycache->block_flags, MYF(0));
         keycache->block_mem= 0;
       }
       if (blocks < 8)
@@ -421,7 +421,7 @@ err:
   keycache->blocks=  0;
   if (keycache->block_mem)
   {
-    my_large_free((gptr) keycache->block_mem, MYF(0));
+    my_large_free((gptr) keycache->block_mem, keycache->block_flags, MYF(0));
     keycache->block_mem= NULL;
   }
   if (keycache->block_root)
@@ -629,7 +629,7 @@ void end_key_cache(KEY_CACHE *keycache, 
   {
     if (keycache->block_mem)
     {
-      my_large_free((gptr) keycache->block_mem, MYF(0));
+      my_large_free((gptr) keycache->block_mem, keycache->block_flags, MYF(0));
       keycache->block_mem= NULL;
       my_free((gptr) keycache->block_root, MYF(0));
       keycache->block_root= NULL;

--- 1.371/sql/field.cc	2007-03-06 20:06:33 +03:00
+++ 1.372/sql/field.cc	2007-03-06 20:06:33 +03:00
@@ -1252,7 +1252,7 @@ void Field::hash(ulong *nr, ulong *nr2)
   }
 }
 
-my_size_t
+size_t
 Field::do_last_null_byte() const
 {
   DBUG_ASSERT(null_ptr == NULL || (byte*) null_ptr >= table->record[0]);
@@ -8247,7 +8247,7 @@ Field_bit::Field_bit(char *ptr_arg, uint
 }
 
 
-my_size_t
+size_t
 Field_bit::do_last_null_byte() const
 {
   /*

--- 1.211/sql/field.h	2007-03-06 20:06:33 +03:00
+++ 1.212/sql/field.h	2007-03-06 20:06:33 +03:00
@@ -236,8 +236,8 @@ public:
       the record. If the field does not use any bits of the null
       bytes, the value 0 (LAST_NULL_BYTE_UNDEF) is returned.
    */
-  my_size_t last_null_byte() const {
-    my_size_t bytes= do_last_null_byte();
+  size_t last_null_byte() const {
+    size_t bytes= do_last_null_byte();
     DBUG_PRINT("debug", ("last_null_byte() ==> %ld", (long) bytes));
     DBUG_ASSERT(bytes <= table->s->null_bytes);
     return bytes;
@@ -422,7 +422,7 @@ private:
       function. This represents the inheritance interface and can be
       overridden by subclasses.
    */
-  virtual my_size_t do_last_null_byte() const;
+  virtual size_t do_last_null_byte() const;
 };
 
 
@@ -1511,7 +1511,7 @@ public:
   }
 
 private:
-  virtual my_size_t do_last_null_byte() const;
+  virtual size_t do_last_null_byte() const;
 };
 
 

--- 1.266/sql/log_event.cc	2007-03-06 20:06:33 +03:00
+++ 1.267/sql/log_event.cc	2007-03-06 20:06:33 +03:00
@@ -1082,7 +1082,7 @@ void Log_event::print_header(IO_CACHE* f
                     ptr[7], ptr[8], ptr[9], ptr[10], ptr[11], ptr[12], ptr[13],
                     ptr[14], ptr[15], ptr[16], ptr[17], ptr[18]);
       DBUG_ASSERT(bytes_written >= 0);
-      DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf));
+      DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf));
       my_b_write(file, (byte*) emit_buf, bytes_written);
       ptr += LOG_EVENT_MINIMAL_HEADER_LEN;
       hexdump_from += LOG_EVENT_MINIMAL_HEADER_LEN;
@@ -1113,7 +1113,7 @@ void Log_event::print_header(IO_CACHE* f
                       (unsigned long) (hexdump_from + (i & 0xfffffff0)),
                       hex_string, char_string);
         DBUG_ASSERT(bytes_written >= 0);
-        DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf));
+        DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf));
 	my_b_write(file, (byte*) emit_buf, bytes_written);
 	hex_string[0]= 0;
 	char_string[0]= 0;
@@ -1134,7 +1134,7 @@ void Log_event::print_header(IO_CACHE* f
                     (unsigned long) (hexdump_from + (i & 0xfffffff0)),
                     hex_string, char_string);
       DBUG_ASSERT(bytes_written >= 0);
-      DBUG_ASSERT(static_cast<my_size_t>(bytes_written) < sizeof(emit_buf));
+      DBUG_ASSERT(static_cast<size_t>(bytes_written) < sizeof(emit_buf));
       my_b_write(file, (byte*) emit_buf, bytes_written);
     }
   }
@@ -5408,7 +5408,7 @@ Rows_log_event::Rows_log_event(const cha
   const uint byte_count= (m_width + 7) / 8;
   const byte* const ptr_rows_data= var_start + byte_count + 1;
 
-  my_size_t const data_size= event_len - (ptr_rows_data - (const byte *) buf);
+  size_t const data_size= event_len - (ptr_rows_data - (const byte *) buf);
   DBUG_PRINT("info",("m_table_id: %lu  m_flags: %d  m_width: %lu  data_size: %lu",
                      m_table_id, m_flags, m_width, data_size));
 
@@ -5441,7 +5441,7 @@ Rows_log_event::~Rows_log_event()
 
 #ifndef MYSQL_CLIENT
 int Rows_log_event::do_add_row_data(byte *const row_data,
-                                    my_size_t const length)
+                                    size_t const length)
 {
   /*
     When the table has a primary key, we would probably want, by default, to
@@ -5464,9 +5464,9 @@ int Rows_log_event::do_add_row_data(byte
   DBUG_ASSERT(m_rows_cur <= m_rows_end);
 
   /* The cast will always work since m_rows_cur <= m_rows_end */
-  if (static_cast<my_size_t>(m_rows_end - m_rows_cur) < length)
+  if (static_cast<size_t>(m_rows_end - m_rows_cur) < length)
   {
-    my_size_t const block_size= 1024;
+    size_t const block_size= 1024;
     my_ptrdiff_t const cur_size= m_rows_cur - m_rows_buf;
     my_ptrdiff_t const new_alloc= 
         block_size * ((cur_size + length) / block_size + block_size - 1);
@@ -5551,7 +5551,7 @@ unpack_row(RELAY_LOG_INFO *rli,
   DBUG_ENTER("unpack_row");
   DBUG_ASSERT(record && row);
   DBUG_PRINT("enter", ("row: 0x%lx  table->record[0]: 0x%lx", (long) row, (long) record));
-  my_size_t master_null_bytes= table->s->null_bytes;
+  size_t master_null_bytes= table->s->null_bytes;
 
   if (colcnt != table->s->fields)
   {
@@ -6008,7 +6008,7 @@ bool Rows_log_event::write_data_body(IO_
   my_ptrdiff_t const data_size= m_rows_cur - m_rows_buf;
 
   char *const sbuf_end= net_store_length((char*) sbuf, (uint) m_width);
-  DBUG_ASSERT(static_cast<my_size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
+  DBUG_ASSERT(static_cast<size_t>(sbuf_end - sbuf) <= sizeof(sbuf));
 
   return (my_b_safe_write(file, reinterpret_cast<byte*>(sbuf),
                           sbuf_end - sbuf) ||
@@ -6024,7 +6024,7 @@ void Rows_log_event::pack_info(Protocol 
   char buf[256];
   char const *const flagstr=
     get_flags(STMT_END_F) ? " flags: STMT_END_F" : "";
-  my_size_t bytes= my_snprintf(buf, sizeof(buf),
+  size_t bytes= my_snprintf(buf, sizeof(buf),
                                "table_id: %lu%s", m_table_id, flagstr);
   protocol->store(buf, bytes, &my_charset_bin);
 }
@@ -6372,7 +6372,7 @@ bool Table_map_log_event::write_data_bod
 
   char cbuf[sizeof(m_colcnt)];
   char *const cbuf_end= net_store_length((char*) cbuf, (uint) m_colcnt);
-  DBUG_ASSERT(static_cast<my_size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
+  DBUG_ASSERT(static_cast<size_t>(cbuf_end - cbuf) <= sizeof(cbuf));
 
   return (my_b_safe_write(file, dbuf,      sizeof(dbuf)) ||
           my_b_safe_write(file, (const byte*)m_dbnam,   m_dblen+1) ||
@@ -6395,7 +6395,7 @@ bool Table_map_log_event::write_data_bod
 void Table_map_log_event::pack_info(Protocol *protocol)
 {
     char buf[256];
-    my_size_t bytes= my_snprintf(buf, sizeof(buf),
+    size_t bytes= my_snprintf(buf, sizeof(buf),
                                  "table_id: %lu (%s.%s)",
                               m_table_id, m_dbnam, m_tblnam);
     protocol->store(buf, bytes, &my_charset_bin);
@@ -6573,7 +6573,7 @@ namespace {
  */
 static int
 copy_extra_record_fields(TABLE *table,
-                         my_size_t master_reclength,
+                         size_t master_reclength,
                          my_ptrdiff_t master_fields)
 {
   DBUG_PRINT("info", ("Copying to 0x%lx "

--- 1.146/sql/log_event.h	2007-03-06 20:06:33 +03:00
+++ 1.147/sql/log_event.h	2007-03-06 20:06:33 +03:00
@@ -1796,9 +1796,9 @@ private:
   TABLE      *m_table;
 #endif
   char const    *m_dbnam;
-  my_size_t      m_dblen;
+  size_t      m_dblen;
   char const    *m_tblnam;
-  my_size_t      m_tbllen;
+  size_t      m_tbllen;
   ulong          m_colcnt;
   unsigned char *m_coltype;
 
@@ -1806,7 +1806,7 @@ private:
   ulong          m_table_id;
   flag_set       m_flags;
 
-  my_size_t      m_data_size;
+  size_t      m_data_size;
 };
 
 
@@ -1873,7 +1873,7 @@ public:
 #endif
 
 #ifndef MYSQL_CLIENT
-  int add_row_data(byte *data, my_size_t length)
+  int add_row_data(byte *data, size_t length)
   {
     return do_add_row_data(data,length); 
   }
@@ -1890,7 +1890,7 @@ public:
   }
 
   MY_BITMAP const *get_cols() const { return &m_cols; }
-  my_size_t get_width() const       { return m_width; }
+  size_t get_width() const       { return m_width; }
   ulong get_table_id() const        { return m_table_id; }
 
 #ifndef MYSQL_CLIENT
@@ -1924,7 +1924,7 @@ protected:
 #endif
 
 #ifndef MYSQL_CLIENT
-  virtual int do_add_row_data(byte *data, my_size_t length);
+  virtual int do_add_row_data(byte *data, size_t length);
 #endif
 
 #ifndef MYSQL_CLIENT

--- 1.313/sql/sql_class.cc	2007-03-06 20:06:33 +03:00
+++ 1.314/sql/sql_class.cc	2007-03-06 20:06:33 +03:00
@@ -2333,8 +2333,8 @@ void xid_cache_delete(XID_STATE *xid_sta
 template <class RowsEventT> Rows_log_event* 
 THD::binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
                                        MY_BITMAP const* cols,
-                                       my_size_t colcnt,
-                                       my_size_t needed,
+                                       size_t colcnt,
+                                       size_t needed,
                                        bool is_transactional,
 				       RowsEventT *hint __attribute__((unused)))
 {
@@ -2404,17 +2404,17 @@ THD::binlog_prepare_pending_rows_event(T
 */
 template Rows_log_event*
 THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
-				       my_size_t, my_size_t, bool,
+				       size_t, size_t, bool,
 				       Write_rows_log_event*);
 
 template Rows_log_event*
 THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
-				       my_size_t colcnt, my_size_t, bool,
+				       size_t colcnt, size_t, bool,
 				       Delete_rows_log_event *);
 
 template Rows_log_event* 
 THD::binlog_prepare_pending_rows_event(TABLE*, uint32, MY_BITMAP const*,
-				       my_size_t colcnt, my_size_t, bool,
+				       size_t colcnt, size_t, bool,
 				       Update_rows_log_event *);
 #endif
 
@@ -2483,9 +2483,9 @@ field_type_name(enum_field_types type) 
 #endif
 
 
-my_size_t THD::max_row_length_blob(TABLE *table, const byte *data) const
+size_t THD::max_row_length_blob(TABLE *table, const byte *data) const
 {
-  my_size_t length= 0;
+  size_t length= 0;
   TABLE_SHARE *table_s= table->s;
   uint* const beg= table_s->blob_field;
   uint* const end= beg + table_s->blob_fields;
@@ -2502,7 +2502,7 @@ my_size_t THD::max_row_length_blob(TABLE
 }
 
 
-my_size_t THD::pack_row(TABLE *table, MY_BITMAP const* cols, byte *row_data, 
+size_t THD::pack_row(TABLE *table, MY_BITMAP const* cols, byte *row_data, 
                         const byte *record) const
 {
   Field **p_field= table->field, *field;
@@ -2525,7 +2525,7 @@ my_size_t THD::pack_row(TABLE *table, MY
       field->move_field_offset(-offset);
     }
   }
-  return (static_cast<my_size_t>(ptr - row_data));
+  return (static_cast<size_t>(ptr - row_data));
 }
 
 
@@ -2557,7 +2557,7 @@ namespace {
       @param length
       Length of data that is needed, if the record contain blobs.
      */
-    Row_data_memory(TABLE *table, my_size_t const len1)
+    Row_data_memory(TABLE *table, size_t const len1)
       : m_memory(0)
     {
 #ifndef DBUG_OFF
@@ -2568,7 +2568,7 @@ namespace {
       m_ptr[1]= 0;
     }
 
-    Row_data_memory(TABLE *table, my_size_t const len1, my_size_t const len2)
+    Row_data_memory(TABLE *table, size_t const len1, size_t const len2)
       : m_memory(0)
     {
 #ifndef DBUG_OFF
@@ -2607,7 +2607,7 @@ namespace {
     }
 
   private:
-    void allocate_memory(TABLE *const table, my_size_t const total_length)
+    void allocate_memory(TABLE *const table, size_t const total_length)
     {
       if (table->s->blob_fields == 0)
       {
@@ -2621,7 +2621,7 @@ namespace {
           to add two bytes for each field, which can potentially be
           added to hold the length of a packed field.
         */
-        my_size_t const maxlen= table->s->reclength + 2 * table->s->fields;
+        size_t const maxlen= table->s->reclength + 2 * table->s->fields;
 
         /*
           Allocate memory for two records if memory hasn't been
@@ -2652,7 +2652,7 @@ namespace {
 
 
 int THD::binlog_write_row(TABLE* table, bool is_trans, 
-                          MY_BITMAP const* cols, my_size_t colcnt, 
+                          MY_BITMAP const* cols, size_t colcnt, 
                           byte const *record) 
 { 
   DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
@@ -2667,7 +2667,7 @@ int THD::binlog_write_row(TABLE* table, 
 
   byte *row_data= memory.slot(0);
 
-  my_size_t const len= pack_row(table, cols, row_data, record);
+  size_t const len= pack_row(table, cols, row_data, record);
 
   Rows_log_event* const ev=
     binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,
@@ -2681,14 +2681,14 @@ int THD::binlog_write_row(TABLE* table, 
 }
 
 int THD::binlog_update_row(TABLE* table, bool is_trans,
-                           MY_BITMAP const* cols, my_size_t colcnt,
+                           MY_BITMAP const* cols, size_t colcnt,
                            const byte *before_record,
                            const byte *after_record)
 { 
   DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
 
-  my_size_t const before_maxlen = max_row_length(table, before_record);
-  my_size_t const after_maxlen  = max_row_length(table, after_record);
+  size_t const before_maxlen = max_row_length(table, before_record);
+  size_t const after_maxlen  = max_row_length(table, after_record);
 
   Row_data_memory row_data(table, before_maxlen, after_maxlen);
   if (!row_data.has_memory())
@@ -2697,9 +2697,9 @@ int THD::binlog_update_row(TABLE* table,
   byte *before_row= row_data.slot(0);
   byte *after_row= row_data.slot(1);
 
-  my_size_t const before_size= pack_row(table, cols, before_row, 
+  size_t const before_size= pack_row(table, cols, before_row, 
                                         before_record);
-  my_size_t const after_size= pack_row(table, cols, after_row, 
+  size_t const after_size= pack_row(table, cols, after_row, 
                                        after_record);
 
   /*
@@ -2727,7 +2727,7 @@ int THD::binlog_update_row(TABLE* table,
 }
 
 int THD::binlog_delete_row(TABLE* table, bool is_trans, 
-                           MY_BITMAP const* cols, my_size_t colcnt,
+                           MY_BITMAP const* cols, size_t colcnt,
                            byte const *record)
 { 
   DBUG_ASSERT(current_stmt_binlog_row_based && mysql_bin_log.is_open());
@@ -2742,7 +2742,7 @@ int THD::binlog_delete_row(TABLE* table,
 
   byte *row_data= memory.slot(0);
 
-  my_size_t const len= pack_row(table, cols, row_data, record);
+  size_t const len= pack_row(table, cols, row_data, record);
 
   Rows_log_event* const ev=
     binlog_prepare_pending_rows_event(table, server_id, cols, colcnt,

--- 1.340/sql/sql_class.h	2007-03-06 20:06:33 +03:00
+++ 1.341/sql/sql_class.h	2007-03-06 20:06:33 +03:00
@@ -949,13 +949,13 @@ public:
   void binlog_set_stmt_begin();
   int binlog_write_table_map(TABLE *table, bool is_transactional);
   int binlog_write_row(TABLE* table, bool is_transactional,
-                       MY_BITMAP const* cols, my_size_t colcnt,
+                       MY_BITMAP const* cols, size_t colcnt,
                        const byte *buf);
   int binlog_delete_row(TABLE* table, bool is_transactional,
-                        MY_BITMAP const* cols, my_size_t colcnt,
+                        MY_BITMAP const* cols, size_t colcnt,
                         const byte *buf);
   int binlog_update_row(TABLE* table, bool is_transactional,
-                        MY_BITMAP const* cols, my_size_t colcnt,
+                        MY_BITMAP const* cols, size_t colcnt,
                         const byte *old_data, const byte *new_data);
 
   void set_server_id(uint32 sid) { server_id = sid; }
@@ -966,25 +966,25 @@ public:
   template <class RowsEventT> Rows_log_event*
     binlog_prepare_pending_rows_event(TABLE* table, uint32 serv_id,
                                       MY_BITMAP const* cols,
-                                      my_size_t colcnt,
-                                      my_size_t needed,
+                                      size_t colcnt,
+                                      size_t needed,
                                       bool is_transactional,
 				      RowsEventT* hint);
   Rows_log_event* binlog_get_pending_rows_event() const;
   void            binlog_set_pending_rows_event(Rows_log_event* ev);
   
-  my_size_t max_row_length_blob(TABLE* table, const byte *data) const;
-  my_size_t max_row_length(TABLE* table, const byte *data) const
+  size_t max_row_length_blob(TABLE* table, const byte *data) const;
+  size_t max_row_length(TABLE* table, const byte *data) const
   {
     TABLE_SHARE *table_s= table->s;
-    my_size_t length= table_s->reclength + 2 * table_s->fields;
+    size_t length= table_s->reclength + 2 * table_s->fields;
     if (table_s->blob_fields == 0)
       return length;
 
     return (length+max_row_length_blob(table,data));
   }
 
-  my_size_t pack_row(TABLE* table, MY_BITMAP const* cols, byte *row_data,
+  size_t pack_row(TABLE* table, MY_BITMAP const* cols, byte *row_data,
                      const byte *data) const;
 
   int binlog_flush_pending_rows_event(bool stmt_end);

--- 1.3/mysys/my_largepage.c	2007-03-06 20:06:33 +03:00
+++ 1.4/mysys/my_largepage.c	2007-03-06 20:06:33 +03:00
@@ -47,43 +47,65 @@ uint my_get_large_page_size(void)
   General large pages allocator.
   Tries to allocate memory from large pages pool and falls back to
   my_malloc_lock() in case of failure
+
+  SYNOPSIS
+    my_large_malloc()
+    size          size of block to allocate in bytes
+    my_free_flag  pointer to a user-provided variable where the information
+                  about allocated block will be stored. This variable must
+                  later be passed to my_large_free()
+    my_flags      flags as for my_malloc()
+
+  RETURN
+    Pointer to a successfully allocated block, or NULL otherwise
 */
 
-gptr my_large_malloc(size_t size, myf my_flags)
+gptr my_large_malloc(size_t size, uint *my_free_flag, myf my_flags)
 {
   gptr ptr;
   DBUG_ENTER("my_large_malloc");
+
+  *my_free_flag= 0;
   
   if (my_use_large_pages && my_large_page_size)
   {
     if ((ptr = my_large_malloc_int(size, my_flags)) != NULL)
-        DBUG_RETURN(ptr);
+      DBUG_RETURN(ptr);
     if (my_flags & MY_WME)
       fprintf(stderr, "Warning: Using conventional memory pool\n");
   }
       
+  *my_free_flag= 1;
+
   DBUG_RETURN(my_malloc_lock(size, my_flags));
 }
 
 /*
   General large pages deallocator.
-  Tries to deallocate memory as if it was from large pages pool and falls back
-  to my_free_lock() in case of failure
- */
+  Deallocates memory allocated by my_large_malloc()
 
-void my_large_free(gptr ptr, myf my_flags __attribute__((unused)))
+  SYNOPSIS
+    my_large_free()
+    ptr           pointer to memory block returned by my_large_malloc()
+    my_free_flag  variable referenced by the my_free_flag pointer in
+                  my_large_malloc()
+    my_flags      flags as for my_free_lock()
+*/
+
+void my_large_free(gptr ptr, uint my_free_flag,
+                   myf my_flags __attribute__((unused)))
 {
   DBUG_ENTER("my_large_free");
   
   /*
-    my_large_free_int() can only fail if ptr was not allocated with
-    my_large_malloc_int(), i.e. my_malloc_lock() was used so we should free it
-    with my_free_lock()
+    my_free_flag is non-zero only when memory was allocated with
+    my_malloc_lock()
   */
-  if (!my_use_large_pages || !my_large_page_size ||
-      !my_large_free_int(ptr, my_flags))
+  if (!my_free_flag)
+    my_large_free_int(ptr, my_flags);
+  else
     my_free_lock(ptr, my_flags);
-
+  
   DBUG_VOID_RETURN;
 }
 

--- 1.3/include/my_vle.h	2007-03-06 20:06:33 +03:00
+++ 1.4/include/my_vle.h	2007-03-06 20:06:33 +03:00
@@ -28,7 +28,7 @@ extern "C" {
 */
 #define my_vle_sizeof(ITEM) (((sizeof(ITEM) * CHAR_BIT) + 6) / 7)
 
-byte *my_vle_encode(byte *vle, my_size_t max, ulong value);
+byte *my_vle_encode(byte *vle, size_t max, ulong value);
 byte const *my_vle_decode(ulong *value_ptr, byte const *vle);
 
 #ifdef __cplusplus

--- 1.4/mysys/my_vle.c	2007-03-06 20:06:33 +03:00
+++ 1.5/mysys/my_vle.c	2007-03-06 20:06:33 +03:00
@@ -40,11 +40,11 @@
 */
 
 byte*
-my_vle_encode(byte* out, my_size_t max, ulong n) 
+my_vle_encode(byte* out, size_t max, ulong n) 
 {
   byte buf[my_vle_sizeof(n)];
   byte *ptr= buf;
-  my_size_t len;
+  size_t len;
 
   do
   {
@@ -93,7 +93,7 @@ byte const*
 my_vle_decode(ulong *result_ptr, byte const *vle) 
 {
   ulong result= 0;
-  my_size_t cnt= 1;
+  size_t cnt= 1;
 
   do
   {

--- 1.8/sql/sql_binlog.cc	2007-03-06 20:06:33 +03:00
+++ 1.9/sql/sql_binlog.cc	2007-03-06 20:06:33 +03:00
@@ -43,8 +43,8 @@ void mysql_client_binlog_statement(THD* 
   my_bool nsok= thd->net.no_send_ok;
   thd->net.no_send_ok= TRUE;
 
-  my_size_t coded_len= thd->lex->comment.length + 1;
-  my_size_t decoded_len= base64_needed_decoded_length(coded_len);
+  size_t coded_len= thd->lex->comment.length + 1;
+  size_t decoded_len= base64_needed_decoded_length(coded_len);
   DBUG_ASSERT(coded_len > 0);
 
   /*

--- 1.4/sql/rpl_utility.h	2007-03-06 20:06:33 +03:00
+++ 1.5/sql/rpl_utility.h	2007-03-06 20:06:33 +03:00
@@ -63,7 +63,7 @@ public:
       types Array of types
       size  Number of elements in array 'types'
    */
-  table_def(field_type *types, my_size_t size)
+  table_def(field_type *types, size_t size)
     : m_type(types), m_size(size)
   {
   }
@@ -77,7 +77,7 @@ public:
     RETURN VALUE
       The number of fields that there is type data for.
    */
-  my_size_t size() const { return m_size; }
+  size_t size() const { return m_size; }
 
   /*
     Return a representation of the type data for one field.
@@ -118,7 +118,7 @@ public:
   int compatible_with(RELAY_LOG_INFO *rli, TABLE *table) const;
 
 private:
-  my_size_t m_size;           // Number of elements in the types array
+  size_t m_size;           // Number of elements in the types array
   field_type *m_type;                     // Array of type descriptors
 };
 

--- 1.157/include/my_global.h	2007-03-06 20:06:33 +03:00
+++ 1.158/include/my_global.h	2007-03-06 20:06:33 +03:00
@@ -901,13 +901,6 @@ typedef long		my_ptrdiff_t;
 typedef long long	my_ptrdiff_t;
 #endif
 
-/* We can't set my_size_t to size_t as we want my_size_t to be unsigned */
-#if SIZEOF_CHARP <= SIZEOF_LONG
-typedef unsigned long      my_size_t;
-#else
-typedef unsigned long long my_size_t;
-#endif
-       
 #define MY_ALIGN(A,L)	(((A) + (L) - 1) & ~((L) - 1))
 #define ALIGN_SIZE(A)	MY_ALIGN((A),sizeof(double))
 /* Size to make adressable obj. */

--- 1.7/include/keycache.h	2007-03-06 20:06:33 +03:00
+++ 1.8/include/keycache.h	2007-03-06 20:06:33 +03:00
@@ -68,6 +68,7 @@ typedef struct st_key_cache
   BLOCK_LINK *free_block_list; /* list of free blocks */
   BLOCK_LINK *block_root;        /* memory for block links                   */
   byte HUGE_PTR *block_mem;      /* memory for block buffers                 */
+  uint block_flags;              /* flags returned by my_large_malloc()      */
   BLOCK_LINK *used_last;         /* ptr to the last block of the LRU chain   */
   BLOCK_LINK *used_ins;          /* ptr to the insertion block in LRU chain  */
   pthread_mutex_t cache_lock;    /* to lock access to the cache structure    */
Thread
bk commit into 5.1 tree (kaa:1.2434) BUG#5731Alexey Kopytov6 Mar