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.1930 05/10/14 15:32:34 svoj@stripped +5 -0
Manual merge
sql/unireg.cc
1.69 05/10/14 15:32:28 svoj@stripped +34 -19
Manual merge - use local
sql/table.cc
1.184 05/10/14 15:32:27 svoj@stripped +64 -36
Mnaual merge - use local
sql/sql_partition.cc
1.9 05/10/14 15:32:26 svoj@stripped +1 -5
Manual merge - use local
sql/handler.h
1.163 05/10/14 15:32:26 svoj@stripped +2 -1
Manual merge - use local
sql/handler.cc
1.190 05/10/14 15:32:25 svoj@stripped +11 -5
Manual merge - use local
# 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-merge
--- 1.189/sql/handler.cc 2005-10-12 20:17:54 +05:00
+++ 1.190/sql/handler.cc 2005-10-14 15:32:25 +05:00
@@ -186,15 +186,18 @@
THD *thd= current_thd;
show_table_alias_st *table_alias;
handlerton **types;
- const char *ptr= name;
- if (thd && !my_strcasecmp(&my_charset_latin1, ptr, "DEFAULT"))
+ if (thd && !my_strnncoll(&my_charset_latin1,
+ (const uchar *)name, namelen,
+ (const uchar *)"DEFAULT", 7))
return (enum db_type) thd->variables.table_type;
retest:
for (types= sys_table_types; *types; types++)
{
- if (!my_strcasecmp(&my_charset_latin1, ptr, (*types)->name))
+ if (!my_strnncoll(&my_charset_latin1,
+ (const uchar *)name, namelen,
+ (const uchar *)(*types)->name, strlen((*types)->name)))
return (enum db_type) (*types)->db_type;
}
@@ -203,9 +206,12 @@
*/
for (table_alias= sys_table_aliases; table_alias->type; table_alias++)
{
- if (!my_strcasecmp(&my_charset_latin1, ptr, table_alias->alias))
+ if (!my_strnncoll(&my_charset_latin1,
+ (const uchar *)name, namelen,
+ (const uchar *)table_alias->alias, strlen(table_alias->alias)))
{
- ptr= table_alias->type;
+ name= table_alias->type;
+ namelen= strlen(name);
goto retest;
}
}
--- 1.162/sql/handler.h 2005-10-12 20:17:54 +05:00
+++ 1.163/sql/handler.h 2005-10-14 15:32:26 +05:00
@@ -664,6 +664,7 @@
uint options; /* OR of HA_CREATE_ options */
uint raid_type,raid_chunks;
uint merge_insert_method;
+ uint extra_size; /* length of extra data segment */
bool table_existed; /* 1 in create if table existed */
bool frm_only; /* 1 if no ha_create_table() */
bool varchar; /* 1 if table has a VARCHAR */
@@ -721,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.183/sql/table.cc 2005-10-12 20:17:55 +05:00
+++ 1.184/sql/table.cc 2005-10-14 15:32:27 +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
@@ -303,6 +302,65 @@
}
#endif
+ record_offset= (ulong) (uint2korr(head+6)+
+ ((uint2korr(head+14) == 0xffff ?
+ uint4korr(head+47) : uint2korr(head+14))));
+
+ if ((n_length= uint2korr(head+55)))
+ {
+ /* Read extra data segment */
+ char *buff, *next_chunk, *buff_end;
+ if (!(next_chunk= buff= my_malloc(n_length, MYF(MY_WME))))
+ goto err;
+ if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength,
+ MYF(MY_NABP)))
+ {
+ my_free(buff, MYF(0));
+ goto err;
+ }
+ share->connect_string.length= uint2korr(buff);
+ if (! (share->connect_string.str= strmake_root(&outparam->mem_root,
+ next_chunk + 2, share->connect_string.length)))
+ {
+ my_free(buff, MYF(0));
+ goto err;
+ }
+ next_chunk+= share->connect_string.length + 2;
+ buff_end= buff + n_length;
+ if (next_chunk + 2 < buff_end)
+ {
+ uint str_db_type_length= uint2korr(next_chunk);
+ 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))
+ {
+ my_free(buff, MYF(0));
+ goto err;
+ }
+#else
+ my_free(buff, MYF(0));
+ goto err;
+#endif
+ }
+ next_chunk+= part_info_len + 5;
+ }
+ my_free(buff, MYF(0));
+ }
error=4;
outparam->reginfo.lock_type= TL_UNLOCK;
outparam->current_lock=F_UNLCK;
@@ -322,9 +380,6 @@
goto err; /* purecov: inspected */
share->default_values= (byte *) record;
- record_offset= (ulong) (uint2korr(head+6)+
- ((uint2korr(head+14) == 0xffff ?
- uint4korr(head+47) : uint2korr(head+14))));
if (my_pread(file,(byte*) record, (uint) share->reclength,
record_offset, MYF(MY_NABP)))
goto err; /* purecov: inspected */
@@ -342,20 +397,7 @@
else
outparam->record[1]= outparam->record[0]; // Safety
}
-
- if ((n_length= uint2korr(head+55)))
- {
- /* Read extra block information */
- char *buff;
- if (!(buff= alloc_root(&outparam->mem_root, n_length)))
- goto err;
- if (my_pread(file, (byte*)buff, n_length, record_offset + share->reclength,
- MYF(MY_NABP)))
- goto err;
- share->connect_string.length= uint2korr(buff);
- share->connect_string.str= buff+2;
- }
-
+
#ifdef HAVE_purify
/*
We need this because when we read var-length rows, we are not updating
@@ -449,16 +491,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;
@@ -1410,15 +1442,10 @@
ulong length;
char fill[IO_SIZE];
int create_flags= O_RDWR | O_TRUNC;
- uint extra_size;
if (create_info->options & HA_LEX_CREATE_TMP_TABLE)
create_flags|= O_EXCL | O_NOFOLLOW;
- extra_size= 0;
- if (create_info->connect_string.length)
- extra_size= 2+create_info->connect_string.length;
-
#if SIZEOF_OFF_T > 4
/* Fix this when we have new .frm files; Current limit is 4G rows (QQ) */
if (create_info->max_rows > ~(ulong) 0)
@@ -1446,7 +1473,8 @@
fileinfo[4]=1;
int2store(fileinfo+6,IO_SIZE); /* Next block starts here */
key_length=keys*(7+NAME_LEN+MAX_REF_PARTS*9)+16;
- length= next_io_size((ulong) (IO_SIZE+key_length+reclength+extra_size));
+ length= next_io_size((ulong) (IO_SIZE+key_length+reclength+
+ create_info->extra_size));
int4store(fileinfo+10,length);
tmp_key_length= (key_length < 0xffff) ? key_length : 0xffff;
int2store(fileinfo+14,tmp_key_length);
@@ -1468,7 +1496,7 @@
int4store(fileinfo+47, key_length);
tmp= MYSQL_VERSION_ID; // Store to avoid warning from int4store
int4store(fileinfo+51, tmp);
- int2store(fileinfo+55, extra_size);
+ int2store(fileinfo+55, create_info->extra_size);
bzero(fill,IO_SIZE);
for (; length > IO_SIZE ; length-= IO_SIZE)
{
--- 1.68/sql/unireg.cc 2005-10-12 20:17:55 +05:00
+++ 1.69/sql/unireg.cc 2005-10-14 15:32:28 +05:00
@@ -76,6 +76,7 @@
uint keys, KEY *key_info,
handler *db_file)
{
+ LEX_STRING str_db_type;
uint reclength,info_length,screens,key_info_length,maxlength;
ulong key_buff_length;
File file;
@@ -86,6 +87,7 @@
#ifdef HAVE_PARTITION_DB
partition_info *part_info= thd->lex->part_info;
#endif
+ char buff[4];
DBUG_ENTER("mysql_create_frm");
#ifdef HAVE_PARTITION_DB
thd->lex->part_info= NULL;
@@ -122,6 +124,16 @@
}
reclength=uint2korr(forminfo+266);
+ /* Calculate extra data segment length */
+ str_db_type.str= (char *)ha_get_storage_engine(create_info->db_type);
+ 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)
{
@@ -147,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) ||
@@ -163,30 +172,36 @@
if (make_empty_rec(thd,file,create_info->db_type,create_info->table_options,
create_fields,reclength, data_offset, db_file))
goto err;
- if (create_info->connect_string.length)
- {
- char buff[2];
- int2store(buff,create_info->connect_string.length);
- if (my_write(file, (const byte*)buff, sizeof(buff), MYF(MY_NABP)) ||
- my_write(file, (const byte*)create_info->connect_string.str,
- create_info->connect_string.length, MYF(MY_NABP)))
+
+ int2store(buff, create_info->connect_string.length);
+ 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;
- }
- VOID(my_seek(file,filepos,MY_SEEK_SET,MYF(0)));
- if (my_write(file,(byte*) forminfo,288,MYF_RW) ||
- my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||
- pack_fields(file, create_fields, data_offset))
+ int2store(buff, str_db_type.length);
+ 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)
{
- if (my_write(file, (byte*) part_info->part_info_string,
- part_info->part_info_len, MYF_RW))
- goto err;
- }
+ 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) ||
+ my_write(file,(byte*) screen_buff,info_length,MYF_RW) ||
+ pack_fields(file, create_fields, data_offset))
+ goto err;
+
#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-14 15:32:26 +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.1930) | svoj | 14 Oct |