mirror of
https://github.com/MariaDB/server.git
synced 2026-05-07 23:54:31 +02:00
Merge with 4.1
(Includes merge of arena code in 4.1 and 5.0) BitKeeper/etc/ignore: auto-union BitKeeper/etc/logging_ok: auto-union VC++Files/sql/mysqld.dsp: Auto merged client/mysql.cc: Auto merged client/mysqltest.c: Auto merged include/my_global.h: Auto merged include/my_sys.h: Auto merged include/mysql.h: Auto merged include/mysql_com.h: Auto merged innobase/row/row0sel.c: Auto merged libmysql/client_settings.h: Auto merged libmysql/libmysql.c: Auto merged libmysqld/Makefile.am: Auto merged libmysqld/examples/Makefile.am: Auto merged libmysqld/lib_sql.cc: Auto merged myisam/mi_check.c: Auto merged myisam/myisamchk.c: Auto merged myisam/sort.c: Auto merged mysql-test/r/connect.result: Auto merged mysql-test/r/ctype_recoding.result: Auto merged mysql-test/r/ctype_ucs.result: Auto merged mysql-test/r/func_in.result: Auto merged mysql-test/r/func_like.result: Auto merged mysql-test/r/gis.result: Auto merged mysql-test/r/having.result: Auto merged mysql-test/r/heap.result: Auto merged mysql-test/r/join.result: Auto merged mysql-test/r/key.result: Auto merged mysql-test/r/lowercase_table.result: Auto merged mysql-test/r/ndb_autodiscover.result: Auto merged mysql-test/r/null.result: Auto merged mysql-test/r/olap.result: Auto merged mysql-test/r/order_by.result: Auto merged mysql-test/r/ps_1general.result: Auto merged mysql-test/r/ps_2myisam.result: Auto merged mysql-test/r/ps_3innodb.result: Auto merged mysql-test/r/ps_4heap.result: Auto merged mysql-test/r/ps_5merge.result: Auto merged mysql-test/r/ps_6bdb.result: Auto merged mysql-test/r/range.result: Auto merged mysql-test/r/rename.result: Auto merged mysql-test/r/show_check.result: Auto merged mysql-test/r/subselect.result: Auto merged mysql-test/r/union.result: Auto merged mysql-test/r/variables.result: Auto merged mysql-test/t/alter_table.test: Auto merged mysql-test/t/null.test: Auto merged mysql-test/t/ps_1general.test: Auto merged mysql-test/t/rpl_charset.test: Auto merged mysql-test/t/rpl_heap.test: Auto merged mysql-test/t/rpl_relayrotate.test: Auto merged mysql-test/t/subselect.test: Auto merged mysql-test/t/variables.test: Auto merged netware/mysql_test_run.c: Auto merged scripts/make_binary_distribution.sh: Auto merged scripts/mysql_create_system_tables.sh: Auto merged scripts/mysql_fix_privilege_tables.sql: Auto merged scripts/mysql_install_db.sh: Auto merged sql/ha_berkeley.cc: Auto merged sql/ha_innodb.cc: Auto merged sql/ha_innodb.h: Auto merged sql/ha_myisam.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item.h: Auto merged sql/item_cmpfunc.h: Auto merged sql/item_create.cc: Auto merged sql/item_create.h: Auto merged sql/item_func.cc: Auto merged sql/item_func.h: Auto merged sql/item_timefunc.cc: Auto merged sql/item_timefunc.h: Auto merged sql/lex.h: Auto merged sql/lock.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/opt_sum.cc: Auto merged sql/protocol.cc: Auto merged sql/records.cc: Auto merged sql/repl_failsafe.cc: Auto merged sql/set_var.cc: Auto merged sql/set_var.h: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_acl.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_list.h: Auto merged sql/sql_load.cc: Auto merged sql/sql_rename.cc: Auto merged sql/sql_select.h: Auto merged sql/sql_show.cc: Auto merged sql/sql_string.h: Auto merged sql/table.cc: Auto merged sql-common/client.c: Auto merged client/mysqlbinlog.cc: Merge with 4.1 configure.in: Merge with 4.1 include/mysqld_error.h: Add new error message (1) from 4.1 mysql-test/mysql-test-run.sh: Merge with 4.1 mysql-test/r/func_gconcat.result: Merge with 4.1 mysql-test/r/func_if.result: Merge with 4.1 mysql-test/r/grant.result: Merge with 4.1 mysql-test/r/join_outer.result: Merge with 4.1 mysql-test/r/rpl_charset.result: Merge with 4.1 (This has to be fixed before pushing) mysql-test/r/system_mysql_db.result: Merge with 4.1. Added collation to new privileges mysql-test/t/grant.test: Merge with 4.1 mysql-test/t/grant_cache.test: Merge with 4.1 mysql-test/t/show_check.test: Merge with 4.1 sql/Makefile.am: Merge with 4.1 sql/item.cc: Merge with 4.1 sql/item_cmpfunc.cc: Merge with 4.1 (arena code) sql/item_subselect.cc: Merge with 4.1 sql/item_subselect.h: Merge with 4.1 sql/item_sum.cc: Merge with 4.1 sql/item_sum.h: Merge with 4.1 sql/log.cc: Merge with 4.1 (Remove code that is not relevant for 5.0) sql/mysqld.cc: Merge with 4.1 sql/opt_range.cc: Merge with 4.1 sql/share/czech/errmsg.txt: Merge with 4.1 sql/share/danish/errmsg.txt: Merge with 4.1 sql/share/dutch/errmsg.txt: Merge with 4.1 sql/share/english/errmsg.txt: Merge with 4.1 sql/share/estonian/errmsg.txt: Merge with 4.1 sql/share/french/errmsg.txt: Merge with 4.1 sql/share/german/errmsg.txt: Merge with 4.1 sql/share/greek/errmsg.txt: Merge with 4.1 sql/share/hungarian/errmsg.txt: Merge with 4.1 sql/share/italian/errmsg.txt: Merge with 4.1 sql/share/japanese/errmsg.txt: Merge with 4.1 sql/share/korean/errmsg.txt: Merge with 4.1 sql/share/norwegian-ny/errmsg.txt: Merge with 4.1 sql/share/norwegian/errmsg.txt: Merge with 4.1 sql/share/polish/errmsg.txt: Merge with 4.1 sql/share/portuguese/errmsg.txt: Merge with 4.1 sql/share/romanian/errmsg.txt: Merge with 4.1 sql/share/russian/errmsg.txt: Merge with 4.1 sql/share/serbian/errmsg.txt: Merge with 4.1 sql/share/slovak/errmsg.txt: Merge with 4.1 sql/share/spanish/errmsg.txt: Merge with 4.1 sql/share/swedish/errmsg.txt: Merge with 4.1 sql/share/ukrainian/errmsg.txt: Merge with 4.1 sql/sql_base.cc: Merge with 4.1 sql/sql_class.cc: Merge with 4.1 Use arena code from 4.1 sql/sql_class.h: Merge with 4.1 Use arena code from 4.1 sql/sql_derived.cc: Merge with 4.1 sql/sql_lex.cc: Merge with 4.1 sql/sql_lex.h: Merge with 4.1 sql/sql_parse.cc: Merge with 4.1 sql/sql_prepare.cc: Merge with 4.1 sql/sql_select.cc: Merge with 4.1 sql/sql_table.cc: Merge with 4.1 sql/sql_union.cc: Merge with 4.1 sql/sql_yacc.yy: Merge with 4.1 sql/tztime.cc: Merge with 4.1 tests/client_test.c: Merge with 4.1
This commit is contained in:
commit
4ad51359c1
739 changed files with 39160 additions and 18173 deletions
|
|
@ -18,8 +18,10 @@ EXTRA_DIST = mi_test_all.sh mi_test_all.res
|
|||
pkgdata_DATA = mi_test_all mi_test_all.res
|
||||
|
||||
INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include
|
||||
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a ../mysys/libmysys.a \
|
||||
../dbug/libdbug.a ../strings/libmystrings.a
|
||||
LDADD = @CLIENT_EXTRA_LDFLAGS@ libmyisam.a \
|
||||
$(top_builddir)/mysys/libmysys.a \
|
||||
$(top_builddir)/dbug/libdbug.a \
|
||||
$(top_builddir)/strings/libmystrings.a @ZLIB_LIBS@
|
||||
pkglib_LIBRARIES = libmyisam.a
|
||||
bin_PROGRAMS = myisamchk myisamlog myisampack myisam_ftdump
|
||||
myisamchk_DEPENDENCIES= $(LIBRARIES)
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#define misc_word_char(X) ((X)=='\'')
|
||||
#define word_char(s,X) (true_word_char(s,X) || misc_word_char(X))
|
||||
|
||||
#define FT_MAX_WORD_LEN_FOR_SORT 20
|
||||
#define FT_MAX_WORD_LEN_FOR_SORT 31
|
||||
|
||||
#define COMPILE_STOPWORDS_IN
|
||||
|
||||
|
|
|
|||
|
|
@ -1585,7 +1585,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
|
|||
int old_lock;
|
||||
MYISAM_SHARE *share=info->s;
|
||||
MI_STATE_INFO old_state;
|
||||
DBUG_ENTER("sort_index");
|
||||
DBUG_ENTER("mi_sort_index");
|
||||
|
||||
if (!(param->testflag & T_SILENT))
|
||||
printf("- Sorting index for MyISAM-table '%s'\n",name);
|
||||
|
|
@ -1664,7 +1664,7 @@ err:
|
|||
err2:
|
||||
VOID(my_delete(param->temp_filename,MYF(MY_WME)));
|
||||
DBUG_RETURN(-1);
|
||||
} /* sort_index */
|
||||
} /* mi_sort_index */
|
||||
|
||||
|
||||
/* Sort records recursive using one index */
|
||||
|
|
@ -1672,7 +1672,7 @@ err2:
|
|||
static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
||||
my_off_t pagepos, File new_file)
|
||||
{
|
||||
uint length,nod_flag,used_length;
|
||||
uint length,nod_flag,used_length, key_length;
|
||||
uchar *buff,*keypos,*endpos;
|
||||
uchar key[MI_MAX_POSSIBLE_KEY_BUFF];
|
||||
my_off_t new_page_pos,next_page;
|
||||
|
|
@ -1693,7 +1693,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
|||
llstr(pagepos,llbuff));
|
||||
goto err;
|
||||
}
|
||||
if ((nod_flag=mi_test_if_nod(buff)))
|
||||
if ((nod_flag=mi_test_if_nod(buff)) || keyinfo->flag & HA_FULLTEXT)
|
||||
{
|
||||
used_length=mi_getint(buff);
|
||||
keypos=buff+2+nod_flag;
|
||||
|
|
@ -1704,7 +1704,7 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
|||
{
|
||||
next_page=_mi_kpos(nod_flag,keypos);
|
||||
_mi_kpointer(info,keypos-nod_flag,param->new_file_pos); /* Save new pos */
|
||||
if (sort_one_index(param,info,keyinfo,next_page, new_file))
|
||||
if (sort_one_index(param,info,keyinfo,next_page,new_file))
|
||||
{
|
||||
DBUG_PRINT("error",("From page: %ld, keyoffset: %d used_length: %d",
|
||||
(ulong) pagepos, (int) (keypos - buff),
|
||||
|
|
@ -1714,11 +1714,25 @@ static int sort_one_index(MI_CHECK *param, MI_INFO *info, MI_KEYDEF *keyinfo,
|
|||
}
|
||||
}
|
||||
if (keypos >= endpos ||
|
||||
((*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0)
|
||||
(key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&keypos,key)) == 0)
|
||||
break;
|
||||
#ifdef EXTRA_DEBUG
|
||||
assert(keypos <= endpos);
|
||||
#endif
|
||||
DBUG_ASSERT(keypos <= endpos);
|
||||
if (keyinfo->flag & HA_FULLTEXT)
|
||||
{
|
||||
uint off;
|
||||
int subkeys;
|
||||
get_key_full_length_rdonly(off, key);
|
||||
subkeys=ft_sintXkorr(key+off);
|
||||
if (subkeys < 0)
|
||||
{
|
||||
next_page= _mi_dpos(info,0,key+key_length);
|
||||
_mi_dpointer(info,keypos-nod_flag-info->s->rec_reflength,
|
||||
param->new_file_pos); /* Save new pos */
|
||||
if (sort_one_index(param,info,&info->s->ft2_keyinfo,
|
||||
next_page,new_file))
|
||||
goto err;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -2020,12 +2034,14 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||
|
||||
if (sort_param.keyinfo->flag & HA_FULLTEXT)
|
||||
{
|
||||
uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
|
||||
sort_param.keyinfo->seg->charset->mbmaxlen;
|
||||
sort_info.max_records=
|
||||
(ha_rows) (sort_info.filelength/FT_MAX_WORD_LEN_FOR_SORT+1);
|
||||
(ha_rows) (sort_info.filelength/ft_max_word_len_for_sort+1);
|
||||
|
||||
sort_param.key_read=sort_ft_key_read;
|
||||
sort_param.key_write=sort_ft_key_write;
|
||||
sort_param.key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
|
||||
sort_param.key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -2425,7 +2441,11 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
|
|||
total_key_length+=sort_param[i].key_length;
|
||||
|
||||
if (sort_param[i].keyinfo->flag & HA_FULLTEXT)
|
||||
sort_param[i].key_length+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
|
||||
{
|
||||
uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
|
||||
sort_param[i].keyinfo->seg->charset->mbmaxlen;
|
||||
sort_param[i].key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
|
||||
}
|
||||
}
|
||||
sort_info.total_keys=i;
|
||||
sort_param[0].master= 1;
|
||||
|
|
@ -2634,7 +2654,6 @@ static int sort_key_read(MI_SORT_PARAM *sort_param, void *key)
|
|||
DBUG_RETURN(sort_write_record(sort_param));
|
||||
} /* sort_key_read */
|
||||
|
||||
|
||||
static int sort_ft_key_read(MI_SORT_PARAM *sort_param, void *key)
|
||||
{
|
||||
int error;
|
||||
|
|
@ -3950,8 +3969,22 @@ static ha_checksum mi_byte_checksum(const byte *buf, uint length)
|
|||
return crc;
|
||||
}
|
||||
|
||||
static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
|
||||
{
|
||||
uint key_maxlength=key->maxlength;
|
||||
if (key->flag & HA_FULLTEXT)
|
||||
{
|
||||
uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
|
||||
key->seg->charset->mbmaxlen;
|
||||
key_maxlength+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
|
||||
}
|
||||
return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
|
||||
((ulonglong) rows * key_maxlength >
|
||||
(ulonglong) myisam_max_temp_length));
|
||||
}
|
||||
|
||||
/*
|
||||
Deactive all not unique index that can be recreated fast
|
||||
Deactivate all not unique index that can be recreated fast
|
||||
These include packed keys on which sorting will use more temporary
|
||||
space than the max allowed file length or for which the unpacked keys
|
||||
will take much more space than packed keys.
|
||||
|
|
@ -3959,17 +3992,6 @@ static ha_checksum mi_byte_checksum(const byte *buf, uint length)
|
|||
rows we will put into the file.
|
||||
*/
|
||||
|
||||
static my_bool mi_too_big_key_for_sort(MI_KEYDEF *key, ha_rows rows)
|
||||
{
|
||||
uint key_maxlength=key->maxlength;
|
||||
if (key->flag & HA_FULLTEXT)
|
||||
key_maxlength+=FT_MAX_WORD_LEN_FOR_SORT-HA_FT_MAXBYTELEN;
|
||||
return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
|
||||
((ulonglong) rows * key_maxlength >
|
||||
(ulonglong) myisam_max_temp_length));
|
||||
}
|
||||
|
||||
|
||||
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
|
||||
{
|
||||
MYISAM_SHARE *share=info->s;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,14 @@
|
|||
#include <ieeefp.h>
|
||||
#endif
|
||||
|
||||
#define CHECK_KEYS
|
||||
#define CHECK_KEYS /* Enable safety checks */
|
||||
|
||||
#define FIX_LENGTH(cs, pos, length, char_length) \
|
||||
do { \
|
||||
if (length > char_length) \
|
||||
char_length= my_charpos(cs, pos, pos+length, char_length); \
|
||||
set_if_smaller(char_length,length); \
|
||||
} while(0)
|
||||
|
||||
static int _mi_put_key_in_record(MI_INFO *info,uint keynr,byte *record);
|
||||
|
||||
|
|
@ -38,11 +45,12 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
byte *pos,*end;
|
||||
uchar *start;
|
||||
reg1 HA_KEYSEG *keyseg;
|
||||
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
|
||||
DBUG_ENTER("_mi_make_key");
|
||||
|
||||
if(info->s->keyinfo[keynr].flag & HA_SPATIAL)
|
||||
if (info->s->keyinfo[keynr].flag & HA_SPATIAL)
|
||||
{
|
||||
/*
|
||||
/*
|
||||
TODO: nulls processing
|
||||
*/
|
||||
#ifdef HAVE_SPATIAL
|
||||
|
|
@ -57,6 +65,8 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
{
|
||||
enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type;
|
||||
uint length=keyseg->length;
|
||||
uint char_length;
|
||||
CHARSET_INFO *cs=keyseg->charset;
|
||||
|
||||
if (keyseg->null_bit)
|
||||
{
|
||||
|
|
@ -68,6 +78,9 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
*key++=1; /* Not NULL */
|
||||
}
|
||||
|
||||
char_length= ((!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen :
|
||||
length);
|
||||
|
||||
pos= (byte*) record+keyseg->start;
|
||||
if (keyseg->flag & HA_SPACE_PACK)
|
||||
{
|
||||
|
|
@ -83,9 +96,10 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
pos++;
|
||||
}
|
||||
length=(uint) (end-pos);
|
||||
store_key_length_inc(key,length);
|
||||
memcpy((byte*) key,(byte*) pos,(size_t) length);
|
||||
key+=length;
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
store_key_length_inc(key,char_length);
|
||||
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
|
||||
key+=char_length;
|
||||
continue;
|
||||
}
|
||||
if (keyseg->flag & HA_VAR_LENGTH)
|
||||
|
|
@ -93,14 +107,22 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
uint tmp_length=uint2korr(pos);
|
||||
pos+=2; /* Skip VARCHAR length */
|
||||
set_if_smaller(length,tmp_length);
|
||||
store_key_length_inc(key,length);
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
store_key_length_inc(key,char_length);
|
||||
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
|
||||
key+= char_length;
|
||||
continue;
|
||||
}
|
||||
else if (keyseg->flag & HA_BLOB_PART)
|
||||
{
|
||||
uint tmp_length=_mi_calc_blob_length(keyseg->bit_start,pos);
|
||||
memcpy_fixed((byte*) &pos,pos+keyseg->bit_start,sizeof(char*));
|
||||
set_if_smaller(length,tmp_length);
|
||||
store_key_length_inc(key,length);
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
store_key_length_inc(key,char_length);
|
||||
memcpy((byte*) key,(byte*) pos,(size_t) char_length);
|
||||
key+= char_length;
|
||||
continue;
|
||||
}
|
||||
else if (keyseg->flag & HA_SWAP_KEY)
|
||||
{ /* Numerical column */
|
||||
|
|
@ -112,7 +134,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
if (isnan(nr))
|
||||
{
|
||||
/* Replace NAN with zero */
|
||||
bzero(key,length);
|
||||
bzero(key,length);
|
||||
key+=length;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -123,7 +145,7 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
float8get(nr,pos);
|
||||
if (isnan(nr))
|
||||
{
|
||||
bzero(key,length);
|
||||
bzero(key,length);
|
||||
key+=length;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -136,7 +158,10 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
}
|
||||
continue;
|
||||
}
|
||||
memcpy((byte*) key, pos, length);
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
memcpy((byte*) key, pos, char_length);
|
||||
if (length > char_length)
|
||||
cs->cset->fill(cs, key+char_length, length-char_length, ' ');
|
||||
key+= length;
|
||||
}
|
||||
_mi_dpointer(info,key,filepos);
|
||||
|
|
@ -164,38 +189,43 @@ uint _mi_make_key(register MI_INFO *info, uint keynr, uchar *key,
|
|||
RETURN
|
||||
length of packed key
|
||||
|
||||
last_use_keyseg Store pointer to the keyseg after the last used one
|
||||
last_use_keyseg Store pointer to the keyseg after the last used one
|
||||
*/
|
||||
|
||||
uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
||||
uint k_length, HA_KEYSEG **last_used_keyseg)
|
||||
{
|
||||
uint length;
|
||||
uchar *pos,*end,*start_key=key;
|
||||
reg1 HA_KEYSEG *keyseg;
|
||||
enum ha_base_keytype type;
|
||||
uchar *start_key=key;
|
||||
HA_KEYSEG *keyseg;
|
||||
my_bool is_ft= info->s->keyinfo[keynr].flag & HA_FULLTEXT;
|
||||
DBUG_ENTER("_mi_pack_key");
|
||||
|
||||
start_key=key;
|
||||
for (keyseg=info->s->keyinfo[keynr].seg ;
|
||||
keyseg->type && (int) k_length > 0;
|
||||
old+=keyseg->length, keyseg++)
|
||||
{
|
||||
length=min((uint) keyseg->length,(uint) k_length);
|
||||
type=(enum ha_base_keytype) keyseg->type;
|
||||
enum ha_base_keytype type=(enum ha_base_keytype) keyseg->type;
|
||||
uint length=min((uint) keyseg->length,(uint) k_length);
|
||||
uint char_length;
|
||||
uchar *pos;
|
||||
CHARSET_INFO *cs=keyseg->charset;
|
||||
|
||||
if (keyseg->null_bit)
|
||||
{
|
||||
k_length--;
|
||||
if (!(*key++= (char) 1-*old++)) /* Copy null marker */
|
||||
{
|
||||
k_length-=length;
|
||||
if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART))
|
||||
k_length-=2; /* Skip length */
|
||||
continue; /* Found NULL */
|
||||
}
|
||||
}
|
||||
char_length= (!is_ft && cs && cs->mbmaxlen > 1) ? length/cs->mbmaxlen : length;
|
||||
pos=old;
|
||||
if (keyseg->flag & HA_SPACE_PACK)
|
||||
{
|
||||
end=pos+length;
|
||||
uchar *end=pos+length;
|
||||
if (type != HA_KEYTYPE_NUM)
|
||||
{
|
||||
while (end > pos && end[-1] == ' ')
|
||||
|
|
@ -208,9 +238,10 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||
}
|
||||
k_length-=length;
|
||||
length=(uint) (end-pos);
|
||||
store_key_length_inc(key,length);
|
||||
memcpy((byte*) key,pos,(size_t) length);
|
||||
key+= length;
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
store_key_length_inc(key,char_length);
|
||||
memcpy((byte*) key,pos,(size_t) char_length);
|
||||
key+= char_length;
|
||||
continue;
|
||||
}
|
||||
else if (keyseg->flag & (HA_VAR_LENGTH | HA_BLOB_PART))
|
||||
|
|
@ -218,11 +249,13 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||
/* Length of key-part used with mi_rkey() always 2 */
|
||||
uint tmp_length=uint2korr(pos);
|
||||
k_length-= 2+length;
|
||||
pos+=2;
|
||||
set_if_smaller(length,tmp_length); /* Safety */
|
||||
store_key_length_inc(key,length);
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
store_key_length_inc(key,char_length);
|
||||
old+=2; /* Skip length */
|
||||
memcpy((byte*) key, pos+2,(size_t) length);
|
||||
key+= length;
|
||||
memcpy((byte*) key, pos,(size_t) char_length);
|
||||
key+= char_length;
|
||||
continue;
|
||||
}
|
||||
else if (keyseg->flag & HA_SWAP_KEY)
|
||||
|
|
@ -235,7 +268,10 @@ uint _mi_pack_key(register MI_INFO *info, uint keynr, uchar *key, uchar *old,
|
|||
}
|
||||
continue;
|
||||
}
|
||||
memcpy((byte*) key,pos,(size_t) length);
|
||||
FIX_LENGTH(cs, pos, length, char_length);
|
||||
memcpy((byte*) key, pos, char_length);
|
||||
if (length > char_length)
|
||||
cs->cset->fill(cs,key+char_length, length-char_length, ' ');
|
||||
key+= length;
|
||||
k_length-=length;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,8 +63,8 @@ int _mi_search(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||
uchar *keypos,*maxpos;
|
||||
uchar lastkey[MI_MAX_KEY_BUFF],*buff;
|
||||
DBUG_ENTER("_mi_search");
|
||||
DBUG_PRINT("enter",("pos: %ld nextflag: %d lastpos: %ld",
|
||||
pos,nextflag,info->lastpos));
|
||||
DBUG_PRINT("enter",("pos: %lu nextflag: %u lastpos: %lu",
|
||||
(ulong) pos, nextflag, (ulong) info->lastpos));
|
||||
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,key_len););
|
||||
|
||||
if (pos == HA_OFFSET_ERROR)
|
||||
|
|
@ -235,15 +235,15 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
if (length == 0 || page > end)
|
||||
{
|
||||
my_errno=HA_ERR_CRASHED;
|
||||
DBUG_PRINT("error",("Found wrong key: length: %d page: %lx end: %lx",
|
||||
length,page,end));
|
||||
DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
|
||||
length, page, end));
|
||||
DBUG_RETURN(MI_FOUND_WRONG_KEY);
|
||||
}
|
||||
if ((flag=ha_key_cmp(keyinfo->seg,t_buff,key,key_len,comp_flag,
|
||||
¬_used)) >= 0)
|
||||
break;
|
||||
#ifdef EXTRA_DEBUG
|
||||
DBUG_PRINT("loop",("page: %lx key: '%s' flag: %d",page,t_buff,flag));
|
||||
DBUG_PRINT("loop",("page: %p key: '%s' flag: %d", page, t_buff, flag));
|
||||
#endif
|
||||
memcpy(buff,t_buff,length);
|
||||
*ret_pos=page;
|
||||
|
|
@ -251,7 +251,7 @@ int _mi_seq_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
if (flag == 0)
|
||||
memcpy(buff,t_buff,length); /* Result is first key */
|
||||
*last_key= page == end;
|
||||
DBUG_PRINT("exit",("flag: %d ret_pos: %lx",flag,*ret_pos));
|
||||
DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos));
|
||||
DBUG_RETURN(flag);
|
||||
} /* _mi_seq_search */
|
||||
|
||||
|
|
@ -381,8 +381,8 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
if (page > end)
|
||||
{
|
||||
my_errno=HA_ERR_CRASHED;
|
||||
DBUG_PRINT("error",("Found wrong key: length: %d page: %lx end: %lx",
|
||||
length,page,end));
|
||||
DBUG_PRINT("error",("Found wrong key: length: %u page: %p end: %p",
|
||||
length, page, end));
|
||||
DBUG_RETURN(MI_FOUND_WRONG_KEY);
|
||||
}
|
||||
|
||||
|
|
@ -396,9 +396,18 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
|
||||
matched=prefix_len+left;
|
||||
|
||||
for (my_flag=0;left;left--)
|
||||
if ((my_flag= (int) sort_order[*vseg++] - (int) sort_order[*k++]))
|
||||
break;
|
||||
if (sort_order)
|
||||
{
|
||||
for (my_flag=0;left;left--)
|
||||
if ((my_flag= (int) sort_order[*vseg++] - (int) sort_order[*k++]))
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (my_flag=0;left;left--)
|
||||
if ((my_flag= (int) *vseg++ - (int) *k++))
|
||||
break;
|
||||
}
|
||||
|
||||
if (my_flag>0) /* mismatch */
|
||||
break;
|
||||
|
|
@ -442,9 +451,8 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
/* We have to compare k and vseg as if they where space extended */
|
||||
for (end=vseg + (len-cmplen) ;
|
||||
vseg < end && *vseg == (uchar) ' ';
|
||||
vseg++) ;
|
||||
if (vseg == end)
|
||||
goto cmp_rest; /* should never happen */
|
||||
vseg++, matched++) ;
|
||||
DBUG_ASSERT(vseg < end);
|
||||
|
||||
if (*vseg > (uchar) ' ')
|
||||
{
|
||||
|
|
@ -502,7 +510,7 @@ int _mi_prefix_search(MI_INFO *info, register MI_KEYDEF *keyinfo, uchar *page,
|
|||
|
||||
*last_key= page == end;
|
||||
|
||||
DBUG_PRINT("exit",("flag: %d ret_pos: %lx",flag,*ret_pos));
|
||||
DBUG_PRINT("exit",("flag: %d ret_pos: %p", flag, *ret_pos));
|
||||
DBUG_RETURN(flag);
|
||||
} /* _mi_prefix_search */
|
||||
|
||||
|
|
@ -579,7 +587,7 @@ my_off_t _mi_dpos(MI_INFO *info, uint nod_flag, uchar *after_key)
|
|||
after_key-=(nod_flag + info->s->rec_reflength);
|
||||
switch (info->s->rec_reflength) {
|
||||
#if SIZEOF_OFF_T > 4
|
||||
case 8: pos= (my_off_t) mi_uint5korr(after_key); break;
|
||||
case 8: pos= (my_off_t) mi_uint8korr(after_key); break;
|
||||
case 7: pos= (my_off_t) mi_uint7korr(after_key); break;
|
||||
case 6: pos= (my_off_t) mi_uint6korr(after_key); break;
|
||||
case 5: pos= (my_off_t) mi_uint5korr(after_key); break;
|
||||
|
|
@ -750,8 +758,9 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
|
|||
key+= length; /* Same diff_key as prev */
|
||||
if (length > keyseg->length)
|
||||
{
|
||||
DBUG_PRINT("error",("Found too long null packed key: %d of %d at %lx",
|
||||
length, keyseg->length, *page_pos));
|
||||
DBUG_PRINT("error",
|
||||
("Found too long null packed key: %u of %u at %p",
|
||||
length, keyseg->length, *page_pos));
|
||||
DBUG_DUMP("key",(char*) *page_pos,16);
|
||||
my_errno=HA_ERR_CRASHED;
|
||||
return 0;
|
||||
|
|
@ -806,7 +815,7 @@ uint _mi_get_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
|
|||
}
|
||||
if (length > (uint) keyseg->length)
|
||||
{
|
||||
DBUG_PRINT("error",("Found too long packed key: %d of %d at %lx",
|
||||
DBUG_PRINT("error",("Found too long packed key: %u of %u at %p",
|
||||
length, keyseg->length, *page_pos));
|
||||
DBUG_DUMP("key",(char*) *page_pos,16);
|
||||
my_errno=HA_ERR_CRASHED;
|
||||
|
|
@ -861,7 +870,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
|
|||
{
|
||||
if (length > keyinfo->maxlength)
|
||||
{
|
||||
DBUG_PRINT("error",("Found too long binary packed key: %d of %d at %lx",
|
||||
DBUG_PRINT("error",("Found too long binary packed key: %u of %u at %p",
|
||||
length, keyinfo->maxlength, *page_pos));
|
||||
DBUG_DUMP("key",(char*) *page_pos,16);
|
||||
my_errno=HA_ERR_CRASHED;
|
||||
|
|
@ -908,7 +917,7 @@ uint _mi_get_binary_pack_key(register MI_KEYDEF *keyinfo, uint nod_flag,
|
|||
length-=tmp;
|
||||
from=page; from_end=page_end;
|
||||
}
|
||||
DBUG_PRINT("info",("key: %lx from: %lx length: %u",
|
||||
DBUG_PRINT("info",("key: %p from: %p length: %u",
|
||||
key, from, length));
|
||||
memcpy_overlap((byte*) key, (byte*) from, (size_t) length);
|
||||
key+=length;
|
||||
|
|
@ -964,7 +973,7 @@ uchar *_mi_get_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
|
|||
}
|
||||
}
|
||||
}
|
||||
DBUG_PRINT("exit",("page: %lx length: %d",page,*return_key_length));
|
||||
DBUG_PRINT("exit",("page: %p length: %u", page, *return_key_length));
|
||||
DBUG_RETURN(page);
|
||||
} /* _mi_get_key */
|
||||
|
||||
|
|
@ -1015,7 +1024,7 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
|
|||
uint nod_flag;
|
||||
uchar *lastpos;
|
||||
DBUG_ENTER("_mi_get_last_key");
|
||||
DBUG_PRINT("enter",("page: %lx endpos: %lx",page,endpos));
|
||||
DBUG_PRINT("enter",("page: %p endpos: %p", page, endpos));
|
||||
|
||||
nod_flag=mi_test_if_nod(page);
|
||||
if (! (keyinfo->flag & (HA_VAR_LENGTH_KEY | HA_BINARY_PACK_KEY)))
|
||||
|
|
@ -1035,13 +1044,13 @@ uchar *_mi_get_last_key(MI_INFO *info, MI_KEYDEF *keyinfo, uchar *page,
|
|||
*return_key_length=(*keyinfo->get_key)(keyinfo,nod_flag,&page,lastkey);
|
||||
if (*return_key_length == 0)
|
||||
{
|
||||
DBUG_PRINT("error",("Couldn't find last key: page: %lx",page));
|
||||
DBUG_PRINT("error",("Couldn't find last key: page: %p", page));
|
||||
my_errno=HA_ERR_CRASHED;
|
||||
DBUG_RETURN(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
DBUG_PRINT("exit",("lastpos: %lx length: %d",lastpos,*return_key_length));
|
||||
DBUG_PRINT("exit",("lastpos: %p length: %u", lastpos, *return_key_length));
|
||||
DBUG_RETURN(lastpos);
|
||||
} /* _mi_get_last_key */
|
||||
|
||||
|
|
@ -1126,8 +1135,9 @@ int _mi_search_next(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||
uint nod_flag;
|
||||
uchar lastkey[MI_MAX_KEY_BUFF];
|
||||
DBUG_ENTER("_mi_search_next");
|
||||
DBUG_PRINT("enter",("nextflag: %d lastpos: %ld int_keypos: %lx",
|
||||
nextflag,(long) info->lastpos,info->int_keypos));
|
||||
DBUG_PRINT("enter",("nextflag: %u lastpos: %lu int_keypos: %lu",
|
||||
nextflag, (ulong) info->lastpos,
|
||||
(ulong) info->int_keypos));
|
||||
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,keyinfo->seg,key,key_length););
|
||||
|
||||
/* Force full read if we are at last key or if we are not on a leaf
|
||||
|
|
@ -1234,7 +1244,7 @@ int _mi_search_first(register MI_INFO *info, register MI_KEYDEF *keyinfo,
|
|||
info->page_changed=info->buff_used=0;
|
||||
info->lastpos=_mi_dpos(info,0,info->lastkey+info->lastkey_length);
|
||||
|
||||
DBUG_PRINT("exit",("found key at %ld",(ulong) info->lastpos));
|
||||
DBUG_PRINT("exit",("found key at %lu", (ulong) info->lastpos));
|
||||
DBUG_RETURN(0);
|
||||
} /* _mi_search_first */
|
||||
|
||||
|
|
@ -1468,8 +1478,8 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
|
|||
}
|
||||
s_temp->totlength=(uint) length;
|
||||
s_temp->prev_length=0;
|
||||
DBUG_PRINT("test",("tot_length: %d length: %d uniq_key_length: %d",
|
||||
key_length,length,s_temp->key_length));
|
||||
DBUG_PRINT("test",("tot_length: %u length: %d uniq_key_length: %u",
|
||||
key_length, length, s_temp->key_length));
|
||||
|
||||
/* If something after that hasn't length=0, test if we can combine */
|
||||
if ((s_temp->next_key_pos=next_key))
|
||||
|
|
@ -1575,7 +1585,7 @@ _mi_calc_var_pack_key_length(MI_KEYDEF *keyinfo,uint nod_flag,uchar *next_key,
|
|||
ref_length=0;
|
||||
next_length_pack=0;
|
||||
}
|
||||
DBUG_PRINT("test",("length: %d next_key: %lx",length,next_key));
|
||||
DBUG_PRINT("test",("length: %d next_key: %p", length, next_key));
|
||||
|
||||
{
|
||||
uint tmp_length;
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ int main(int argc,char *argv[])
|
|||
struct { MI_INFO *info; } aio0, *aio=&aio0; /* for GWS_IN_USE */
|
||||
|
||||
MY_INIT(argv[0]);
|
||||
if ((error=handle_options(&argc, &argv, my_long_options, get_one_option)))
|
||||
if (error=handle_options(&argc, &argv, my_long_options, get_one_option))
|
||||
exit(error);
|
||||
if (count || dump)
|
||||
verbose=0;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ enum options_mc {
|
|||
OPT_KEY_CACHE_BLOCK_SIZE, OPT_MYISAM_BLOCK_SIZE,
|
||||
OPT_READ_BUFFER_SIZE, OPT_WRITE_BUFFER_SIZE, OPT_SORT_BUFFER_SIZE,
|
||||
OPT_SORT_KEY_BLOCKS, OPT_DECODE_BITS, OPT_FT_MIN_WORD_LEN,
|
||||
OPT_FT_MAX_WORD_LEN, OPT_FT_MAX_WORD_LEN_FOR_SORT, OPT_FT_STOPWORD_FILE,
|
||||
OPT_FT_MAX_WORD_LEN, OPT_FT_STOPWORD_FILE,
|
||||
OPT_MAX_RECORD_LENGTH
|
||||
};
|
||||
|
||||
|
|
@ -328,11 +328,11 @@ static struct my_option my_long_options[] =
|
|||
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len,
|
||||
(gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXCHARLEN, 10,
|
||||
HA_FT_MAXCHARLEN, 0, 1, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{ "ft_stopword_file", OPT_FT_STOPWORD_FILE,
|
||||
"Use stopwords from this file instead of built-in list.",
|
||||
(gptr*) &ft_stopword_file, (gptr*) &ft_stopword_file, 0, GET_STR,
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0}
|
||||
REQUIRED_ARG, 0, 0, 0, 0, 0, 0},
|
||||
{ 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -204,7 +204,7 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
|
|||
reinit_io_cache(&tempfile,READ_CACHE,0L,0,0))
|
||||
goto err; /* purecov: inspected */
|
||||
if (!no_messages)
|
||||
puts(" - Last merge and dumping keys\n"); /* purecov: tested */
|
||||
printf(" - Last merge and dumping keys\n"); /* purecov: tested */
|
||||
if (merge_index(info,keys,sort_keys,dynamic_element(&buffpek,0,BUFFPEK *),
|
||||
maxbuffer,&tempfile))
|
||||
goto err; /* purecov: inspected */
|
||||
|
|
@ -219,6 +219,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
|
|||
uint keyno=info->key;
|
||||
uint key_length, ref_length=index->s->rec_reflength;
|
||||
|
||||
if (!no_messages)
|
||||
printf(" - Adding exceptions\n"); /* purecov: tested */
|
||||
if (flush_io_cache(&tempfile_for_exceptions) ||
|
||||
reinit_io_cache(&tempfile_for_exceptions,READ_CACHE,0L,0,0))
|
||||
goto err;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue