List:Internals« Previous MessageNext Message »
From:svoj Date:October 11 2005 11:57pm
Subject:bk commit into 5.1 tree (svoj:1.1923)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of svoj. When svoj 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.1923 05/10/12 02:57:37 svoj@stripped +4 -0
  After merge fixes.

  sql/unireg.cc
    1.68 05/10/12 02:57:33 svoj@stripped +18 -14
    Move partition info into extra data segment.

  sql/table.cc
    1.183 05/10/12 02:57:32 svoj@stripped +24 -15
    Move partition info into extra data segment.

  sql/sql_partition.cc
    1.9 05/10/12 02:57:32 svoj@stripped +1 -5
    Pass partition buffer instead of File.

  sql/handler.h
    1.162 05/10/12 02:57:32 svoj@stripped +1 -1
    Pass partition buffer instead of File.

# 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:	svoj
# Host:	svoj-laptop.mysql.com
# Root:	/home/svoj/devel/mysql/engine/mysql-5.1

--- 1.161/sql/handler.h	2005-10-11 15:25:09 +05:00
+++ 1.162/sql/handler.h	2005-10-12 02:57:32 +05:00
@@ -722,7 +722,7 @@
                                KEY *key_info,
                                const key_range *key_spec,
                                part_id_range *part_spec);
-bool mysql_unpack_partition(File file, THD *thd, uint part_info_len,
+bool mysql_unpack_partition(THD *thd, uchar *part_buf, uint part_info_len,
                             TABLE *table, enum db_type default_db_type);
 #endif
 

--- 1.182/sql/table.cc	2005-10-11 15:45:07 +05:00
+++ 1.183/sql/table.cc	2005-10-12 02:57:32 +05:00
@@ -70,7 +70,7 @@
   int	 j,error, errarg= 0;
   uint	 rec_buff_length,n_length,int_length,records,key_parts,keys,
          interval_count,interval_parts,read_length,db_create_options;
-  uint	 key_info_length, com_length, part_info_len, extra_rec_buf_length;
+  uint	 key_info_length, com_length, part_info_len= 0, extra_rec_buf_length;
   ulong  pos, record_offset;
   char	 index_file[FN_REFLEN], *names, *keynames, *comment_pos;
   uchar  head[288],*disk_buff,new_field_pack_flag;
@@ -154,7 +154,6 @@
     goto err;                                   /* purecov: inspected */
   *fn_ext(index_file)='\0';			// Remove .frm extension
 
-  part_info_len= uint4korr(head+55);
   share->frm_version= head[2];
   /*
     Check if .frm file created by MySQL 5.0. In this case we want to
@@ -331,11 +330,31 @@
     if (next_chunk + 2 < buff_end)
     {
       uint str_db_type_length= uint2korr(next_chunk);
-      share->db_type= ha_resolve_by_name(next_chunk + 2, str_db_type_length);
-      DBUG_PRINT("enter", ("Setting dbtype to: %d - %d - '%.*s'\n", share->db_type,
-            str_db_type_length, str_db_type_length, next_chunk + 2));
+      enum db_type tmp_db_type= ha_resolve_by_name(next_chunk + 2,
+                                                   str_db_type_length);
+      if (tmp_db_type != DB_TYPE_UNKNOWN)
+      {
+        share->db_type= tmp_db_type;
+        DBUG_PRINT("enter", ("Setting dbtype to: %d - %d - '%.*s'\n", share->db_type,
+              str_db_type_length, str_db_type_length, next_chunk + 2));
+      }
       next_chunk+= str_db_type_length + 2;
     }
+    if (next_chunk + 4 < buff_end)
+    {
+      part_info_len= uint4korr(next_chunk);
+      if (part_info_len > 0)
+      {
+#ifdef HAVE_PARTITION_DB
+        if (mysql_unpack_partition(thd, (uchar *)(next_chunk + 4),
+                         part_info_len, outparam, default_part_db_type))
+          goto err;
+#else
+        goto err;
+#endif
+      }
+      next_chunk+= part_info_len + 5;
+    }
     my_free(buff, MYF(0));
   }
   error=4;
@@ -468,16 +487,6 @@
 
   if (keynames)
     fix_type_pointers(&int_array, &share->keynames, 1, &keynames);
-  if (part_info_len > 0)
-  {
-#ifdef HAVE_PARTITION_DB
-    if (mysql_unpack_partition(file, thd, part_info_len,
-                               outparam, default_part_db_type)) 
-      goto err;
-#else
-    goto err;
-#endif
-  }
   VOID(my_close(file,MYF(MY_WME)));
   file= -1;
 

--- 1.67/sql/unireg.cc	2005-10-11 15:45:07 +05:00
+++ 1.68/sql/unireg.cc	2005-10-12 02:57:33 +05:00
@@ -87,7 +87,7 @@
 #ifdef HAVE_PARTITION_DB
   partition_info *part_info= thd->lex->part_info;
 #endif
-  char buff[2];
+  char buff[4];
   DBUG_ENTER("mysql_create_frm");
 #ifdef HAVE_PARTITION_DB
   thd->lex->part_info= NULL;
@@ -129,6 +129,10 @@
   str_db_type.length= strlen(str_db_type.str);
   create_info->extra_size= 2 + str_db_type.length;
   create_info->extra_size+= create_info->connect_string.length + 2;
+#ifdef HAVE_PARTITION_DB
+  if (part_info)
+    create_info->extra_size+= 5 + part_info->part_info_len;
+#endif
 
   if ((file=create_frm(thd, file_name, db, table, reclength, fileinfo,
 		       create_info, keys)) < 0)
@@ -155,10 +159,7 @@
 
 #ifdef HAVE_PARTITION_DB
   if (part_info)
-  {
-    int4store(fileinfo+55,part_info->part_info_len);
     fileinfo[61]= (uchar) part_info->default_engine_type;
-  }
 #endif
   int2store(fileinfo+59,db_file->extra_rec_buf_length());
   if (my_pwrite(file,(byte*) fileinfo,64,0L,MYF_RW) ||
@@ -173,16 +174,27 @@
     goto err;
 
   int2store(buff, create_info->connect_string.length);
-  if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
+  if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) ||
       my_write(file, (const byte*)create_info->connect_string.str,
                create_info->connect_string.length, MYF(MY_NABP)))
       goto err;
 
   int2store(buff, str_db_type.length);
-  if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
+  if (my_write(file, (const byte*)buff, 2, MYF(MY_NABP)) ||
       my_write(file, (const byte*)str_db_type.str,
                str_db_type.length, MYF(MY_NABP)))
     goto err;
+
+#ifdef HAVE_PARTITION_DB
+  if (part_info)
+  {
+    int4store(buff, part_info->part_info_len);
+    if (my_write(file, (const byte*)buff, 4, MYF_RW) ||
+        my_write(file, (const byte*)part_info->part_info_string,
+                 part_info->part_info_len + 1, MYF_RW))
+    goto err;
+ }
+#endif
  
   VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
   if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
@@ -190,14 +202,6 @@
       pack_fields(file, create_fields, data_offset))
     goto err;
 
-#ifdef HAVE_PARTITION_DB
-  if (part_info)
-  {
-    if (my_write(file, (byte*) part_info->part_info_string,
-                 part_info->part_info_len, MYF_RW))
-      goto err;
-  }
-#endif
 #ifdef HAVE_CRYPTED_FRM
   if (create_info->password)
   {

--- 1.8/sql/sql_partition.cc	2005-09-20 19:29:53 +05:00
+++ 1.9/sql/sql_partition.cc	2005-10-12 02:57:32 +05:00
@@ -3080,17 +3080,14 @@
      possible to retrace this given an item tree.
 */
 
-bool mysql_unpack_partition(File file, THD *thd, uint part_info_len,
+bool mysql_unpack_partition(THD *thd, uchar *part_buf, uint part_info_len,
                             TABLE* table, enum db_type default_db_type)
 {
   Item *thd_free_list= thd->free_list;
   bool result= TRUE;
-  uchar* part_buf= NULL;
   partition_info *part_info;
   LEX *old_lex= thd->lex, lex;
   DBUG_ENTER("mysql_unpack_partition");
-  if (read_string(file, (gptr*)&part_buf, part_info_len))
-    DBUG_RETURN(result);
   thd->lex= &lex;
   lex_start(thd, part_buf, part_info_len);
   /*
@@ -3160,7 +3157,6 @@
   result= FALSE;
 end:
   thd->free_list= thd_free_list;
-  x_free((gptr)part_buf);
   thd->lex= old_lex;
   DBUG_RETURN(result);
 }
Thread
bk commit into 5.1 tree (svoj:1.1923)svoj11 Oct