Commit 49d49e2f authored by serg@serg.mylan's avatar serg@serg.mylan

Merge bk-internal.mysql.com:/home/bk/mysql-4.1/

into serg.mylan:/usr/home/serg/Abk/mysql-4.1
parents 124f5be3 994d648d
......@@ -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
......
......@@ -2020,12 +2020,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 +2427,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 +2640,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,25 +3955,28 @@ static ha_checksum mi_byte_checksum(const byte *buf, uint length)
return crc;
}
/*
Deactive 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.
Note that 'rows' may be zero for the case when we don't know how many
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;
{
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));
}
/*
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.
Note that 'rows' may be zero for the case when we don't know how many
rows we will put into the file.
*/
void mi_disable_non_unique_index(MI_INFO *info, ha_rows rows)
{
......
......@@ -451,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) ' ')
{
......
......@@ -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
};
......
......@@ -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;
......
......@@ -428,6 +428,22 @@ select * from t1 where a='807780' and b='477' and c='165';
a b c
807780 477 165
drop table t1;
DROP TABLE IF EXISTS t1;
Warnings:
Note 1051 Unknown table 't1'
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a));
INSERT t1 VALUES ("can \tcan");
INSERT t1 VALUES ("can can");
INSERT t1 VALUES ("can");
SELECT * FROM t1;
a
can can
can
can can
CHECK TABLE t1;
Table Op Msg_type Msg_text
test.t1 check status OK
DROP TABLE t1;
create table t1 (a blob);
insert into t1 values('a '),('a');
select concat(a,'.') from t1 where a='a';
......
......@@ -422,6 +422,18 @@ insert into t1 values('807780', '472', '162');
select * from t1 where a='807780' and b='477' and c='165';
drop table t1;
#
# space-stripping in _mi_prefix_search: BUG#5284
#
DROP TABLE IF EXISTS t1;
CREATE TABLE t1 (a varchar(150) NOT NULL, KEY (a));
INSERT t1 VALUES ("can \tcan");
INSERT t1 VALUES ("can can");
INSERT t1 VALUES ("can");
SELECT * FROM t1;
CHECK TABLE t1;
DROP TABLE t1;
#
# Verify blob handling
#
......
......@@ -783,10 +783,10 @@ int key_cmp(KEY_PART_INFO *key_part, const byte *key, uint key_length);
bool init_errmessage(void);
void sql_perror(const char *message);
void vprint_msg_to_log( enum loglevel level, const char *format, va_list args );
void sql_print_error( const char *format, ... );
void sql_print_warning( const char *format, ...);
void sql_print_information( const char *format, ...);
void vprint_msg_to_log(enum loglevel level, const char *format, va_list args);
void sql_print_error(const char *format, ...);
void sql_print_warning(const char *format, ...);
void sql_print_information(const char *format, ...);
......
This diff is collapsed.
......@@ -251,9 +251,9 @@ my_bool acl_init(THD *org_thd, bool dont_read_acl_tables)
{
global_system_variables.old_passwords= 1;
pthread_mutex_unlock(&LOCK_global_system_variables);
sql_print_error("mysql.user table is not updated to new password format; "
"Disabling new password usage until "
"mysql_fix_privilege_tables is run");
sql_print_warning("mysql.user table is not updated to new password format; "
"Disabling new password usage until "
"mysql_fix_privilege_tables is run");
}
thd->variables.old_passwords= 1;
}
......
......@@ -1560,8 +1560,8 @@ my_tz_init(THD *org_thd, const char *default_tzname, my_bool bootstrap)
if (open_tables(thd, tables_buff, &counter) ||
lock_tables(thd, tables_buff, counter))
{
sql_print_error("Warning: Can't open and lock time zone table: %s "
"trying to live without them", thd->net.last_error);
sql_print_warning("Can't open and lock time zone table: %s "
"trying to live without them", thd->net.last_error);
/* We will try emulate that everything is ok */
return_val= time_zone_tables_exist= 0;
goto end_with_setting_default_tz;
......@@ -1740,8 +1740,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if (!(alloc_buff= alloc_root(&tz_storage, sizeof(TIME_ZONE_INFO) +
tz_name->length() + 1)))
{
sql_print_error("Error: Out of memory while loading time zone "
"description");
sql_print_error("Out of memory while loading time zone description");
return 0;
}
tz_info= (TIME_ZONE_INFO *)alloc_buff;
......@@ -1757,7 +1756,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
Let us find out time zone id by its name (there is only one index
and it is specifically for this purpose).
*/
table= tz_tables->table;
table= tz_tables->table;
tz_tables= tz_tables->next;
table->field[0]->store(tz_name->ptr(), tz_name->length(), &my_charset_latin1);
/*
......@@ -1770,7 +1769,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
0, HA_READ_KEY_EXACT))
{
sql_print_error("Error: Can't find description of time zone.");
sql_print_error("Can't find description of time zone.");
goto end;
}
......@@ -1783,7 +1782,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
understand whenever this timezone uses leap seconds (again we are
using the only index in this table).
*/
table= tz_tables->table;
table= tz_tables->table;
tz_tables= tz_tables->next;
table->field[0]->store((longlong)tzid);
(void)table->file->ha_index_init(0);
......@@ -1791,7 +1790,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
if (table->file->index_read(table->record[0], (byte*)table->field[0]->ptr,
0, HA_READ_KEY_EXACT))
{
sql_print_error("Error: Can't find description of time zone.");
sql_print_error("Can't find description of time zone.");
goto end;
}
......@@ -1810,7 +1809,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
only for our time zone guess what are we doing?
Right - using special index.
*/
table= tz_tables->table;
table= tz_tables->table;
tz_tables= tz_tables->next;
table->field[0]->store((longlong)tzid);
(void)table->file->ha_index_init(0);
......@@ -1948,8 +1947,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
#endif
sizeof(TRAN_TYPE_INFO) * tz_info->typecnt)))
{
sql_print_error("Error: Out of memory while loading time zone "
"description");
sql_print_error("Out of memory while loading time zone description");
goto end;
}
......@@ -1974,12 +1972,12 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
*/
if (tz_info->typecnt < 1)
{
sql_print_error("Error: loading time zone without transition types");
sql_print_error("loading time zone without transition types");
goto end;
}
if (prepare_tz_info(tz_info, &tz_storage))
{
sql_print_error("Error: Unable to build mktime map for time zone");
sql_print_error("Unable to build mktime map for time zone");
goto end;
}
......@@ -1991,7 +1989,7 @@ tz_load_from_open_tables(const String *tz_name, TABLE_LIST *tz_tables)
&my_charset_latin1),
my_hash_insert(&tz_names, (const byte *)tmp_tzname)))
{
sql_print_error("Error: Out of memory while loading time zone");
sql_print_error("Out of memory while loading time zone");
goto end;
}
......
This diff is collapsed.
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