Commit e7e2962a authored by unknown's avatar unknown

Merge mysql.com:/home/mydev/mysql-5.1

into  mysql.com:/home/mydev/mysql-5.1-bug10405
parents 91c84f7d ccd9c164
...@@ -3800,6 +3800,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -3800,6 +3800,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
ha_rows max_records; ha_rows max_records;
ulonglong file_length,tmp_length; ulonglong file_length,tmp_length;
MI_CREATE_INFO create_info; MI_CREATE_INFO create_info;
DBUG_ENTER("recreate_table");
error=1; /* Default error */ error=1; /* Default error */
info= **org_info; info= **org_info;
...@@ -3809,7 +3810,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -3809,7 +3810,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
unpack= (share.options & HA_OPTION_COMPRESS_RECORD) && unpack= (share.options & HA_OPTION_COMPRESS_RECORD) &&
(param->testflag & T_UNPACK); (param->testflag & T_UNPACK);
if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys))) if (!(keyinfo=(MI_KEYDEF*) my_alloca(sizeof(MI_KEYDEF)*share.base.keys)))
return 0; DBUG_RETURN(0);
memcpy((byte*) keyinfo,(byte*) share.keyinfo, memcpy((byte*) keyinfo,(byte*) share.keyinfo,
(size_t) (sizeof(MI_KEYDEF)*share.base.keys)); (size_t) (sizeof(MI_KEYDEF)*share.base.keys));
...@@ -3818,14 +3819,14 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -3818,14 +3819,14 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
(key_parts+share.base.keys)))) (key_parts+share.base.keys))))
{ {
my_afree((gptr) keyinfo); my_afree((gptr) keyinfo);
return 1; DBUG_RETURN(1);
} }
if (!(recdef=(MI_COLUMNDEF*) if (!(recdef=(MI_COLUMNDEF*)
my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1)))) my_alloca(sizeof(MI_COLUMNDEF)*(share.base.fields+1))))
{ {
my_afree((gptr) keyinfo); my_afree((gptr) keyinfo);
my_afree((gptr) keysegs); my_afree((gptr) keysegs);
return 1; DBUG_RETURN(1);
} }
if (!(uniquedef=(MI_UNIQUEDEF*) if (!(uniquedef=(MI_UNIQUEDEF*)
my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1)))) my_alloca(sizeof(MI_UNIQUEDEF)*(share.state.header.uniques+1))))
...@@ -3833,7 +3834,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -3833,7 +3834,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
my_afree((gptr) recdef); my_afree((gptr) recdef);
my_afree((gptr) keyinfo); my_afree((gptr) keyinfo);
my_afree((gptr) keysegs); my_afree((gptr) keysegs);
return 1; DBUG_RETURN(1);
} }
/* Copy the column definitions */ /* Copy the column definitions */
...@@ -3903,6 +3904,11 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -3903,6 +3904,11 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
create_info.language = (param->language ? param->language : create_info.language = (param->language ? param->language :
share.state.header.language); share.state.header.language);
create_info.key_file_length= status_info.key_file_length; 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 /* We don't have to handle symlinks here because we are using
HA_DONT_TOUCH_DATA */ HA_DONT_TOUCH_DATA */
if (mi_create(filename, if (mi_create(filename,
...@@ -3947,7 +3953,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename) ...@@ -3947,7 +3953,7 @@ int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename)
my_afree((gptr) keyinfo); my_afree((gptr) keyinfo);
my_afree((gptr) recdef); my_afree((gptr) recdef);
my_afree((gptr) keysegs); my_afree((gptr) keysegs);
return error; DBUG_RETURN(error);
} }
...@@ -4050,6 +4056,8 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ...@@ -4050,6 +4056,8 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
my_bool repair_only) my_bool repair_only)
{ {
byte *record; byte *record;
DBUG_ENTER("update_auto_increment_key");
if (!info->s->base.auto_key || if (!info->s->base.auto_key ||
! mi_is_key_active(info->s->state.key_map, info->s->base.auto_key - 1)) ! mi_is_key_active(info->s->state.key_map, info->s->base.auto_key - 1))
{ {
...@@ -4057,7 +4065,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ...@@ -4057,7 +4065,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
mi_check_print_info(param, mi_check_print_info(param,
"Table: %s doesn't have an auto increment key\n", "Table: %s doesn't have an auto increment key\n",
param->isam_file_name); param->isam_file_name);
return; DBUG_VOID_RETURN;
} }
if (!(param->testflag & T_SILENT) && if (!(param->testflag & T_SILENT) &&
!(param->testflag & T_REP)) !(param->testflag & T_REP))
...@@ -4070,7 +4078,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ...@@ -4070,7 +4078,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
MYF(0)))) MYF(0))))
{ {
mi_check_print_error(param,"Not enough memory for extra record"); mi_check_print_error(param,"Not enough memory for extra record");
return; DBUG_VOID_RETURN;
} }
mi_extra(info,HA_EXTRA_KEYREAD,0); mi_extra(info,HA_EXTRA_KEYREAD,0);
...@@ -4081,7 +4089,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ...@@ -4081,7 +4089,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
mi_extra(info,HA_EXTRA_NO_KEYREAD,0); mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
my_free((char*) record, MYF(0)); my_free((char*) record, MYF(0));
mi_check_print_error(param,"%d when reading last record",my_errno); mi_check_print_error(param,"%d when reading last record",my_errno);
return; DBUG_VOID_RETURN;
} }
if (!repair_only) if (!repair_only)
info->s->state.auto_increment=param->auto_increment_value; info->s->state.auto_increment=param->auto_increment_value;
...@@ -4097,7 +4105,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info, ...@@ -4097,7 +4105,7 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
mi_extra(info,HA_EXTRA_NO_KEYREAD,0); mi_extra(info,HA_EXTRA_NO_KEYREAD,0);
my_free((char*) record, MYF(0)); my_free((char*) record, MYF(0));
update_state_info(param, info, UPDATE_AUTO_INC); update_state_info(param, info, UPDATE_AUTO_INC);
return; DBUG_VOID_RETURN;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment