MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:ingo Date:April 10 2006 11:39am
Subject:bk commit into 4.0 tree (ingo:1.2179) BUG#10405
View as plain text  
Below is the list of changes that have just been committed into a local
4.0 repository of mydev. When mydev 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.2179 06/04/10 13:38:56 ingo@stripped +1 -0
  Bug#10405 - myisamchk damages auto_increment columns when changing character set
  
  Whenever 'myisamchk' needed to recreate a table,
  the auto increment information was lost.
  
  Now the forgotten element of the table creation
  information is set correctly.

  myisam/mi_check.c
    1.136 06/04/10 13:38:54 ingo@stripped +17 -9
    Bug#10405 - myisamchk damages auto_increment columns when changing character set
    Added some DBUG statements.
    Enabled 'with_auto_increment' in 'create_info'
    when recreating a table.

# 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:	ingo
# Host:	chilla.local
# Root:	/home/mydev/mysql-4.0-bug10405

--- 1.135/myisam/mi_check.c	2005-06-03 22:52:20 +02:00
+++ 1.136/myisam/mi_check.c	2006-04-10 13:38:54 +02:00
@@ -3415,6 +3415,7 @@
   ha_rows max_records;
   ulonglong file_length,tmp_length;
   MI_CREATE_INFO create_info;
+  DBUG_ENTER("recreate_table");
 
   error=1;					/* Default error */
   info= **org_info;
@@ -3424,7 +3425,7 @@
   unpack= (share.options & HA_OPTION_COMPRESS_RECORD) &&
     (param->testflag & T_UNPACK);
   if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys)))
-    return 0;
+    DBUG_RETURN(0);
   memcpy((byte*) keyinfo,(byte*) share.keyinfo,
 	 (size_t) (sizeof(MI_KEYDEF)*share.base.keys));
 
@@ -3433,14 +3434,14 @@
 				       (key_parts+share.base.keys))))
   {
     my_afree((gptr) keyinfo);
-    return 1;
+    DBUG_RETURN(1);
   }
   if (!(recdef=(MI_COLUMNDEF*)
 	my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1))))
   {
     my_afree((gptr) keyinfo);
     my_afree((gptr) keysegs);
-    return 1;
+    DBUG_RETURN(1);
   }
   if (!(uniquedef=(MI_UNIQUEDEF*)
 	my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1))))
@@ -3448,7 +3449,7 @@
     my_afree((gptr) recdef);
     my_afree((gptr) keyinfo);
     my_afree((gptr) keysegs);
-    return 1;
+    DBUG_RETURN(1);
   }
 
   /* Copy the column definitions */
@@ -3521,6 +3522,11 @@
   create_info.language = (param->language ? param->language :
 			  share.state.header.language);
   create_info.key_file_length=  status_info.key_file_length;
+  /*
+    Allow for creating an auto_increment key. This has an effect only if
+    an auto_increment key exists in the original table.
+  */
+  create_info.with_auto_increment= TRUE;
   /* We don't have to handle symlinks here because we are using
      HA_DONT_TOUCH_DATA */
   if (mi_create(filename,
@@ -3565,7 +3571,7 @@
   my_afree((gptr) keyinfo);
   my_afree((gptr) recdef);
   my_afree((gptr) keysegs);
-  return error;
+  DBUG_RETURN(error);
 }
 
 
@@ -3668,6 +3674,8 @@
 			       my_bool repair_only)
 {
   byte *record;
+  DBUG_ENTER("update_auto_increment_key");
+
   if (!info->s->base.auto_key ||
       !(((ulonglong) 1 << (info->s->base.auto_key-1)
 	 & info->s->state.key_map)))
@@ -3676,7 +3684,7 @@
       mi_check_print_info(param,
 			  "Table: %s doesn't have an auto increment key\n",
 			  param->isam_file_name);
-    return;
+    DBUG_VOID_RETURN;
   }
   if (!(param->testflag & T_SILENT) &&
       !(param->testflag & T_REP))
@@ -3689,7 +3697,7 @@
 				  MYF(0))))
   {
     mi_check_print_error(param,"Not enough memory for extra record");
-    return;
+    DBUG_VOID_RETURN;
   }
 
   mi_extra(info,HA_EXTRA_KEYREAD,0);
@@ -3700,7 +3708,7 @@
       mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
       my_free((char*) record, MYF(0));
       mi_check_print_error(param,"%d when reading last record",my_errno);
-      return;
+      DBUG_VOID_RETURN;
     }
     if (!repair_only)
       info->s->state.auto_increment=param->auto_increment_value;
@@ -3716,7 +3724,7 @@
   mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
   my_free((char*) record, MYF(0));
   update_state_info(param, info, UPDATE_AUTO_INC);
-  return;
+  DBUG_VOID_RETURN;
 }
 
     /* calculate unique keys for each part key */
Thread
bk commit into 4.0 tree (ingo:1.2179) BUG#10405ingo10 Apr