Fixed for Ia64 + delayed key creation + a lot of small bug fixes
This commit is contained in:
parent
807460bbce
commit
ea013c2152
@ -1,14 +1 @@
|
|||||||
tim@localhost.polyesthetic.msg
|
monty@donna.mysql.com
|
||||||
tim@work.mysql.com
|
|
||||||
monty@work.mysql.com
|
|
||||||
tonu@work.mysql.com
|
|
||||||
sinisa@work.mysql.com
|
|
||||||
paul@work.mysql.com
|
|
||||||
jamppa@work.mysql.com
|
|
||||||
davida@work.mysql.com
|
|
||||||
matt@work.mysql.com
|
|
||||||
serg@work.mysql.com
|
|
||||||
bk@work.mysql.com
|
|
||||||
sasha@mysql.sashanet.com
|
|
||||||
sasha@work.mysql.com
|
|
||||||
jcole@jcole.burghcom.com
|
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
# Monty
|
|
||||||
|
|
||||||
# Normally you do not need to remake the files here. But if you want
|
# Normally you do not need to remake the files here. But if you want
|
||||||
# to you will need the GNU TeX-info utilities. To make a Postscript
|
# to you will need the GNU TeX-info utilities. To make a Postscript
|
||||||
# files you also need TeX and dvips. To make the PDF file you will
|
# files you also need TeX and dvips. To make the PDF file you will
|
||||||
|
@ -121,6 +121,28 @@ After this it will give other threads a possibility to open the
|
|||||||
same tables.
|
same tables.
|
||||||
@end itemize
|
@end itemize
|
||||||
|
|
||||||
|
@node Filesort
|
||||||
|
@chapter How do MySQL do sorting (filesort)
|
||||||
|
|
||||||
|
- Read all rows according to key or by table-scanning.
|
||||||
|
- Store the sort-key in a buffer (sort_buffer).
|
||||||
|
- When the buffer gets full, run a qsort on it and store the result
|
||||||
|
in a temporary file. Save a pointer to the sorted block.
|
||||||
|
- Repeate the above until all rows has been read.
|
||||||
|
|
||||||
|
- Repeat the following until there is less than MERGEBUFF2 (15) blocks left.
|
||||||
|
- Do a multi-merge of up to MERGEBUFF (7) regions to one block in
|
||||||
|
another temporary file. Repeat until all blocks from the first file
|
||||||
|
is in the second file.
|
||||||
|
- On the last multi-merge, only the pointer to the row (last part of
|
||||||
|
the sort-key) is written to a result file.
|
||||||
|
|
||||||
|
- Now the code in sql/records.cc will be used to read through the
|
||||||
|
in sorted order by using the row pointersin the result file.
|
||||||
|
To optimize this, we read in a big block of row pointers, sort these
|
||||||
|
and then we read the rows in the sorted order into a row buffer
|
||||||
|
(record_buffer) .
|
||||||
|
|
||||||
@node Index
|
@node Index
|
||||||
@unnumbered Index
|
@unnumbered Index
|
||||||
|
|
||||||
|
686
Docs/manual.texi
686
Docs/manual.texi
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@ int heap_rnext(HP_INFO *info, byte *record)
|
|||||||
pos=0; /* Read next after last */
|
pos=0; /* Read next after last */
|
||||||
my_errno=HA_ERR_KEY_NOT_FOUND;
|
my_errno=HA_ERR_KEY_NOT_FOUND;
|
||||||
}
|
}
|
||||||
else if (!info->current_ptr && (info->update & HA_STATE_PREV_FOUND))
|
else if (!info->current_ptr) /* Deleted or first call */
|
||||||
pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 0);
|
pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 0);
|
||||||
else
|
else
|
||||||
pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 1);
|
pos= _hp_search(info,share->keydef+info->lastinx, info->lastkey, 1);
|
||||||
|
@ -85,9 +85,6 @@
|
|||||||
|
|
||||||
typedef unsigned short ushort;
|
typedef unsigned short ushort;
|
||||||
typedef unsigned int uint;
|
typedef unsigned int uint;
|
||||||
#ifndef _WIN64
|
|
||||||
typedef unsigned int size_t;
|
|
||||||
#endif
|
|
||||||
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
|
typedef unsigned __int64 ulonglong; /* Microsofts 64 bit types */
|
||||||
typedef __int64 longlong;
|
typedef __int64 longlong;
|
||||||
typedef int sigset_t;
|
typedef int sigset_t;
|
||||||
@ -96,6 +93,12 @@ typedef int sigset_t;
|
|||||||
Use my_off_t or os_off_t instead */
|
Use my_off_t or os_off_t instead */
|
||||||
typedef long off_t;
|
typedef long off_t;
|
||||||
typedef __int64 os_off_t;
|
typedef __int64 os_off_t;
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef UINT_PTR rf_SetTimer;
|
||||||
|
#else
|
||||||
|
typedef unsigned int size_t;
|
||||||
|
typedef uint rf_SetTimer;
|
||||||
|
#endif
|
||||||
|
|
||||||
#define Socket_defined
|
#define Socket_defined
|
||||||
#define my_socket SOCKET
|
#define my_socket SOCKET
|
||||||
@ -288,4 +291,3 @@ inline double ulonglong2double(ulonglong value)
|
|||||||
#define statistic_add(V,C,L) (V)+=(C)
|
#define statistic_add(V,C,L) (V)+=(C)
|
||||||
#endif
|
#endif
|
||||||
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
#define statistic_increment(V,L) thread_safe_increment((V),(L))
|
||||||
|
|
||||||
|
@ -572,7 +572,9 @@ typedef long longlong;
|
|||||||
#endif
|
#endif
|
||||||
#undef SIZEOF_OFF_T
|
#undef SIZEOF_OFF_T
|
||||||
#define SIZEOF_OFF_T 8
|
#define SIZEOF_OFF_T 8
|
||||||
#endif
|
#else
|
||||||
|
#define SYSTEM_SIZEOF_OFF_T SIZEOF_OFF_T
|
||||||
|
#endif /* USE_RAID */
|
||||||
|
|
||||||
#if SIZEOF_OFF_T > 4
|
#if SIZEOF_OFF_T > 4
|
||||||
typedef ulonglong my_off_t;
|
typedef ulonglong my_off_t;
|
||||||
|
@ -262,4 +262,11 @@ typedef ulong ha_rows;
|
|||||||
|
|
||||||
#define HA_POS_ERROR (~ (ha_rows) 0)
|
#define HA_POS_ERROR (~ (ha_rows) 0)
|
||||||
#define HA_OFFSET_ERROR (~ (my_off_t) 0)
|
#define HA_OFFSET_ERROR (~ (my_off_t) 0)
|
||||||
|
|
||||||
|
#if SYSTEM_SIZEOF_OFF_T == 4
|
||||||
|
#define MAX_FILE_SIZE INT_MAX32
|
||||||
|
#else
|
||||||
|
#define MAX_FILE_SIZE LONGLONG_MAX
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* _my_base_h */
|
#endif /* _my_base_h */
|
||||||
|
@ -43,6 +43,8 @@ extern "C" {
|
|||||||
#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
|
#define MI_MAX_MSG_BUF 1024 /* used in CHECK TABLE, REPAIR TABLE */
|
||||||
#define MI_NAME_IEXT ".MYI"
|
#define MI_NAME_IEXT ".MYI"
|
||||||
#define MI_NAME_DEXT ".MYD"
|
#define MI_NAME_DEXT ".MYD"
|
||||||
|
/* Max extra space to use when sorting keys */
|
||||||
|
#define MI_MAX_TEMP_LENGTH 1024L*1024L*1024L
|
||||||
|
|
||||||
#define mi_portable_sizeof_char_ptr 8
|
#define mi_portable_sizeof_char_ptr 8
|
||||||
|
|
||||||
@ -266,6 +268,10 @@ extern uint mi_get_pointer_length(ulonglong file_length, uint def);
|
|||||||
#define T_UPDATE_STATE T_CHECK*2
|
#define T_UPDATE_STATE T_CHECK*2
|
||||||
#define T_CHECK_ONLY_CHANGED T_UPDATE_STATE*2
|
#define T_CHECK_ONLY_CHANGED T_UPDATE_STATE*2
|
||||||
#define T_DONT_CHECK_CHECKSUM T_CHECK_ONLY_CHANGED*2
|
#define T_DONT_CHECK_CHECKSUM T_CHECK_ONLY_CHANGED*2
|
||||||
|
#define T_TRUST_HEADER T_DONT_CHECK_CHECKSUM*2
|
||||||
|
#define T_CREATE_MISSING_KEYS T_TRUST_HEADER*2
|
||||||
|
#define T_SAFE_REPAIR T_CREATE_MISSING_KEYS*2
|
||||||
|
#define T_AUTO_REPAIR T_SAFE_REPAIR*2
|
||||||
|
|
||||||
#define O_NEW_INDEX 1 /* Bits set in out_flag */
|
#define O_NEW_INDEX 1 /* Bits set in out_flag */
|
||||||
#define O_NEW_DATA 2
|
#define O_NEW_DATA 2
|
||||||
@ -370,6 +376,8 @@ int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages,
|
|||||||
ulong);
|
ulong);
|
||||||
int test_if_almost_full(MI_INFO *info);
|
int test_if_almost_full(MI_INFO *info);
|
||||||
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
|
int recreate_table(MI_CHECK *param, MI_INFO **org_info, char *filename);
|
||||||
|
void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows);
|
||||||
|
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
@ -342,7 +342,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((flag = my_strnncoll(default_charset_info,
|
if ((flag = my_strnncoll(default_charset_info,
|
||||||
a, (end-a), b, b_length)))
|
a, (int) (end-a), b, b_length)))
|
||||||
return (keyseg->base.flag & HA_REVERSE_SORT) ? -flag : flag;
|
return (keyseg->base.flag & HA_REVERSE_SORT) ? -flag : flag;
|
||||||
b+= (uint) (end-a);
|
b+= (uint) (end-a);
|
||||||
a=end;
|
a=end;
|
||||||
@ -393,7 +393,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((flag = my_strnncoll(default_charset_info,
|
if ((flag = my_strnncoll(default_charset_info,
|
||||||
a, (end-a), b, (end-a))))
|
a, (int) (end-a), b, (int) (end-a))))
|
||||||
return (keyseg->base.flag & HA_REVERSE_SORT) ? -flag : flag;
|
return (keyseg->base.flag & HA_REVERSE_SORT) ? -flag : flag;
|
||||||
b+= (uint) (end-a);
|
b+= (uint) (end-a);
|
||||||
a=end;
|
a=end;
|
||||||
|
@ -82,7 +82,7 @@ int mrg_rrnd(MRG_INFO *info,byte *buf,mrg_off_t filepos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->current_table=find_table(info->open_tables,
|
info->current_table=find_table(info->open_tables,
|
||||||
info->last_used_table,filepos);
|
info->end_table,filepos);
|
||||||
isam_info=info->current_table->table;
|
isam_info=info->current_table->table;
|
||||||
isam_info->update&= HA_STATE_CHANGED;
|
isam_info->update&= HA_STATE_CHANGED;
|
||||||
return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf,
|
return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf,
|
||||||
|
@ -84,7 +84,7 @@ int main(int argc,char *argv[])
|
|||||||
for(i=1;create_record(record,qf);i++) {
|
for(i=1;create_record(record,qf);i++) {
|
||||||
FT_DOCLIST *result; double w; int t;
|
FT_DOCLIST *result; double w; int t;
|
||||||
|
|
||||||
result=ft_init_search(file,0,blob_record,strlen(blob_record),1);
|
result=ft_init_search(file,0,blob_record,(uint) strlen(blob_record),1);
|
||||||
if(!result) {
|
if(!result) {
|
||||||
printf("Query %d failed with errno %3d\n",i,my_errno);
|
printf("Query %d failed with errno %3d\n",i,my_errno);
|
||||||
goto err;
|
goto err;
|
||||||
@ -177,7 +177,7 @@ int create_record(char *pos, FILE *file)
|
|||||||
{
|
{
|
||||||
if(feof(file)) return 0; else print_error(1,"fgets(docid) - 1");
|
if(feof(file)) return 0; else print_error(1,"fgets(docid) - 1");
|
||||||
}
|
}
|
||||||
tmp=strlen(pos+2)-1;
|
tmp=(uint) strlen(pos+2)-1;
|
||||||
int2store(pos,tmp);
|
int2store(pos,tmp);
|
||||||
pos+=recinfo[0].length;
|
pos+=recinfo[0].length;
|
||||||
|
|
||||||
@ -185,7 +185,7 @@ int create_record(char *pos, FILE *file)
|
|||||||
|
|
||||||
if(!(fgets(blob_record,MAX_BLOB_LENGTH,file)))
|
if(!(fgets(blob_record,MAX_BLOB_LENGTH,file)))
|
||||||
print_error(1,"fgets(docid) - 2");
|
print_error(1,"fgets(docid) - 2");
|
||||||
tmp=strlen(blob_record);
|
tmp=(uint) strlen(blob_record);
|
||||||
int4store(pos,tmp);
|
int4store(pos,tmp);
|
||||||
ptr=blob_record;
|
ptr=blob_record;
|
||||||
memcpy_fixed(pos+4,&ptr,sizeof(char*));
|
memcpy_fixed(pos+4,&ptr,sizeof(char*));
|
||||||
|
@ -140,7 +140,7 @@ TREE * ft_parse(TREE *wtree, byte *doc, int doclen)
|
|||||||
if(word_char(*doc)) break;
|
if(word_char(*doc)) break;
|
||||||
for(w.pos=doc; doc<end; doc++)
|
for(w.pos=doc; doc<end; doc++)
|
||||||
if(!word_char(*doc)) break;
|
if(!word_char(*doc)) break;
|
||||||
if((w.len=doc-w.pos) < MIN_WORD_LEN) continue;
|
if((w.len= (uint) (doc-w.pos)) < MIN_WORD_LEN) continue;
|
||||||
if(!tree_insert(wtree, &w, 0))
|
if(!tree_insert(wtree, &w, 0))
|
||||||
{
|
{
|
||||||
delete_tree(wtree);
|
delete_tree(wtree);
|
||||||
|
@ -20,18 +20,18 @@
|
|||||||
|
|
||||||
const MI_KEYSEG ft_keysegs[FT_SEGS]={
|
const MI_KEYSEG ft_keysegs[FT_SEGS]={
|
||||||
{
|
{
|
||||||
HA_KEYTYPE_VARTEXT, // type
|
HA_KEYTYPE_VARTEXT, /* type */
|
||||||
7, // language
|
7, /* language */
|
||||||
0, 0, 0, // null_bit, bit_start, bit_end
|
0, 0, 0, /* null_bit, bit_start, bit_end */
|
||||||
HA_VAR_LENGTH | HA_PACK_KEY, // flag
|
HA_VAR_LENGTH | HA_PACK_KEY, /* flag */
|
||||||
HA_FT_MAXLEN, // length
|
HA_FT_MAXLEN, /* length */
|
||||||
#ifdef EVAL_RUN
|
#ifdef EVAL_RUN
|
||||||
HA_FT_WLEN+1, // start
|
HA_FT_WLEN+1, /* start */
|
||||||
#else /* EVAL_RUN */
|
#else /* EVAL_RUN */
|
||||||
HA_FT_WLEN, // start
|
HA_FT_WLEN, /* start */
|
||||||
#endif /* EVAL_RUN */
|
#endif /* EVAL_RUN */
|
||||||
0, // null_pos
|
0, /* null_pos */
|
||||||
NULL // sort_order
|
NULL /* sort_order */
|
||||||
},
|
},
|
||||||
#ifdef EVAL_RUN
|
#ifdef EVAL_RUN
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr)
|
|||||||
if (next_link > info->state->key_file_length ||
|
if (next_link > info->state->key_file_length ||
|
||||||
next_link & (info->s->blocksize-1))
|
next_link & (info->s->blocksize-1))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
if (!(buff=key_cache_read(info->s->kfile, next_link, info->buff,
|
if (!(buff=key_cache_read(info->s->kfile, next_link, (byte*) info->buff,
|
||||||
myisam_block_size, block_size, 1)))
|
myisam_block_size, block_size, 1)))
|
||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
next_link=mi_sizekorr(buff);
|
next_link=mi_sizekorr(buff);
|
||||||
@ -1228,6 +1228,8 @@ err:
|
|||||||
VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
|
VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
|
||||||
MYF(MY_WME)));
|
MYF(MY_WME)));
|
||||||
}
|
}
|
||||||
|
mi_mark_crashed_on_repair(info);
|
||||||
|
info->update|= HA_STATE_CHANGED;
|
||||||
}
|
}
|
||||||
if (sort_info->record)
|
if (sort_info->record)
|
||||||
my_free(sort_info->record,MYF(0));
|
my_free(sort_info->record,MYF(0));
|
||||||
@ -1580,7 +1582,7 @@ err:
|
|||||||
DBUG_RETURN(1);
|
DBUG_RETURN(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fix table using sorting */
|
/* Fix table or given index using sorting */
|
||||||
/* saves new table in temp_filename */
|
/* saves new table in temp_filename */
|
||||||
|
|
||||||
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
||||||
@ -1597,6 +1599,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||||||
ulong *rec_per_key_part;
|
ulong *rec_per_key_part;
|
||||||
char llbuff[22];
|
char llbuff[22];
|
||||||
SORT_INFO *sort_info= ¶m->sort_info;
|
SORT_INFO *sort_info= ¶m->sort_info;
|
||||||
|
ulonglong key_map=share->state.key_map;
|
||||||
DBUG_ENTER("rep_by_sort");
|
DBUG_ENTER("rep_by_sort");
|
||||||
|
|
||||||
start_records=info->state->records;
|
start_records=info->state->records;
|
||||||
@ -1621,7 +1624,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||||||
init_io_cache(&info->rec_cache,info->dfile,
|
init_io_cache(&info->rec_cache,info->dfile,
|
||||||
(uint) param->write_buffer_length,
|
(uint) param->write_buffer_length,
|
||||||
WRITE_CACHE,new_header_length,1,
|
WRITE_CACHE,new_header_length,1,
|
||||||
MYF(MY_WME | MY_WAIT_IF_FULL))))
|
MYF(MY_WME | MY_WAIT_IF_FULL) & param->myf_rw)))
|
||||||
goto err;
|
goto err;
|
||||||
sort_info->key_block_end=sort_info->key_block+param->sort_key_blocks;
|
sort_info->key_block_end=sort_info->key_block+param->sort_key_blocks;
|
||||||
info->opt_flag|=WRITE_CACHE_USED;
|
info->opt_flag|=WRITE_CACHE_USED;
|
||||||
@ -1664,10 +1667,15 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||||||
}
|
}
|
||||||
|
|
||||||
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
|
info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
|
||||||
|
if (!(param->testflag & T_CREATE_MISSING_KEYS))
|
||||||
|
{
|
||||||
for (i=0 ; i < share->base.keys ; i++)
|
for (i=0 ; i < share->base.keys ; i++)
|
||||||
share->state.key_root[i]= HA_OFFSET_ERROR;
|
share->state.key_root[i]= HA_OFFSET_ERROR;
|
||||||
for (i=0 ; i < share->state.header.max_block_size ; i++)
|
for (i=0 ; i < share->state.header.max_block_size ; i++)
|
||||||
share->state.key_del[i]= HA_OFFSET_ERROR;
|
share->state.key_del[i]= HA_OFFSET_ERROR;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
key_map= ~key_map; /* Create the missing keys */
|
||||||
|
|
||||||
info->state->key_file_length=share->base.keystart;
|
info->state->key_file_length=share->base.keystart;
|
||||||
|
|
||||||
@ -1696,7 +1704,8 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||||||
else
|
else
|
||||||
length=share->base.pack_reclength;
|
length=share->base.pack_reclength;
|
||||||
sort_param.max_records=sort_info->max_records=
|
sort_param.max_records=sort_info->max_records=
|
||||||
(ha_rows) (sort_info->filelength/length+1);
|
((param->testflag & T_TRUST_HEADER) ? info->state->records :
|
||||||
|
(ha_rows) (sort_info->filelength/length+1));
|
||||||
sort_param.key_cmp=sort_key_cmp;
|
sort_param.key_cmp=sort_key_cmp;
|
||||||
sort_param.key_write=sort_key_write;
|
sort_param.key_write=sort_key_write;
|
||||||
sort_param.key_read=sort_key_read;
|
sort_param.key_read=sort_key_read;
|
||||||
@ -1714,7 +1723,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||||||
rec_per_key_part+=sort_info->keyinfo->keysegs, sort_info->key++)
|
rec_per_key_part+=sort_info->keyinfo->keysegs, sort_info->key++)
|
||||||
{
|
{
|
||||||
sort_info->keyinfo=share->keyinfo+sort_info->key;
|
sort_info->keyinfo=share->keyinfo+sort_info->key;
|
||||||
if (!(((ulonglong) 1 << sort_info->key) & share->state.key_map))
|
if (!(((ulonglong) 1 << sort_info->key) & key_map))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((!(param->testflag & T_SILENT)))
|
if ((!(param->testflag & T_SILENT)))
|
||||||
@ -1755,6 +1764,15 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
|
|||||||
param->read_cache.end_of_file=sort_info->filepos;
|
param->read_cache.end_of_file=sort_info->filepos;
|
||||||
if (write_data_suffix(param,info) || end_io_cache(&info->rec_cache))
|
if (write_data_suffix(param,info) || end_io_cache(&info->rec_cache))
|
||||||
goto err;
|
goto err;
|
||||||
|
if (param->testflag & T_SAFE_REPAIR)
|
||||||
|
{
|
||||||
|
/* Don't repair if we loosed more than one row */
|
||||||
|
if (info->state->records+1 < start_records)
|
||||||
|
{
|
||||||
|
info->state->records=start_records;
|
||||||
|
goto err;
|
||||||
|
}
|
||||||
|
}
|
||||||
share->state.state.data_file_length = info->state->data_file_length
|
share->state.state.data_file_length = info->state->data_file_length
|
||||||
= sort_info->filepos;
|
= sort_info->filepos;
|
||||||
/* Only whole records */
|
/* Only whole records */
|
||||||
@ -1837,6 +1855,8 @@ err:
|
|||||||
VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
|
VOID(my_raid_delete(param->temp_filename,info->s->base.raid_chunks,
|
||||||
MYF(MY_WME)));
|
MYF(MY_WME)));
|
||||||
}
|
}
|
||||||
|
mi_mark_crashed_on_repair(info);
|
||||||
|
info->update|= HA_STATE_CHANGED;
|
||||||
}
|
}
|
||||||
my_free((gptr) sort_info->key_block,MYF(MY_ALLOW_ZERO_PTR));
|
my_free((gptr) sort_info->key_block,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
my_free(sort_info->record,MYF(MY_ALLOW_ZERO_PTR));
|
my_free(sort_info->record,MYF(MY_ALLOW_ZERO_PTR));
|
||||||
@ -1844,7 +1864,7 @@ err:
|
|||||||
VOID(end_io_cache(¶m->read_cache));
|
VOID(end_io_cache(¶m->read_cache));
|
||||||
VOID(end_io_cache(&info->rec_cache));
|
VOID(end_io_cache(&info->rec_cache));
|
||||||
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
|
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
|
||||||
if (!got_error && param->testflag & T_UNPACK)
|
if (!got_error && (param->testflag & T_UNPACK))
|
||||||
{
|
{
|
||||||
share->state.header.options[0]&= (uchar) ~HA_OPTION_COMPRESS_RECORD;
|
share->state.header.options[0]&= (uchar) ~HA_OPTION_COMPRESS_RECORD;
|
||||||
share->pack.header_length=0;
|
share->pack.header_length=0;
|
||||||
@ -2884,3 +2904,58 @@ ha_checksum mi_byte_checksum(const byte *buf, uint length)
|
|||||||
test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1)));
|
test(crc & (((ha_checksum) 1) << (8*sizeof(ha_checksum)-1)));
|
||||||
return crc;
|
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)
|
||||||
|
{
|
||||||
|
return (key->flag & (HA_BINARY_PACK_KEY | HA_VAR_LENGTH_KEY | HA_FULLTEXT) &&
|
||||||
|
((ulonglong) rows * key->maxlength > MAX_FILE_SIZE ||
|
||||||
|
(ulonglong) rows * (key->maxlength - key->minlength) / 2 >
|
||||||
|
MI_MAX_TEMP_LENGTH ||
|
||||||
|
(rows == 0 && (key->maxlength / key->minlength) > 2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows)
|
||||||
|
{
|
||||||
|
MYISAM_SHARE *share=info->s;
|
||||||
|
uint i;
|
||||||
|
if (!info->state->records) /* Don't do this if old rows */
|
||||||
|
{
|
||||||
|
MI_KEYDEF *key=share->keyinfo;
|
||||||
|
for (i=0 ; i < share->base.keys ; i++,key++)
|
||||||
|
{
|
||||||
|
if (!(key->flag & HA_NOSAME) && ! mi_too_big_key_for_sort(key,rows))
|
||||||
|
{
|
||||||
|
share->state.key_map&= ~ ((ulonglong) 1 << i);
|
||||||
|
info->update|= HA_STATE_CHANGED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Return TRUE if we can use repair by sorting */
|
||||||
|
|
||||||
|
my_bool mi_test_if_sort_rep(MI_INFO *info, ha_rows rows)
|
||||||
|
{
|
||||||
|
MYISAM_SHARE *share=info->s;
|
||||||
|
uint i;
|
||||||
|
MI_KEYDEF *key=share->keyinfo;
|
||||||
|
if (!share->state.key_map)
|
||||||
|
return FALSE; /* Can't use sort */
|
||||||
|
for (i=0 ; i < share->base.keys ; i++,key++)
|
||||||
|
{
|
||||||
|
if (mi_too_big_key_for_sort(key,rows))
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
@ -74,12 +74,12 @@ int mi_lock_database(MI_INFO *info, int lock_type)
|
|||||||
share->state.process= share->last_process=share->this_process;
|
share->state.process= share->last_process=share->this_process;
|
||||||
share->state.unique= info->last_unique= info->this_unique;
|
share->state.unique= info->last_unique= info->this_unique;
|
||||||
#ifndef HAVE_PREAD
|
#ifndef HAVE_PREAD
|
||||||
pthread_mutex_lock(&THR_LOCK_keycache); // QQ; Has to be removed!
|
pthread_mutex_lock(&THR_LOCK_keycache); /* QQ; Has to be removed! */
|
||||||
#endif
|
#endif
|
||||||
if (mi_state_info_write(share->kfile, &share->state, 1))
|
if (mi_state_info_write(share->kfile, &share->state, 1))
|
||||||
error=my_errno;
|
error=my_errno;
|
||||||
#ifndef HAVE_PREAD
|
#ifndef HAVE_PREAD
|
||||||
pthread_mutex_unlock(&THR_LOCK_keycache);// QQ; Has to be removed!
|
pthread_mutex_unlock(&THR_LOCK_keycache);/* QQ; Has to be removed! */
|
||||||
#endif
|
#endif
|
||||||
share->changed=0;
|
share->changed=0;
|
||||||
if (myisam_flush)
|
if (myisam_flush)
|
||||||
|
@ -284,7 +284,9 @@ struct st_myisam_info {
|
|||||||
mi_int2store(x,boh); }
|
mi_int2store(x,boh); }
|
||||||
#define mi_test_if_nod(x) (x[0] & 128 ? info->s->base.key_reflength : 0)
|
#define mi_test_if_nod(x) (x[0] & 128 ? info->s->base.key_reflength : 0)
|
||||||
#define mi_mark_crashed(x) (x)->s->state.changed|=2
|
#define mi_mark_crashed(x) (x)->s->state.changed|=2
|
||||||
|
#define mi_mark_crashed_on_repair(x) (x)->s->state.changed|=4+2
|
||||||
#define mi_is_crashed(x) ((x)->s->state.changed & 2)
|
#define mi_is_crashed(x) ((x)->s->state.changed & 2)
|
||||||
|
#define mi_is_crashed_on_repair(x) ((x)->s->state.changed & 4)
|
||||||
|
|
||||||
/* Functions to store length of space packed keys, VARCHAR or BLOB keys */
|
/* Functions to store length of space packed keys, VARCHAR or BLOB keys */
|
||||||
|
|
||||||
@ -606,6 +608,7 @@ void mi_get_status(void* param);
|
|||||||
void mi_update_status(void* param);
|
void mi_update_status(void* param);
|
||||||
void mi_copy_status(void* to,void *from);
|
void mi_copy_status(void* to,void *from);
|
||||||
my_bool mi_check_status(void* param);
|
my_bool mi_check_status(void* param);
|
||||||
|
void mi_dectivate_non_unique_index(MI_INFO *info, ha_rows rows);
|
||||||
|
|
||||||
/* Functions needed by mi_check */
|
/* Functions needed by mi_check */
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@ -249,7 +249,7 @@ static struct option long_options[] =
|
|||||||
|
|
||||||
static void print_version(void)
|
static void print_version(void)
|
||||||
{
|
{
|
||||||
printf("%s Ver 1.7 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE);
|
printf("%s Ver 1.8 for %s on %s\n",my_progname,SYSTEM_TYPE,MACHINE_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void usage(void)
|
static void usage(void)
|
||||||
|
@ -81,7 +81,7 @@ int myrg_rrnd(MYRG_INFO *info,byte *buf,ulonglong filepos)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
info->current_table=find_table(info->open_tables,
|
info->current_table=find_table(info->open_tables,
|
||||||
info->last_used_table,filepos);
|
info->end_table,filepos);
|
||||||
isam_info=info->current_table->table;
|
isam_info=info->current_table->table;
|
||||||
isam_info->update&= HA_STATE_CHANGED;
|
isam_info->update&= HA_STATE_CHANGED;
|
||||||
return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf,
|
return ((*isam_info->s->read_rnd)(isam_info,(byte*) buf,
|
||||||
|
BIN
mysql.proj
BIN
mysql.proj
Binary file not shown.
@ -112,7 +112,7 @@ static my_bool read_charset_index(TYPELIB *charsets, myf myflags)
|
|||||||
while (!get_word(&fb, buf))
|
while (!get_word(&fb, buf))
|
||||||
{
|
{
|
||||||
uint length;
|
uint length;
|
||||||
if (!(s= (char*) my_once_alloc(length=strlen(buf)+1, myflags)))
|
if (!(s= (char*) my_once_alloc(length= (uint) strlen(buf)+1, myflags)))
|
||||||
{
|
{
|
||||||
my_fclose(fb.f,myflags);
|
my_fclose(fb.f,myflags);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -292,7 +292,7 @@ static CHARSET_INFO *add_charset(uint cs_number, const char *cs_name)
|
|||||||
cs = (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),
|
cs = (CHARSET_INFO*) my_once_alloc(sizeof(CHARSET_INFO),
|
||||||
MYF(MY_WME));
|
MYF(MY_WME));
|
||||||
*cs=tmp_cs;
|
*cs=tmp_cs;
|
||||||
cs->name = (char *) my_once_alloc(strlen(cs_name) + 1, MYF(MY_WME));
|
cs->name = (char *) my_once_alloc((uint) strlen(cs_name)+1, MYF(MY_WME));
|
||||||
cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME));
|
cs->ctype = (uchar*) my_once_alloc(CTYPE_TABLE_SIZE, MYF(MY_WME));
|
||||||
cs->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE, MYF(MY_WME));
|
cs->to_lower = (uchar*) my_once_alloc(TO_LOWER_TABLE_SIZE, MYF(MY_WME));
|
||||||
cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME));
|
cs->to_upper = (uchar*) my_once_alloc(TO_UPPER_TABLE_SIZE, MYF(MY_WME));
|
||||||
@ -410,7 +410,7 @@ my_bool set_default_charset_by_name(const char *cs_name, myf flags)
|
|||||||
|
|
||||||
static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s)
|
static my_bool charset_in_string(const char *name, DYNAMIC_STRING *s)
|
||||||
{
|
{
|
||||||
uint length=strlen(name);
|
uint length= (uint) strlen(name);
|
||||||
const char *pos;
|
const char *pos;
|
||||||
for (pos=s->str ; (pos=strstr(pos,name)) ; pos++)
|
for (pos=s->str ; (pos=strstr(pos,name)) ; pos++)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,7 @@ void caseup_str(my_string str)
|
|||||||
{
|
{
|
||||||
#ifdef USE_MB
|
#ifdef USE_MB
|
||||||
register uint32 l;
|
register uint32 l;
|
||||||
register char *end=str+strlen(str);
|
register char *end=str+(uint) strlen(str);
|
||||||
if (use_mb(default_charset_info))
|
if (use_mb(default_charset_info))
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
@ -51,7 +51,7 @@ void casedn_str(my_string str)
|
|||||||
{
|
{
|
||||||
#ifdef USE_MB
|
#ifdef USE_MB
|
||||||
register uint32 l;
|
register uint32 l;
|
||||||
register char *end=str+strlen(str);
|
register char *end=str+(uint) strlen(str);
|
||||||
if (use_mb(default_charset_info))
|
if (use_mb(default_charset_info))
|
||||||
while (*str)
|
while (*str)
|
||||||
{
|
{
|
||||||
@ -144,7 +144,7 @@ int my_strcasecmp(const char *s, const char *t)
|
|||||||
{
|
{
|
||||||
#ifdef USE_MB
|
#ifdef USE_MB
|
||||||
register uint32 l;
|
register uint32 l;
|
||||||
register const char *end=s+strlen(s);
|
register const char *end=s+(uint) strlen(s);
|
||||||
if (use_mb(default_charset_info))
|
if (use_mb(default_charset_info))
|
||||||
{
|
{
|
||||||
while (s<end)
|
while (s<end)
|
||||||
|
@ -53,13 +53,13 @@ void pack_dirname(my_string to, const char *from)
|
|||||||
LINT_INIT(buff_length);
|
LINT_INIT(buff_length);
|
||||||
if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0))))
|
if (!(cwd_err= my_getwd(buff,FN_REFLEN,MYF(0))))
|
||||||
{
|
{
|
||||||
buff_length=strlen(buff);
|
buff_length= (uint) strlen(buff);
|
||||||
d_length=(uint) (start-to);
|
d_length=(uint) (start-to);
|
||||||
if ((start == to ||
|
if ((start == to ||
|
||||||
(buff_length == d_length && !bcmp(buff,start,d_length))) &&
|
(buff_length == d_length && !bcmp(buff,start,d_length))) &&
|
||||||
*start != FN_LIBCHAR && *start)
|
*start != FN_LIBCHAR && *start)
|
||||||
{ /* Put current dir before */
|
{ /* Put current dir before */
|
||||||
bchange(to,d_length,buff,buff_length,strlen(to)+1);
|
bchange(to,d_length,buff,buff_length,(uint) strlen(to)+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,7 +68,7 @@ void pack_dirname(my_string to, const char *from)
|
|||||||
length=0;
|
length=0;
|
||||||
if (home_dir)
|
if (home_dir)
|
||||||
{
|
{
|
||||||
length=strlen(home_dir);
|
length= (uint) strlen(home_dir);
|
||||||
if (home_dir[length-1] == FN_LIBCHAR)
|
if (home_dir[length-1] == FN_LIBCHAR)
|
||||||
length--; /* Don't test last '/' */
|
length--; /* Don't test last '/' */
|
||||||
}
|
}
|
||||||
@ -92,7 +92,7 @@ void pack_dirname(my_string to, const char *from)
|
|||||||
}
|
}
|
||||||
if (is_prefix(to,buff))
|
if (is_prefix(to,buff))
|
||||||
{
|
{
|
||||||
length=strlen(buff);
|
length= (uint) strlen(buff);
|
||||||
if (to[length])
|
if (to[length])
|
||||||
(void) strmov_overlapp(to,to+length); /* Remove everything before */
|
(void) strmov_overlapp(to,to+length); /* Remove everything before */
|
||||||
else
|
else
|
||||||
@ -265,7 +265,7 @@ uint unpack_dirname(my_string to, const char *from)
|
|||||||
DBUG_ENTER("unpack_dirname");
|
DBUG_ENTER("unpack_dirname");
|
||||||
|
|
||||||
(void) intern_filename(buff,from); /* Change to intern name */
|
(void) intern_filename(buff,from); /* Change to intern name */
|
||||||
length=strlen(buff); /* Fix that '/' is last */
|
length= (uint) strlen(buff); /* Fix that '/' is last */
|
||||||
if (length &&
|
if (length &&
|
||||||
#ifdef FN_DEVCHAR
|
#ifdef FN_DEVCHAR
|
||||||
buff[length-1] != FN_DEVCHAR &&
|
buff[length-1] != FN_DEVCHAR &&
|
||||||
@ -283,7 +283,7 @@ uint unpack_dirname(my_string to, const char *from)
|
|||||||
if (tilde_expansion)
|
if (tilde_expansion)
|
||||||
{
|
{
|
||||||
length-=(uint) (suffix-buff)-1;
|
length-=(uint) (suffix-buff)-1;
|
||||||
if (length+(h_length=strlen(tilde_expansion)) <= FN_REFLEN)
|
if (length+(h_length= (uint) strlen(tilde_expansion)) <= FN_REFLEN)
|
||||||
{
|
{
|
||||||
if (tilde_expansion[h_length-1] == FN_LIBCHAR)
|
if (tilde_expansion[h_length-1] == FN_LIBCHAR)
|
||||||
h_length--;
|
h_length--;
|
||||||
|
@ -46,7 +46,7 @@ my_string my_path(my_string to, const char *progname,
|
|||||||
if (!test_if_hard_path(to))
|
if (!test_if_hard_path(to))
|
||||||
{
|
{
|
||||||
if (!my_getwd(curr_dir,FN_REFLEN,MYF(0)))
|
if (!my_getwd(curr_dir,FN_REFLEN,MYF(0)))
|
||||||
bchange(to,0,curr_dir,strlen(curr_dir),strlen(to)+1);
|
bchange(to,0,curr_dir, (uint) strlen(curr_dir), (uint) strlen(to)+1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -63,7 +63,8 @@ WF_PACK *wf_comp(my_string str)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((ret= (WF_PACK*) my_malloc((uint) ant*(sizeof(my_string*)+2)+
|
if ((ret= (WF_PACK*) my_malloc((uint) ant*(sizeof(my_string*)+2)+
|
||||||
sizeof(WF_PACK)+strlen(str)+1,MYF(MY_WME)))
|
sizeof(WF_PACK)+ (uint) strlen(str)+1,
|
||||||
|
MYF(MY_WME)))
|
||||||
== 0)
|
== 0)
|
||||||
DBUG_RETURN((WF_PACK *) NULL);
|
DBUG_RETURN((WF_PACK *) NULL);
|
||||||
ret->wild= (my_string*) (ret+1);
|
ret->wild= (my_string*) (ret+1);
|
||||||
|
@ -112,7 +112,7 @@ void free_root(MEM_ROOT *root)
|
|||||||
|
|
||||||
char *strdup_root(MEM_ROOT *root,const char *str)
|
char *strdup_root(MEM_ROOT *root,const char *str)
|
||||||
{
|
{
|
||||||
uint len=strlen(str)+1;
|
uint len= (uint) strlen(str)+1;
|
||||||
char *pos;
|
char *pos;
|
||||||
if ((pos=alloc_root(root,len)))
|
if ((pos=alloc_root(root,len)))
|
||||||
memcpy(pos,str,len);
|
memcpy(pos,str,len);
|
||||||
|
@ -353,7 +353,11 @@ myf MyFlags;
|
|||||||
ushort mode;
|
ushort mode;
|
||||||
char tmp_path[FN_REFLEN],*tmp_file,attrib;
|
char tmp_path[FN_REFLEN],*tmp_file,attrib;
|
||||||
my_ptrdiff_t diff;
|
my_ptrdiff_t diff;
|
||||||
|
#ifdef _WIN64
|
||||||
|
__int64 handle;
|
||||||
|
#else
|
||||||
long handle;
|
long handle;
|
||||||
|
#endif
|
||||||
DBUG_ENTER("my_dir");
|
DBUG_ENTER("my_dir");
|
||||||
DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
|
DBUG_PRINT("my",("path: '%s' stat: %d MyFlags: %d",path,MyFlags));
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ uint32 my_lread(int Filedes, byte *Buffer, uint32 Count, myf MyFlags)
|
|||||||
Filedes, Buffer, Count, MyFlags));
|
Filedes, Buffer, Count, MyFlags));
|
||||||
|
|
||||||
/* Temp hack to get count to int32 while read wants int */
|
/* Temp hack to get count to int32 while read wants int */
|
||||||
if ((readbytes = (uint32) read(Filedes, Buffer, (size_t) Count)) != Count)
|
if ((readbytes = (uint32) read(Filedes, Buffer, (uint) Count)) != Count)
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
|
||||||
|
@ -28,7 +28,7 @@ uint32 my_lwrite(int Filedes, const byte *Buffer, uint32 Count, myf MyFlags)
|
|||||||
Filedes, Buffer, Count, MyFlags));
|
Filedes, Buffer, Count, MyFlags));
|
||||||
|
|
||||||
/* Temp hack to get count to int32 while write wants int */
|
/* Temp hack to get count to int32 while write wants int */
|
||||||
if ((writenbytes = (uint32) write(Filedes, Buffer, (size_t) Count)) != Count)
|
if ((writenbytes = (uint32) write(Filedes, Buffer, (uint) Count)) != Count)
|
||||||
{
|
{
|
||||||
my_errno=errno;
|
my_errno=errno;
|
||||||
if (writenbytes == (uint32) -1 || MyFlags & (MY_NABP | MY_FNABP))
|
if (writenbytes == (uint32) -1 || MyFlags & (MY_NABP | MY_FNABP))
|
||||||
|
@ -83,11 +83,11 @@ int pthread_create(pthread_t *thread_id, pthread_attr_t *attr,
|
|||||||
*thread_id=map->pthreadself=hThread;
|
*thread_id=map->pthreadself=hThread;
|
||||||
pthread_mutex_unlock(&THR_LOCK_thread);
|
pthread_mutex_unlock(&THR_LOCK_thread);
|
||||||
|
|
||||||
if ((long) hThread == -1L)
|
if (hThread == (HANDLE) -1)
|
||||||
{
|
{
|
||||||
long error=errno;
|
int error=errno;
|
||||||
DBUG_PRINT("error",
|
DBUG_PRINT("error",
|
||||||
("Can't create thread to handle request (error %ld)",error));
|
("Can't create thread to handle request (error %d)",error));
|
||||||
DBUG_RETURN(error ? error : -1);
|
DBUG_RETURN(error ? error : -1);
|
||||||
}
|
}
|
||||||
VOID(SetThreadPriority(hThread, attr->priority)) ;
|
VOID(SetThreadPriority(hThread, attr->priority)) ;
|
||||||
|
@ -33,7 +33,7 @@ my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str,
|
|||||||
if (!alloc_increment)
|
if (!alloc_increment)
|
||||||
alloc_increment=128;
|
alloc_increment=128;
|
||||||
length=1;
|
length=1;
|
||||||
if (init_str && (length=strlen(init_str)+1) < init_alloc)
|
if (init_str && (length= (uint) strlen(init_str)+1) < init_alloc)
|
||||||
init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment;
|
init_alloc=((length+alloc_increment-1)/alloc_increment)*alloc_increment;
|
||||||
if (!init_alloc)
|
if (!init_alloc)
|
||||||
init_alloc=alloc_increment;
|
init_alloc=alloc_increment;
|
||||||
@ -53,7 +53,7 @@ my_bool dynstr_set(DYNAMIC_STRING *str, const char *init_str)
|
|||||||
uint length;
|
uint length;
|
||||||
DBUG_ENTER("dynstr_set");
|
DBUG_ENTER("dynstr_set");
|
||||||
|
|
||||||
if (init_str && (length=strlen(init_str)+1) > str->max_length)
|
if (init_str && (length= (uint) strlen(init_str)+1) > str->max_length)
|
||||||
{
|
{
|
||||||
str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)*
|
str->max_length=((length+str->alloc_increment-1)/str->alloc_increment)*
|
||||||
str->alloc_increment;
|
str->alloc_increment;
|
||||||
|
@ -831,7 +831,7 @@ bool thr_alarm(thr_alarm_t *alrm, uint sec, ALARM *alarm)
|
|||||||
alrm->crono=0;
|
alrm->crono=0;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
if (!(alrm->crono=SetTimer(NULL,0,(long) sec*1000L, (TIMERPROC) NULL)))
|
if (!(alrm->crono=SetTimer((HWND) NULL,0, sec*1000,(TIMERPROC) NULL)))
|
||||||
return 1;
|
return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -87,7 +87,7 @@ int my_rw_rdlock( rw_lock_t *rwp ) {
|
|||||||
pthread_mutex_lock(&rwp->lock);
|
pthread_mutex_lock(&rwp->lock);
|
||||||
|
|
||||||
/* active or queued writers */
|
/* active or queued writers */
|
||||||
while ( ( rwp->state < 0 ) && rwp->waiters )
|
while ( ( rwp->state < 0 ) || rwp->waiters )
|
||||||
pthread_cond_wait( &rwp->readers, &rwp->lock);
|
pthread_cond_wait( &rwp->readers, &rwp->lock);
|
||||||
|
|
||||||
rwp->state++;
|
rwp->state++;
|
||||||
@ -103,12 +103,8 @@ int my_rw_wrlock( rw_lock_t *rwp ) {
|
|||||||
|
|
||||||
while ( rwp->state )
|
while ( rwp->state )
|
||||||
pthread_cond_wait( &rwp->writers, &rwp->lock);
|
pthread_cond_wait( &rwp->writers, &rwp->lock);
|
||||||
|
|
||||||
rwp->state = -1;
|
rwp->state = -1;
|
||||||
|
--rwp->waiters;
|
||||||
if ( ( --rwp->waiters == 0 ) && ( rwp->state >= 0 ) )
|
|
||||||
pthread_cond_broadcast( &rwp->readers );
|
|
||||||
|
|
||||||
pthread_mutex_unlock( &rwp->lock );
|
pthread_mutex_unlock( &rwp->lock );
|
||||||
|
|
||||||
return( 0 );
|
return( 0 );
|
||||||
|
@ -132,7 +132,7 @@ int cflags;
|
|||||||
(NC-1)*sizeof(cat_t));
|
(NC-1)*sizeof(cat_t));
|
||||||
if (g == NULL)
|
if (g == NULL)
|
||||||
return(REG_ESPACE);
|
return(REG_ESPACE);
|
||||||
p->ssize = len/(size_t)2*(size_t)3 + (size_t)1; /* ugh */
|
p->ssize = (long) (len/(size_t)2*(size_t)3 + (size_t)1); /* ugh */
|
||||||
p->strip = (sop *)malloc(p->ssize * sizeof(sop));
|
p->strip = (sop *)malloc(p->ssize * sizeof(sop));
|
||||||
p->slen = 0;
|
p->slen = 0;
|
||||||
if (p->strip == NULL) {
|
if (p->strip == NULL) {
|
||||||
@ -268,7 +268,7 @@ register struct parse *p;
|
|||||||
case '(':
|
case '(':
|
||||||
REQUIRE(MORE(), REG_EPAREN);
|
REQUIRE(MORE(), REG_EPAREN);
|
||||||
p->g->nsub++;
|
p->g->nsub++;
|
||||||
subno = p->g->nsub;
|
subno = (sopno) p->g->nsub;
|
||||||
if (subno < NPAREN)
|
if (subno < NPAREN)
|
||||||
p->pbegin[subno] = HERE();
|
p->pbegin[subno] = HERE();
|
||||||
EMIT(OLPAREN, subno);
|
EMIT(OLPAREN, subno);
|
||||||
@ -488,7 +488,7 @@ int starordinary; /* is a leading * an ordinary character? */
|
|||||||
break;
|
break;
|
||||||
case BACKSL|'(':
|
case BACKSL|'(':
|
||||||
p->g->nsub++;
|
p->g->nsub++;
|
||||||
subno = p->g->nsub;
|
subno = (sopno) p->g->nsub;
|
||||||
if (subno < NPAREN)
|
if (subno < NPAREN)
|
||||||
p->pbegin[subno] = HERE();
|
p->pbegin[subno] = HERE();
|
||||||
EMIT(OLPAREN, subno);
|
EMIT(OLPAREN, subno);
|
||||||
@ -811,8 +811,11 @@ int endc; /* name ended by endc,']' */
|
|||||||
{
|
{
|
||||||
register char *sp = p->next;
|
register char *sp = p->next;
|
||||||
register struct cname *cp;
|
register struct cname *cp;
|
||||||
|
#ifdef _WIN64
|
||||||
|
register __int64 len;
|
||||||
|
#else
|
||||||
register int len;
|
register int len;
|
||||||
|
#endif
|
||||||
while (MORE() && !SEETWO(endc, ']'))
|
while (MORE() && !SEETWO(endc, ']'))
|
||||||
NEXT();
|
NEXT();
|
||||||
if (!MORE()) {
|
if (!MORE()) {
|
||||||
|
@ -6,7 +6,11 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* === regex2.h === */
|
/* === regex2.h === */
|
||||||
|
#ifdef _WIN64
|
||||||
|
typedef __int64 regoff_t;
|
||||||
|
#else
|
||||||
typedef off_t regoff_t;
|
typedef off_t regoff_t;
|
||||||
|
#endif
|
||||||
struct re_guts; /* none of your business :-) */
|
struct re_guts; /* none of your business :-) */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
int re_magic;
|
int re_magic;
|
||||||
|
@ -95,8 +95,8 @@ typedef struct {
|
|||||||
char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
|
char *multis; /* -> char[smulti] ab\0cd\0ef\0\0 */
|
||||||
} cset;
|
} cset;
|
||||||
/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
|
/* note that CHadd and CHsub are unsafe, and CHIN doesn't yield 0/1 */
|
||||||
#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (c))
|
#define CHadd(cs, c) ((cs)->ptr[(uch)(c)] |= (cs)->mask, (cs)->hash += (uch) (c))
|
||||||
#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (c))
|
#define CHsub(cs, c) ((cs)->ptr[(uch)(c)] &= ~(cs)->mask, (cs)->hash -= (uch)(c))
|
||||||
#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
|
#define CHIN(cs, c) ((cs)->ptr[(uch)(c)] & (cs)->mask)
|
||||||
#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
|
#define MCadd(p, cs, cp) mcadd(p, cs, cp) /* regcomp() internal fns */
|
||||||
#define MCsub(p, cs, cp) mcsub(p, cs, cp)
|
#define MCsub(p, cs, cp) mcsub(p, cs, cp)
|
||||||
|
@ -25,7 +25,7 @@ WARNING: THIS IS VERY MUCH A FIRST-CUT ALPHA. Comments/patches welcome.
|
|||||||
|
|
||||||
# Documentation continued at end of file
|
# Documentation continued at end of file
|
||||||
|
|
||||||
my $VERSION = sprintf("%d.%02d", q$Revision$ =~ /(\d+)\.(\d+)/o);
|
my $VERSION = "1.5";
|
||||||
|
|
||||||
my $OPTIONS = <<"_OPTIONS";
|
my $OPTIONS = <<"_OPTIONS";
|
||||||
|
|
||||||
|
@ -395,6 +395,11 @@ All benchmarks takes the following options:
|
|||||||
extra information that 'uname -a' doesn\'t give and if the database was
|
extra information that 'uname -a' doesn\'t give and if the database was
|
||||||
stared with some specific, non default, options.
|
stared with some specific, non default, options.
|
||||||
|
|
||||||
|
--cmp=server[,server...]
|
||||||
|
Run the test with limits from the given servers. If you run all servers
|
||||||
|
with the same --cmp, you will get a test that is comparable between
|
||||||
|
the different sql servers.
|
||||||
|
|
||||||
--database (Default $opt_database)
|
--database (Default $opt_database)
|
||||||
In which database the test tables are created.
|
In which database the test tables are created.
|
||||||
|
|
||||||
|
@ -535,23 +535,23 @@ sub new
|
|||||||
$limits{'group_functions'} = 1;
|
$limits{'group_functions'} = 1;
|
||||||
$limits{'group_distinct_functions'}= 1; # Have count(distinct)
|
$limits{'group_distinct_functions'}= 1; # Have count(distinct)
|
||||||
$limits{'having_with_alias'} = 0;
|
$limits{'having_with_alias'} = 0;
|
||||||
$limits{'having_with_group'} = 0;
|
$limits{'having_with_group'} = 1;
|
||||||
$limits{'left_outer_join'} = 0;
|
$limits{'left_outer_join'} = 0;
|
||||||
$limits{'like_with_column'} = 1;
|
$limits{'like_with_column'} = 1;
|
||||||
$limits{'lock_tables'} = 0; # in ATIS gives this a problem
|
$limits{'lock_tables'} = 0; # in ATIS gives this a problem
|
||||||
$limits{'max_column_name'} = 32; # Is this true
|
|
||||||
$limits{'max_columns'} = 300; # 500 crashes pg 6.3
|
|
||||||
$limits{'max_tables'} = 65000; # Should be big enough
|
|
||||||
$limits{'max_conditions'} = 9; # This makes Pg real slow
|
|
||||||
$limits{'max_index'} = 7; # Is this true ?
|
|
||||||
$limits{'max_index_parts'} = 16; # Is this true ?
|
|
||||||
$limits{'max_text_size'} = 7000; # 8000 crashes pg 6.3
|
|
||||||
$limits{'multi_drop'} = 1;
|
$limits{'multi_drop'} = 1;
|
||||||
$limits{'order_by_position'} = 1;
|
$limits{'order_by_position'} = 1;
|
||||||
$limits{'query_size'} = 8191;
|
|
||||||
$limits{'select_without_from'}= 1;
|
$limits{'select_without_from'}= 1;
|
||||||
$limits{'subqueries'} = 1;
|
$limits{'subqueries'} = 1;
|
||||||
$limits{'table_wildcard'} = 1;
|
$limits{'table_wildcard'} = 1;
|
||||||
|
$limits{'max_column_name'} = 32; # Is this true
|
||||||
|
$limits{'max_columns'} = 1000; # 500 crashes pg 6.3
|
||||||
|
$limits{'max_tables'} = 65000; # Should be big enough
|
||||||
|
$limits{'max_conditions'} = 30; # This makes Pg real slow
|
||||||
|
$limits{'max_index'} = 64; # Is this true ?
|
||||||
|
$limits{'max_index_parts'} = 16; # Is this true ?
|
||||||
|
$limits{'max_text_size'} = 7000; # 8000 crashes pg 6.3
|
||||||
|
$limits{'query_size'} = 8191;
|
||||||
|
|
||||||
# the different cases per query ...
|
# the different cases per query ...
|
||||||
$smds{'q1'} = 'b'; # with time
|
$smds{'q1'} = 'b'; # with time
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
2000-08-08 Michael Widenius <monty@mysql.com>
|
||||||
|
|
||||||
|
* Changed ALTER TABLE and LOAD DATA INFILE to create non unique, small keys
|
||||||
|
after all rows are inserted.
|
||||||
|
* Fixed use of UDF function with const arguments in WHERE clause.
|
||||||
|
|
||||||
2000-07-11 Michael Widenius <monty@mysql.com>
|
2000-07-11 Michael Widenius <monty@mysql.com>
|
||||||
|
|
||||||
* Extended safe_mysqld; Patch by Christian Hammers
|
* Extended safe_mysqld; Patch by Christian Hammers
|
||||||
|
@ -2418,6 +2418,7 @@ bool Field_timestamp::get_date(TIME *ltime,
|
|||||||
ltime->second= start->tm_sec;
|
ltime->second= start->tm_sec;
|
||||||
ltime->second_part= 0;
|
ltime->second_part= 0;
|
||||||
ltime->neg= 0;
|
ltime->neg= 0;
|
||||||
|
ltime->time_type=TIMESTAMP_FULL;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -3005,6 +3006,7 @@ bool Field_newdate::get_date(TIME *ltime,bool fuzzydate)
|
|||||||
ltime->day= tmp & 31;
|
ltime->day= tmp & 31;
|
||||||
ltime->month= (tmp >> 5) & 15;
|
ltime->month= (tmp >> 5) & 15;
|
||||||
ltime->year= (tmp >> 9);
|
ltime->year= (tmp >> 9);
|
||||||
|
ltime->time_type=TIMESTAMP_DATE;
|
||||||
return (!fuzzydate && (!ltime->month || !ltime->day) && ltime->year) ? 1 : 0;
|
return (!fuzzydate && (!ltime->month || !ltime->day) && ltime->year) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3181,6 +3183,7 @@ bool Field_datetime::get_date(TIME *ltime,bool fuzzydate)
|
|||||||
part1=(long) (tmp/LL(1000000));
|
part1=(long) (tmp/LL(1000000));
|
||||||
part2=(long) (tmp - (ulonglong) part1*LL(1000000));
|
part2=(long) (tmp - (ulonglong) part1*LL(1000000));
|
||||||
|
|
||||||
|
ltime->time_type= TIMESTAMP_FULL;
|
||||||
ltime->neg=0;
|
ltime->neg=0;
|
||||||
ltime->second_part=0;
|
ltime->second_part=0;
|
||||||
ltime->second= part2%100;
|
ltime->second= part2%100;
|
||||||
|
@ -209,7 +209,7 @@ ha_rows filesort(TABLE **table, SORT_FIELD *sortorder, uint s_length,
|
|||||||
&tempfile, selected_records_file)) ==
|
&tempfile, selected_records_file)) ==
|
||||||
HA_POS_ERROR)
|
HA_POS_ERROR)
|
||||||
goto err;
|
goto err;
|
||||||
if (maxbuffer == 0)
|
if (maxbuffer == 0) // The whole set is in memory
|
||||||
{
|
{
|
||||||
if (save_index(¶m,sort_keys,(uint) records))
|
if (save_index(¶m,sort_keys,(uint) records))
|
||||||
goto err;
|
goto err;
|
||||||
|
@ -27,6 +27,7 @@
|
|||||||
#include "lex.h"
|
#include "lex.h"
|
||||||
|
|
||||||
bool opt_search=0,opt_verbose=0;
|
bool opt_search=0,opt_verbose=0;
|
||||||
|
ulong opt_count=100000;
|
||||||
|
|
||||||
#define max_allowed_array 8000 // Don't generate bigger arrays than this
|
#define max_allowed_array 8000 // Don't generate bigger arrays than this
|
||||||
#define max_symbol 32767 // Use this for 'not found'
|
#define max_symbol 32767 // Use this for 'not found'
|
||||||
@ -316,6 +317,7 @@ void print_arrays()
|
|||||||
|
|
||||||
static struct option long_options[] =
|
static struct option long_options[] =
|
||||||
{
|
{
|
||||||
|
{"count", required_argument, 0, 'c'},
|
||||||
{"search", no_argument, 0, 'S'},
|
{"search", no_argument, 0, 'S'},
|
||||||
{"verbose", no_argument, 0, 'v'},
|
{"verbose", no_argument, 0, 'v'},
|
||||||
{"version", no_argument, 0, 'V'},
|
{"version", no_argument, 0, 'V'},
|
||||||
@ -328,7 +330,7 @@ static struct option long_options[] =
|
|||||||
|
|
||||||
static void usage(int version)
|
static void usage(int version)
|
||||||
{
|
{
|
||||||
printf("%s Ver 3.0 Distrib %s, for %s (%s)\n",
|
printf("%s Ver 3.1 Distrib %s, for %s (%s)\n",
|
||||||
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
my_progname, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
|
||||||
if (version)
|
if (version)
|
||||||
return;
|
return;
|
||||||
@ -337,6 +339,7 @@ static void usage(int version)
|
|||||||
puts("This program generates a perfect hashing function for the sql_lex.cc");
|
puts("This program generates a perfect hashing function for the sql_lex.cc");
|
||||||
printf("Usage: %s [OPTIONS]\n", my_progname);
|
printf("Usage: %s [OPTIONS]\n", my_progname);
|
||||||
printf("\n\
|
printf("\n\
|
||||||
|
-c, --count=# Try count times to find a optimal hash table\n\
|
||||||
-r, --rnd1=# Set 1 part of rnd value for hash generator\n\
|
-r, --rnd1=# Set 1 part of rnd value for hash generator\n\
|
||||||
-R, --rnd2=# Set 2 part of rnd value for hash generator\n\
|
-R, --rnd2=# Set 2 part of rnd value for hash generator\n\
|
||||||
-t, --type=# Set type of char table to generate\n\
|
-t, --type=# Set type of char table to generate\n\
|
||||||
@ -353,10 +356,13 @@ static int get_options(int argc, char **argv)
|
|||||||
{
|
{
|
||||||
int c,option_index=0;
|
int c,option_index=0;
|
||||||
|
|
||||||
while ((c=getopt_long(argc,argv,"?SvVr:R:t:",
|
while ((c=getopt_long(argc,argv,"?SvVc:r:R:t:",
|
||||||
long_options, &option_index)) != EOF)
|
long_options, &option_index)) != EOF)
|
||||||
{
|
{
|
||||||
switch(c) {
|
switch(c) {
|
||||||
|
case 'c':
|
||||||
|
opt_count=atol(optarg);
|
||||||
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
best_t1=atol(optarg);
|
best_t1=atol(optarg);
|
||||||
break;
|
break;
|
||||||
@ -466,8 +472,7 @@ int main(int argc,char **argv)
|
|||||||
int error;
|
int error;
|
||||||
|
|
||||||
MY_INIT(argv[0]);
|
MY_INIT(argv[0]);
|
||||||
start_value=1277803L; best_t1=331678L; best_t2=4097229L; best_type=1;
|
start_value=6059524L; best_t1=2194873L; best_t2=4441039L; best_type=4; /* mode=4159 add=8 func_type: 0 */
|
||||||
/* mode=5791 add=6 func_type: 0 */
|
|
||||||
if (get_options(argc,(char **) argv))
|
if (get_options(argc,(char **) argv))
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
||||||
@ -488,7 +493,7 @@ int main(int argc,char **argv)
|
|||||||
start_value, best_t1,best_t2,best_type,best_mod,best_add,
|
start_value, best_t1,best_t2,best_type,best_mod,best_add,
|
||||||
best_functype);
|
best_functype);
|
||||||
|
|
||||||
for (uint i=1 ; i <= 100000 ; i++)
|
for (uint i=1 ; i <= opt_count ; i++)
|
||||||
{
|
{
|
||||||
if (i % 10 == 0)
|
if (i % 10 == 0)
|
||||||
{
|
{
|
||||||
@ -532,7 +537,9 @@ printf("/* This code is generated by gen_lex_hash.cc that seeks for a perfect\nh
|
|||||||
|
|
||||||
print_arrays();
|
print_arrays();
|
||||||
|
|
||||||
printf("/* t1= %lu t2=%lu type= %d */\n\n",best_t1,best_t2,best_type);
|
printf("/* start_value=%ldL; best_t1=%ldL; best_t2=%ldL; best_type=%d; */ /* mode=%d add=%d type: %d */\n\n",
|
||||||
|
start_value, best_t1, best_t2,best_type,
|
||||||
|
best_mod, best_add, best_functype);
|
||||||
|
|
||||||
printf("inline SYMBOL *get_hash_symbol(const char *s,unsigned int length,bool function)\n\
|
printf("inline SYMBOL *get_hash_symbol(const char *s,unsigned int length,bool function)\n\
|
||||||
{\n\
|
{\n\
|
||||||
|
@ -228,7 +228,7 @@ berkeley_cmp_packed_key(const DBT *new_key, const DBT *saved_key)
|
|||||||
key_length-=length;
|
key_length-=length;
|
||||||
saved_key_ptr+=key_part->field->packed_col_length(saved_key_ptr);
|
saved_key_ptr+=key_part->field->packed_col_length(saved_key_ptr);
|
||||||
}
|
}
|
||||||
return 0;
|
return key->handler.bdb_return_if_eq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ berkeley_cmp_fix_length_key(const DBT *new_key, const DBT *saved_key)
|
|||||||
key_length-= key_part->length;
|
key_length-= key_part->length;
|
||||||
saved_key_ptr+=key_part->length;
|
saved_key_ptr+=key_part->length;
|
||||||
}
|
}
|
||||||
return 0;
|
return key->handler.bdb_return_if_eq;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -964,6 +964,8 @@ int ha_berkeley::read_row(int error, char *buf, uint keynr, DBT *row,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* This is only used to read whole keys */
|
||||||
|
|
||||||
int ha_berkeley::index_read_idx(byte * buf, uint keynr, const byte * key,
|
int ha_berkeley::index_read_idx(byte * buf, uint keynr, const byte * key,
|
||||||
uint key_len, enum ha_rkey_function find_flag)
|
uint key_len, enum ha_rkey_function find_flag)
|
||||||
{
|
{
|
||||||
@ -982,14 +984,38 @@ int ha_berkeley::index_read(byte * buf, const byte * key,
|
|||||||
uint key_len, enum ha_rkey_function find_flag)
|
uint key_len, enum ha_rkey_function find_flag)
|
||||||
{
|
{
|
||||||
DBT row;
|
DBT row;
|
||||||
|
int error;
|
||||||
DBUG_ENTER("index_read");
|
DBUG_ENTER("index_read");
|
||||||
statistic_increment(ha_read_key_count,&LOCK_status);
|
statistic_increment(ha_read_key_count,&LOCK_status);
|
||||||
bzero((char*) &row,sizeof(row));
|
bzero((char*) &row,sizeof(row));
|
||||||
DBUG_RETURN(read_row(cursor->c_get(cursor,
|
if (key_len == table->key_info[active_index].key_length)
|
||||||
pack_key(&last_key, active_index,
|
{
|
||||||
key_buff, key, key_len),
|
error=read_row(cursor->c_get(cursor, pack_key(&last_key,
|
||||||
|
active_index,
|
||||||
|
key_buff,
|
||||||
|
key, key_len),
|
||||||
&row, DB_SET),
|
&row, DB_SET),
|
||||||
buf, active_index, &row, 0));
|
buf, active_index, &row, 0);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* read of partial key */
|
||||||
|
pack_key(&last_key, active_index, key_buff, key, key_len);
|
||||||
|
/* Store for compare */
|
||||||
|
memcpy(key_buff2, key_buff, last_key.size);
|
||||||
|
((KEY*) last_key.app_private)->handler.bdb_return_if_eq= -1;
|
||||||
|
error=read_row(cursor->c_get(cursor, &last_key, &row, DB_SET_RANGE),
|
||||||
|
buf, active_index, &row, 0);
|
||||||
|
((KEY*) last_key.app_private)->handler.bdb_return_if_eq=0;
|
||||||
|
if (!error && find_flag == HA_READ_KEY_EXACT)
|
||||||
|
{
|
||||||
|
/* Check that we didn't find a key that wasn't equal to the current
|
||||||
|
one */
|
||||||
|
if (!error && ::key_cmp(table, key_buff2, active_index, key_len))
|
||||||
|
error=HA_ERR_KEY_NOT_FOUND;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -30,11 +30,12 @@
|
|||||||
#include "../myisam/myisamdef.h"
|
#include "../myisam/myisamdef.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ulong myisam_sort_buffer_size;
|
|
||||||
#if !defined(HAVE_PREAD)
|
#if !defined(HAVE_PREAD)
|
||||||
pthread_mutex_t THR_LOCK_keycache;
|
pthread_mutex_t THR_LOCK_keycache;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
ulong myisam_sort_buffer_size;
|
||||||
|
|
||||||
/*****************************************************************************
|
/*****************************************************************************
|
||||||
** MyISAM tables
|
** MyISAM tables
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
@ -57,7 +58,12 @@ static void mi_check_print_msg(MI_CHECK *param, const char* msg_type,
|
|||||||
sql_print_error(msgbuf);
|
sql_print_error(msgbuf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (param->testflag & (T_CREATE_MISSING_KEYS | T_SAFE_REPAIR |
|
||||||
|
T_AUTO_REPAIR))
|
||||||
|
{
|
||||||
|
my_message(ER_NOT_KEYFILE,msgbuf,MYF(MY_WME));
|
||||||
|
return;
|
||||||
|
}
|
||||||
net_store_data(packet, param->table_name);
|
net_store_data(packet, param->table_name);
|
||||||
net_store_data(packet, param->op_name);
|
net_store_data(packet, param->op_name);
|
||||||
net_store_data(packet, msg_type);
|
net_store_data(packet, msg_type);
|
||||||
@ -333,24 +339,32 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT* check_opt)
|
|||||||
if (!file) return HA_CHECK_INTERNAL_ERROR;
|
if (!file) return HA_CHECK_INTERNAL_ERROR;
|
||||||
int error ;
|
int error ;
|
||||||
MI_CHECK param;
|
MI_CHECK param;
|
||||||
MYISAM_SHARE* share = file->s;
|
|
||||||
char fixed_name[FN_REFLEN];
|
|
||||||
|
|
||||||
myisamchk_init(¶m);
|
myisamchk_init(¶m);
|
||||||
param.thd = thd;
|
param.thd = thd;
|
||||||
param.op_name = (char*) "repair";
|
param.op_name = (char*) "repair";
|
||||||
param.table_name = table->table_name;
|
param.testflag = (check_opt->flags | T_SILENT|T_FORCE_CREATE|T_REP_BY_SORT|
|
||||||
param.testflag = check_opt->flags | T_SILENT|T_FORCE_CREATE|T_REP_BY_SORT;
|
T_STATISTICS);
|
||||||
param.sort_buffer_length= check_opt->sort_buffer_size;
|
|
||||||
if (check_opt->quick)
|
if (check_opt->quick)
|
||||||
param.opt_rep_quick++;
|
param.opt_rep_quick++;
|
||||||
|
param.sort_buffer_length= check_opt->sort_buffer_size;
|
||||||
|
return repair(thd,param);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int ha_myisam::repair(THD *thd, MI_CHECK ¶m)
|
||||||
|
{
|
||||||
|
int error;
|
||||||
|
char fixed_name[FN_REFLEN];
|
||||||
|
MYISAM_SHARE* share = file->s;
|
||||||
|
|
||||||
|
param.table_name = table->table_name;
|
||||||
param.tmpfile_createflag = O_RDWR | O_TRUNC;
|
param.tmpfile_createflag = O_RDWR | O_TRUNC;
|
||||||
param.using_global_keycache = 1;
|
param.using_global_keycache = 1;
|
||||||
|
|
||||||
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
|
VOID(fn_format(fixed_name,file->filename,"",MI_NAME_IEXT,
|
||||||
4+ (param.opt_follow_links ? 16 : 0)));
|
4+ (param.opt_follow_links ? 16 : 0)));
|
||||||
|
if (mi_test_if_sort_rep(file,file->state->records))
|
||||||
if (share->state.key_map)
|
|
||||||
error = mi_repair_by_sort(¶m, file, fixed_name, param.opt_rep_quick);
|
error = mi_repair_by_sort(¶m, file, fixed_name, param.opt_rep_quick);
|
||||||
else
|
else
|
||||||
error= mi_repair(¶m, file, fixed_name, param.opt_rep_quick);
|
error= mi_repair(¶m, file, fixed_name, param.opt_rep_quick);
|
||||||
@ -397,6 +411,38 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT* check_opt)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* Deactive all not unique index that can be recreated fast */
|
||||||
|
|
||||||
|
void ha_myisam::deactivate_non_unique_index(ha_rows rows)
|
||||||
|
{
|
||||||
|
if (!(specialflag & SPECIAL_SAFE_MODE))
|
||||||
|
mi_dectivate_non_unique_index(file,rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool ha_myisam::activate_all_index(THD *thd)
|
||||||
|
{
|
||||||
|
int error=0;
|
||||||
|
char fixed_name[FN_REFLEN];
|
||||||
|
MI_CHECK param;
|
||||||
|
MYISAM_SHARE* share = file->s;
|
||||||
|
DBUG_ENTER("activate_all_index");
|
||||||
|
if (share->state.key_map != ((ulonglong) 1L << share->base.keys)-1)
|
||||||
|
{
|
||||||
|
const char *save_proc_info=thd->proc_info;
|
||||||
|
thd->proc_info="creating index";
|
||||||
|
myisamchk_init(¶m);
|
||||||
|
param.op_name = (char*) "recreating_index";
|
||||||
|
param.testflag = (T_SILENT | T_REP_BY_SORT |
|
||||||
|
T_STATISTICS | T_CREATE_MISSING_KEYS | T_TRUST_HEADER);
|
||||||
|
param.myf_rw&= ~MY_WAIT_IF_FULL;
|
||||||
|
param.sort_buffer_length= myisam_sort_buffer_size;
|
||||||
|
param.opt_rep_quick++;
|
||||||
|
error=repair(thd,param) != HA_CHECK_OK;
|
||||||
|
thd->proc_info=save_proc_info;
|
||||||
|
}
|
||||||
|
DBUG_RETURN(error);
|
||||||
|
}
|
||||||
|
|
||||||
int ha_myisam::update_row(const byte * old_data, byte * new_data)
|
int ha_myisam::update_row(const byte * old_data, byte * new_data)
|
||||||
{
|
{
|
||||||
@ -870,4 +916,3 @@ int ha_myisam::ft_read(byte * buf)
|
|||||||
table->status=error ? STATUS_NOT_FOUND: 0;
|
table->status=error ? STATUS_NOT_FOUND: 0;
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,6 +30,7 @@ class ha_myisam: public handler
|
|||||||
{
|
{
|
||||||
MI_INFO *file;
|
MI_INFO *file;
|
||||||
uint int_option_flag;
|
uint int_option_flag;
|
||||||
|
int repair(THD *thd, MI_CHECK ¶m);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ha_myisam(TABLE *table): handler(table), file(0),
|
ha_myisam(TABLE *table): handler(table), file(0),
|
||||||
@ -76,6 +77,8 @@ class ha_myisam: public handler
|
|||||||
int reset(void);
|
int reset(void);
|
||||||
int external_lock(THD *thd, int lock_type);
|
int external_lock(THD *thd, int lock_type);
|
||||||
int delete_all_rows(void);
|
int delete_all_rows(void);
|
||||||
|
void deactivate_non_unique_index(ha_rows rows);
|
||||||
|
bool activate_all_index(THD *thd);
|
||||||
ha_rows records_in_range(int inx,
|
ha_rows records_in_range(int inx,
|
||||||
const byte *start_key,uint start_key_len,
|
const byte *start_key,uint start_key_len,
|
||||||
enum ha_rkey_function start_search_flag,
|
enum ha_rkey_function start_search_flag,
|
||||||
|
@ -261,6 +261,8 @@ public:
|
|||||||
virtual int optimize(THD* thd);
|
virtual int optimize(THD* thd);
|
||||||
virtual int analyze(THD* thd);
|
virtual int analyze(THD* thd);
|
||||||
virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; }
|
virtual int dump(THD* thd, int fd = -1) { return ER_DUMP_NOT_IMPLEMENTED; }
|
||||||
|
virtual void deactivate_non_unique_index(ha_rows rows) {}
|
||||||
|
virtual bool activate_all_index(THD *thd) {return 0;}
|
||||||
// not implemented by default
|
// not implemented by default
|
||||||
virtual int net_read_dump(NET* net)
|
virtual int net_read_dump(NET* net)
|
||||||
{ return ER_DUMP_NOT_IMPLEMENTED; }
|
{ return ER_DUMP_NOT_IMPLEMENTED; }
|
||||||
|
@ -1040,9 +1040,13 @@ udf_handler::fix_fields(THD *thd,TABLE_LIST *tables,Item_result_field *func,
|
|||||||
char buff[sizeof(double)]; // Max argument in function
|
char buff[sizeof(double)]; // Max argument in function
|
||||||
DBUG_ENTER("Item_udf_func::fix_fields");
|
DBUG_ENTER("Item_udf_func::fix_fields");
|
||||||
|
|
||||||
if (thd && check_stack_overrun(thd,buff))
|
if (thd)
|
||||||
|
{
|
||||||
|
if (check_stack_overrun(thd,buff))
|
||||||
return 0; // Fatal error flag is set!
|
return 0; // Fatal error flag is set!
|
||||||
|
}
|
||||||
|
else
|
||||||
|
thd=current_thd; // In WHERE / const clause
|
||||||
udf_func *tmp_udf=find_udf(u_d->name,strlen(u_d->name),1);
|
udf_func *tmp_udf=find_udf(u_d->name,strlen(u_d->name),1);
|
||||||
|
|
||||||
if (!tmp_udf)
|
if (!tmp_udf)
|
||||||
@ -1140,8 +1144,6 @@ udf_handler::fix_fields(THD *thd,TABLE_LIST *tables,Item_result_field *func,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(thd)
|
|
||||||
thd->net.last_error[0]=0;
|
thd->net.last_error[0]=0;
|
||||||
my_bool (*init)(UDF_INIT *, UDF_ARGS *, char *)=
|
my_bool (*init)(UDF_INIT *, UDF_ARGS *, char *)=
|
||||||
(my_bool (*)(UDF_INIT *, UDF_ARGS *, char *))
|
(my_bool (*)(UDF_INIT *, UDF_ARGS *, char *))
|
||||||
@ -1588,6 +1590,8 @@ static user_var_entry *get_variable(HASH *hash, LEX_STRING &name,
|
|||||||
|
|
||||||
bool Item_func_set_user_var::fix_fields(THD *thd,TABLE_LIST *tables)
|
bool Item_func_set_user_var::fix_fields(THD *thd,TABLE_LIST *tables)
|
||||||
{
|
{
|
||||||
|
if (!thd)
|
||||||
|
thd=current_thd;
|
||||||
if (Item_func::fix_fields(thd,tables) ||
|
if (Item_func::fix_fields(thd,tables) ||
|
||||||
!(entry= get_variable(&thd->user_vars, name, 1)))
|
!(entry= get_variable(&thd->user_vars, name, 1)))
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -431,6 +431,7 @@ void Item_func_curdate::fix_length_and_dec()
|
|||||||
ltime.second= 0;
|
ltime.second= 0;
|
||||||
ltime.second_part=0;
|
ltime.second_part=0;
|
||||||
ltime.neg=0;
|
ltime.neg=0;
|
||||||
|
ltime.time_type=TIMESTAMP_DATE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_func_curdate::get_date(TIME *res,
|
bool Item_func_curdate::get_date(TIME *res,
|
||||||
@ -487,6 +488,7 @@ void Item_func_now::fix_length_and_dec()
|
|||||||
ltime.second= start->tm_sec;
|
ltime.second= start->tm_sec;
|
||||||
ltime.second_part=0;
|
ltime.second_part=0;
|
||||||
ltime.neg=0;
|
ltime.neg=0;
|
||||||
|
ltime.time_type=TIMESTAMP_FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Item_func_now::get_date(TIME *res,
|
bool Item_func_now::get_date(TIME *res,
|
||||||
|
@ -231,7 +231,7 @@ static int mc_sock_connect(File s, const struct sockaddr *name, uint namelen, ui
|
|||||||
return connect(s, (struct sockaddr*) name, namelen);
|
return connect(s, (struct sockaddr*) name, namelen);
|
||||||
#else
|
#else
|
||||||
int flags, res, s_err;
|
int flags, res, s_err;
|
||||||
size_socket s_err_size = sizeof(uint);
|
socklen_t s_err_size = sizeof(uint);
|
||||||
fd_set sfds;
|
fd_set sfds;
|
||||||
struct timeval tv;
|
struct timeval tv;
|
||||||
|
|
||||||
|
@ -219,6 +219,7 @@ int quick_rm_table(enum db_type base,const char *db,
|
|||||||
const char *table_name);
|
const char *table_name);
|
||||||
bool mysql_change_db(THD *thd,const char *name);
|
bool mysql_change_db(THD *thd,const char *name);
|
||||||
void mysql_parse(THD *thd,char *inBuf,uint length);
|
void mysql_parse(THD *thd,char *inBuf,uint length);
|
||||||
|
void mysql_init_select(LEX *lex);
|
||||||
pthread_handler_decl(handle_one_connection,arg);
|
pthread_handler_decl(handle_one_connection,arg);
|
||||||
int handle_bootstrap(THD *thd,FILE *file);
|
int handle_bootstrap(THD *thd,FILE *file);
|
||||||
sig_handler end_thread_signal(int sig);
|
sig_handler end_thread_signal(int sig);
|
||||||
|
@ -656,7 +656,7 @@ static void set_user(const char *user)
|
|||||||
unireg_abort(1);
|
unireg_abort(1);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_INITGROUPS
|
#ifdef HAVE_INITGROUPS
|
||||||
initgroups(user,ent->pw_gid);
|
initgroups((char*) user,ent->pw_gid);
|
||||||
#endif
|
#endif
|
||||||
if (setgid(ent->pw_gid) == -1)
|
if (setgid(ent->pw_gid) == -1)
|
||||||
{
|
{
|
||||||
@ -876,8 +876,8 @@ void end_thread(THD *thd, bool put_in_cache)
|
|||||||
thread_count--;
|
thread_count--;
|
||||||
delete thd;
|
delete thd;
|
||||||
|
|
||||||
if (cached_thread_count < thread_cache_size && ! abort_loop &&
|
if (put_in_cache && cached_thread_count < thread_cache_size &&
|
||||||
!kill_cached_threads)
|
! abort_loop && !kill_cached_threads)
|
||||||
{
|
{
|
||||||
/* Don't kill the thread, just put it in cache for reuse */
|
/* Don't kill the thread, just put it in cache for reuse */
|
||||||
DBUG_PRINT("info", ("Adding thread to cache"))
|
DBUG_PRINT("info", ("Adding thread to cache"))
|
||||||
@ -891,8 +891,9 @@ void end_thread(THD *thd, bool put_in_cache)
|
|||||||
{
|
{
|
||||||
wake_thread--;
|
wake_thread--;
|
||||||
thd=thread_cache.get();
|
thd=thread_cache.get();
|
||||||
threads.append(thd);
|
thd->real_id=pthread_self();
|
||||||
(void) thd->store_globals();
|
(void) thd->store_globals();
|
||||||
|
threads.append(thd);
|
||||||
pthread_mutex_unlock(&LOCK_thread_count);
|
pthread_mutex_unlock(&LOCK_thread_count);
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
@ -2229,7 +2230,7 @@ CHANGEABLE_VAR changeable_vars[] = {
|
|||||||
{ "bdb_cache_size", (long*) &berkeley_cache_size, KEY_CACHE_SIZE,
|
{ "bdb_cache_size", (long*) &berkeley_cache_size, KEY_CACHE_SIZE,
|
||||||
20*1024, (long) ~0, 0, IO_SIZE},
|
20*1024, (long) ~0, 0, IO_SIZE},
|
||||||
#endif
|
#endif
|
||||||
{ "connect_timeout", (long*) &connect_timeout,CONNECT_TIMEOUT,1,65535,0,1},
|
{ "connect_timeout", (long*) &connect_timeout,CONNECT_TIMEOUT,2,65535,0,1},
|
||||||
{ "delayed_insert_timeout",(long*) &delayed_insert_timeout,
|
{ "delayed_insert_timeout",(long*) &delayed_insert_timeout,
|
||||||
DELAYED_WAIT_TIMEOUT,1,~0L,0,1},
|
DELAYED_WAIT_TIMEOUT,1,~0L,0,1},
|
||||||
{ "delayed_insert_limit",(long*) &delayed_insert_limit,
|
{ "delayed_insert_limit",(long*) &delayed_insert_limit,
|
||||||
|
@ -217,13 +217,16 @@ int mysql_load(THD *thd,sql_exchange *ex,TABLE_LIST *table_list,
|
|||||||
table->time_stamp=0;
|
table->time_stamp=0;
|
||||||
table->next_number_field=table->found_next_number_field;
|
table->next_number_field=table->found_next_number_field;
|
||||||
VOID(table->file->extra(HA_EXTRA_WRITE_CACHE));
|
VOID(table->file->extra(HA_EXTRA_WRITE_CACHE));
|
||||||
|
table->file->deactivate_non_unique_index((ha_rows) 0);
|
||||||
table->copy_blobs=1;
|
table->copy_blobs=1;
|
||||||
if (!field_term->length() && !enclosed->length())
|
if (!field_term->length() && !enclosed->length())
|
||||||
error=read_fixed_length(thd,info,table,fields,read_info);
|
error=read_fixed_length(thd,info,table,fields,read_info);
|
||||||
else
|
else
|
||||||
error=read_sep_field(thd,info,table,fields,read_info,*enclosed);
|
error=read_sep_field(thd,info,table,fields,read_info,*enclosed);
|
||||||
if (table->file->extra(HA_EXTRA_NO_CACHE))
|
if (table->file->extra(HA_EXTRA_NO_CACHE) ||
|
||||||
|
table->file->activate_all_index((ha_rows) 0))
|
||||||
error=1; /* purecov: inspected */
|
error=1; /* purecov: inspected */
|
||||||
|
|
||||||
table->time_stamp=save_time_stamp;
|
table->time_stamp=save_time_stamp;
|
||||||
table->next_number_field=0;
|
table->next_number_field=0;
|
||||||
if (thd->lock)
|
if (thd->lock)
|
||||||
|
@ -34,6 +34,9 @@ extern I_List<i_string> binlog_do_db, binlog_ignore_db;
|
|||||||
|
|
||||||
extern int yyparse(void);
|
extern int yyparse(void);
|
||||||
extern "C" pthread_mutex_t THR_LOCK_keycache;
|
extern "C" pthread_mutex_t THR_LOCK_keycache;
|
||||||
|
#ifdef SOLARIS
|
||||||
|
extern "C" int gethostname(char *name, int namelen);
|
||||||
|
#endif
|
||||||
|
|
||||||
static bool check_table_access(THD *thd,uint want_access,TABLE_LIST *tables);
|
static bool check_table_access(THD *thd,uint want_access,TABLE_LIST *tables);
|
||||||
static bool check_lock_tables(THD *thd,TABLE_LIST *tables);
|
static bool check_lock_tables(THD *thd,TABLE_LIST *tables);
|
||||||
@ -1571,22 +1574,23 @@ mysql_execute_command(void)
|
|||||||
/* Check that the user isn't trying to change a password for another
|
/* Check that the user isn't trying to change a password for another
|
||||||
user if he doesn't have UPDATE privilege to the MySQL database */
|
user if he doesn't have UPDATE privilege to the MySQL database */
|
||||||
|
|
||||||
List_iterator <LEX_USER> user_list(lex->users_list);
|
if (thd->user) // If not replication
|
||||||
|
{
|
||||||
LEX_USER *user;
|
LEX_USER *user;
|
||||||
if(thd->user)
|
List_iterator <LEX_USER> user_list(lex->users_list);
|
||||||
while ((user=user_list++))
|
while ((user=user_list++))
|
||||||
{
|
{
|
||||||
if (user->password.str &&
|
if (user->password.str &&
|
||||||
(strcmp(thd->user,user->user.str) ||
|
(strcmp(thd->user,user->user.str) ||
|
||||||
user->host.str && my_strcasecmp(user->host.str,
|
user->host.str &&
|
||||||
thd->host ? thd->host : thd->ip)))
|
my_strcasecmp(user->host.str, thd->host ? thd->host : thd->ip)))
|
||||||
{
|
{
|
||||||
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
|
if (check_access(thd, UPDATE_ACL, "mysql",0,1))
|
||||||
goto error;
|
goto error;
|
||||||
break; // We are allowed to do changes
|
break; // We are allowed to do changes
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (tables)
|
if (tables)
|
||||||
{
|
{
|
||||||
if (grant_option && check_grant(thd,
|
if (grant_option && check_grant(thd,
|
||||||
@ -1853,12 +1857,27 @@ mysql_init_query(THD *thd)
|
|||||||
|
|
||||||
thd->lex.table_list.first=0;
|
thd->lex.table_list.first=0;
|
||||||
thd->lex.table_list.next= (byte**) &thd->lex.table_list.first;
|
thd->lex.table_list.next= (byte**) &thd->lex.table_list.first;
|
||||||
thd->lex.proc_list.first=0; // Needed by sql_select
|
|
||||||
thd->fatal_error=0; // Safety
|
thd->fatal_error=0; // Safety
|
||||||
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
|
thd->last_insert_id_used=thd->query_start_used=thd->insert_id_used=0;
|
||||||
DBUG_VOID_RETURN;
|
DBUG_VOID_RETURN;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
mysql_init_select(LEX *lex)
|
||||||
|
{
|
||||||
|
lex->where=lex->having=0;
|
||||||
|
lex->select_limit=current_thd->default_select_limit;
|
||||||
|
lex->offset_limit=0L;
|
||||||
|
lex->options=0;
|
||||||
|
lex->exchange = 0;
|
||||||
|
lex->proc_list.first=0;
|
||||||
|
lex->order_list.elements=lex->group_list.elements=0;
|
||||||
|
lex->order_list.first=0;
|
||||||
|
lex->order_list.next= (byte**) &lex->order_list.first;
|
||||||
|
lex->group_list.first=0;
|
||||||
|
lex->group_list.next= (byte**) &lex->group_list.first;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
mysql_parse(THD *thd,char *inBuf,uint length)
|
mysql_parse(THD *thd,char *inBuf,uint length)
|
||||||
|
@ -1939,6 +1939,7 @@ get_best_combination(JOIN *join)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
THD *thd=current_thd;
|
||||||
for (i=0 ; i < keyparts ; keyuse++,i++)
|
for (i=0 ; i < keyparts ; keyuse++,i++)
|
||||||
{
|
{
|
||||||
while (keyuse->keypart != i ||
|
while (keyuse->keypart != i ||
|
||||||
@ -1951,12 +1952,13 @@ get_best_combination(JOIN *join)
|
|||||||
!(join->select_options & SELECT_DESCRIBE))
|
!(join->select_options & SELECT_DESCRIBE))
|
||||||
{ // Compare against constant
|
{ // Compare against constant
|
||||||
store_key_item *tmp=new store_key_item(keyinfo->key_part[i].field,
|
store_key_item *tmp=new store_key_item(keyinfo->key_part[i].field,
|
||||||
(char*)key_buff + maybe_null,
|
(char*)key_buff +
|
||||||
|
maybe_null,
|
||||||
maybe_null ?
|
maybe_null ?
|
||||||
(char*) key_buff : 0,
|
(char*) key_buff : 0,
|
||||||
keyinfo->key_part[i].length,
|
keyinfo->key_part[i].length,
|
||||||
keyuse->val);
|
keyuse->val);
|
||||||
if (current_thd->fatal_error)
|
if (thd->fatal_error)
|
||||||
{
|
{
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -2319,8 +2321,11 @@ join_free(JOIN *join)
|
|||||||
|
|
||||||
if (join->table)
|
if (join->table)
|
||||||
{
|
{
|
||||||
/* only sorted table is cached */
|
/*
|
||||||
if (join->tables > join->const_tables)
|
Only a sorted table may be cached. This sorted table is always the
|
||||||
|
first non const table in join->table
|
||||||
|
*/
|
||||||
|
if (join->tables > join->const_tables) // Test for not-const tables
|
||||||
free_io_cache(join->table[join->const_tables]);
|
free_io_cache(join->table[join->const_tables]);
|
||||||
for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++)
|
for (tab=join->join_tab,end=tab+join->tables ; tab != end ; tab++)
|
||||||
{
|
{
|
||||||
@ -2858,23 +2863,24 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
|
|||||||
|
|
||||||
Item_func_isnull *func=(Item_func_isnull*) cond;
|
Item_func_isnull *func=(Item_func_isnull*) cond;
|
||||||
Item **args= func->arguments();
|
Item **args= func->arguments();
|
||||||
|
THD *thd=current_thd;
|
||||||
if (args[0]->type() == Item::FIELD_ITEM)
|
if (args[0]->type() == Item::FIELD_ITEM)
|
||||||
{
|
{
|
||||||
Field *field=((Item_field*) args[0])->field;
|
Field *field=((Item_field*) args[0])->field;
|
||||||
if (field->flags & AUTO_INCREMENT_FLAG && !field->table->maybe_null &&
|
if (field->flags & AUTO_INCREMENT_FLAG && !field->table->maybe_null &&
|
||||||
(current_thd->options & OPTION_AUTO_IS_NULL) &&
|
(thd->options & OPTION_AUTO_IS_NULL) &&
|
||||||
current_thd->insert_id())
|
thd->insert_id())
|
||||||
{
|
{
|
||||||
COND *new_cond;
|
COND *new_cond;
|
||||||
if ((new_cond= new Item_func_eq(args[0],
|
if ((new_cond= new Item_func_eq(args[0],
|
||||||
new Item_int("last_insert_id()",
|
new Item_int("last_insert_id()",
|
||||||
current_thd->insert_id(),
|
thd->insert_id(),
|
||||||
21))))
|
21))))
|
||||||
{
|
{
|
||||||
cond=new_cond;
|
cond=new_cond;
|
||||||
cond->fix_fields(current_thd,0);
|
cond->fix_fields(thd,0);
|
||||||
}
|
}
|
||||||
current_thd->insert_id(0); // Clear for next request
|
thd->insert_id(0); // Clear for next request
|
||||||
}
|
}
|
||||||
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
|
/* fix to replace 'NULL' dates with '0' (shreeve@uci.edu) */
|
||||||
else if (((field->type() == FIELD_TYPE_DATE) ||
|
else if (((field->type() == FIELD_TYPE_DATE) ||
|
||||||
@ -2885,7 +2891,7 @@ remove_eq_conds(COND *cond,Item::cond_result *cond_value)
|
|||||||
if ((new_cond= new Item_func_eq(args[0],new Item_int("0", 0, 2))))
|
if ((new_cond= new Item_func_eq(args[0],new Item_int("0", 0, 2))))
|
||||||
{
|
{
|
||||||
cond=new_cond;
|
cond=new_cond;
|
||||||
cond->fix_fields(current_thd,0);
|
cond->fix_fields(thd,0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6229,6 +6235,11 @@ static bool add_ref_to_table_cond(THD *thd, JOIN_TAB *join_tab)
|
|||||||
}
|
}
|
||||||
if (thd->fatal_error)
|
if (thd->fatal_error)
|
||||||
DBUG_RETURN(TRUE);
|
DBUG_RETURN(TRUE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
Here we pass 0 as the first argument to fix_fields that don't need
|
||||||
|
to do any stack checking (This is already done in the initial fix_fields).
|
||||||
|
*/
|
||||||
cond->fix_fields((THD *) 0,(TABLE_LIST *) 0);
|
cond->fix_fields((THD *) 0,(TABLE_LIST *) 0);
|
||||||
if (join_tab->select)
|
if (join_tab->select)
|
||||||
{
|
{
|
||||||
|
@ -709,6 +709,7 @@ bool close_cached_table(THD *thd,TABLE *table)
|
|||||||
DBUG_RETURN(result);
|
DBUG_RETURN(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
int mysql_repair_table(THD* thd, TABLE_LIST* tables, HA_CHECK_OPT* check_opt)
|
||||||
{
|
{
|
||||||
TABLE_LIST *table;
|
TABLE_LIST *table;
|
||||||
@ -1144,6 +1145,11 @@ int mysql_alter_table(THD *thd,char *new_db, char *new_name,
|
|||||||
}
|
}
|
||||||
if (alter)
|
if (alter)
|
||||||
{
|
{
|
||||||
|
if (def->sql_type == FIELD_TYPE_BLOB)
|
||||||
|
{
|
||||||
|
my_error(ER_BLOB_CANT_HAVE_DEFAULT,MYF(0),def->change);
|
||||||
|
DBUG_RETURN(-1);
|
||||||
|
}
|
||||||
def->def=alter->def; // Use new default
|
def->def=alter->def; // Use new default
|
||||||
alter_it.remove();
|
alter_it.remove();
|
||||||
}
|
}
|
||||||
@ -1504,6 +1510,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,List<create_field> &create,
|
|||||||
|
|
||||||
to->file->external_lock(thd,F_WRLCK);
|
to->file->external_lock(thd,F_WRLCK);
|
||||||
to->file->extra(HA_EXTRA_WRITE_CACHE);
|
to->file->extra(HA_EXTRA_WRITE_CACHE);
|
||||||
|
from->file->info(HA_STATUS_VARIABLE);
|
||||||
|
to->file->deactivate_non_unique_index(from->file->records);
|
||||||
|
|
||||||
List_iterator<create_field> it(create);
|
List_iterator<create_field> it(create);
|
||||||
create_field *def;
|
create_field *def;
|
||||||
@ -1554,6 +1562,8 @@ copy_data_between_tables(TABLE *from,TABLE *to,List<create_field> &create,
|
|||||||
to->file->print_error(tmp_error,MYF(0));
|
to->file->print_error(tmp_error,MYF(0));
|
||||||
error=1;
|
error=1;
|
||||||
}
|
}
|
||||||
|
if (to->file->activate_all_index(thd))
|
||||||
|
error=1;
|
||||||
if (ha_commit(thd) || to->file->external_lock(thd,F_UNLCK))
|
if (ha_commit(thd) || to->file->external_lock(thd,F_UNLCK))
|
||||||
error=1;
|
error=1;
|
||||||
*copied= found_count;
|
*copied= found_count;
|
||||||
|
@ -680,17 +680,7 @@ create3:
|
|||||||
/* empty*/ {}
|
/* empty*/ {}
|
||||||
| opt_duplicate SELECT_SYM
|
| opt_duplicate SELECT_SYM
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
mysql_init_select(Lex);
|
||||||
lex->where=lex->having=0;
|
|
||||||
lex->select_limit=current_thd->default_select_limit;
|
|
||||||
lex->offset_limit=0L;
|
|
||||||
lex->options=0;
|
|
||||||
lex->exchange = 0;
|
|
||||||
lex->order_list.elements=lex->group_list.elements=0;
|
|
||||||
lex->order_list.first=0;
|
|
||||||
lex->order_list.next= (byte**) &lex->order_list.first;
|
|
||||||
lex->group_list.first=0;
|
|
||||||
lex->group_list.next= (byte**) &lex->group_list.first;
|
|
||||||
}
|
}
|
||||||
select_options select_item_list opt_select_from {}
|
select_options select_item_list opt_select_from {}
|
||||||
|
|
||||||
@ -1149,17 +1139,8 @@ select:
|
|||||||
SELECT_SYM
|
SELECT_SYM
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
lex->where=lex->having=0;
|
|
||||||
lex->select_limit=current_thd->default_select_limit;
|
|
||||||
lex->offset_limit=0L;
|
|
||||||
lex->options=0;
|
|
||||||
lex->sql_command= SQLCOM_SELECT;
|
lex->sql_command= SQLCOM_SELECT;
|
||||||
lex->exchange = 0;
|
mysql_init_select(lex);
|
||||||
lex->order_list.elements=lex->group_list.elements=0;
|
|
||||||
lex->order_list.first=0;
|
|
||||||
lex->order_list.next= (byte**) &lex->order_list.first;
|
|
||||||
lex->group_list.first=0;
|
|
||||||
lex->group_list.next= (byte**) &lex->group_list.first;
|
|
||||||
}
|
}
|
||||||
select_options select_item_list select_into
|
select_options select_item_list select_into
|
||||||
|
|
||||||
@ -1973,17 +1954,9 @@ insert_values:
|
|||||||
| SELECT_SYM
|
| SELECT_SYM
|
||||||
{
|
{
|
||||||
LEX *lex=Lex;
|
LEX *lex=Lex;
|
||||||
lex->where=lex->having=0;
|
|
||||||
lex->select_limit=current_thd->default_select_limit;
|
|
||||||
lex->offset_limit=0L;
|
|
||||||
lex->options=0;
|
|
||||||
lex->order_list.elements=lex->group_list.elements=0;
|
|
||||||
lex->order_list.first=0;
|
|
||||||
lex->order_list.next= (byte**) &lex->order_list.first;
|
|
||||||
lex->group_list.first=0;
|
|
||||||
lex->group_list.next= (byte**) &lex->group_list.first;
|
|
||||||
lex->sql_command = (lex->sql_command == SQLCOM_INSERT ?
|
lex->sql_command = (lex->sql_command == SQLCOM_INSERT ?
|
||||||
SQLCOM_INSERT_SELECT : SQLCOM_REPLACE_SELECT);
|
SQLCOM_INSERT_SELECT : SQLCOM_REPLACE_SELECT);
|
||||||
|
mysql_init_select(lex);
|
||||||
}
|
}
|
||||||
select_options select_item_list select_from {}
|
select_options select_item_list select_from {}
|
||||||
|
|
||||||
|
@ -70,6 +70,9 @@ typedef struct st_key {
|
|||||||
KEY_PART_INFO *key_part;
|
KEY_PART_INFO *key_part;
|
||||||
char *name; /* Name of key */
|
char *name; /* Name of key */
|
||||||
ulong *rec_per_key; /* Key part distribution */
|
ulong *rec_per_key; /* Key part distribution */
|
||||||
|
union {
|
||||||
|
uint bdb_return_if_eq;
|
||||||
|
} handler;
|
||||||
} KEY;
|
} KEY;
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ int my_strnncoll_sjis(const uchar *s1, int len1, const uchar *s2, int len2)
|
|||||||
|
|
||||||
int my_strcoll_sjis(const uchar *s1, const uchar *s2)
|
int my_strcoll_sjis(const uchar *s1, const uchar *s2)
|
||||||
{
|
{
|
||||||
return my_strnncoll_sjis(s1, strlen(s1), s2, strlen(s2));
|
return (uint) my_strnncoll_sjis(s1,(uint) strlen(s1), s2,(uint) strlen(s2));
|
||||||
}
|
}
|
||||||
|
|
||||||
int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen)
|
int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen)
|
||||||
@ -245,7 +245,7 @@ int my_strnxfrm_sjis(uchar *dest, uchar *src, int len, int srclen)
|
|||||||
|
|
||||||
int my_strxfrm_sjis(uchar *dest, uchar *src, int len)
|
int my_strxfrm_sjis(uchar *dest, uchar *src, int len)
|
||||||
{
|
{
|
||||||
return my_strnxfrm_sjis(dest, src, len, strlen(src));
|
return my_strnxfrm_sjis(dest, src, len, (uint) strlen(src));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
/* $Id$
|
/*
|
||||||
This file is basicly tis620 character sets with some extra functions
|
This file is basicly tis620 character sets with some extra functions
|
||||||
for tis-620 handling
|
for tis-620 handling
|
||||||
*/
|
*/
|
||||||
@ -443,7 +443,7 @@ static uchar* thai2sortable(const uchar * tstr,uint len)
|
|||||||
uint bufSize;
|
uint bufSize;
|
||||||
|
|
||||||
len = (uint) strnlen((char*) tstr,len);
|
len = (uint) strnlen((char*) tstr,len);
|
||||||
bufSize = buffsize((char*) tstr);
|
bufSize = (uint) buffsize((char*) tstr);
|
||||||
if(!(pRight1 = (uchar *)malloc(sizeof(uchar) * bufSize))) {
|
if(!(pRight1 = (uchar *)malloc(sizeof(uchar) * bufSize))) {
|
||||||
return( (uchar*) tstr);
|
return( (uchar*) tstr);
|
||||||
}
|
}
|
||||||
@ -530,7 +530,7 @@ int my_strnxfrm_tis620(uchar * dest, uchar * src, int len, int srclen)
|
|||||||
{
|
{
|
||||||
uint bufSize;
|
uint bufSize;
|
||||||
uchar *tmp;
|
uchar *tmp;
|
||||||
bufSize = buffsize((char*)src);
|
bufSize = (uint) buffsize((char*)src);
|
||||||
tmp = thai2sortable(src,srclen);
|
tmp = thai2sortable(src,srclen);
|
||||||
set_if_smaller(bufSize,(uint) len);
|
set_if_smaller(bufSize,(uint) len);
|
||||||
memcpy((uchar *)dest, tmp, bufSize);
|
memcpy((uchar *)dest, tmp, bufSize);
|
||||||
@ -563,7 +563,7 @@ int my_strxfrm_tis620(uchar * dest, uchar * src, int len)
|
|||||||
uint bufSize;
|
uint bufSize;
|
||||||
uchar *tmp;
|
uchar *tmp;
|
||||||
|
|
||||||
bufSize = buffsize((char*) src);
|
bufSize = (uint) buffsize((char*) src);
|
||||||
tmp = thai2sortable(src, len);
|
tmp = thai2sortable(src, len);
|
||||||
memcpy((uchar *) dest, tmp, bufSize);
|
memcpy((uchar *) dest, tmp, bufSize);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
@ -586,7 +586,7 @@ my_bool my_like_range_tis620(const char *ptr, uint ptr_length, pchar escape,
|
|||||||
uint tbuff_length;
|
uint tbuff_length;
|
||||||
|
|
||||||
tbuff = (char*) (tc=thai2sortable((uchar*) ptr, ptr_length));
|
tbuff = (char*) (tc=thai2sortable((uchar*) ptr, ptr_length));
|
||||||
tbuff_length = buffsize(ptr);
|
tbuff_length = (uint) buffsize(ptr);
|
||||||
end = tbuff + tbuff_length;
|
end = tbuff + tbuff_length;
|
||||||
for(;tbuff != end && min_str != min_end; tbuff++)
|
for(;tbuff != end && min_str != min_end; tbuff++)
|
||||||
{
|
{
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
"as is" without express or implied warranty.
|
"as is" without express or implied warranty.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$
|
/*
|
||||||
LC_COLLATE category + Level information
|
LC_COLLATE category + Level information
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -162,6 +162,8 @@ sh -c "PATH=\"${MYSQL_BUILD_PATH:-/bin:/usr/bin}\" \
|
|||||||
--with-comment=\"Official MySQL RPM\";
|
--with-comment=\"Official MySQL RPM\";
|
||||||
# Add this for more debugging support
|
# Add this for more debugging support
|
||||||
# --with-debug
|
# --with-debug
|
||||||
|
# Add this for MyISAM RAID support:
|
||||||
|
# --with-raid
|
||||||
"
|
"
|
||||||
|
|
||||||
# benchdir does not fit in above model. Maybe a separate bench distribution
|
# benchdir does not fit in above model. Maybe a separate bench distribution
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
VIO_RCSID(vio, viotest_ssl, "$Id$")
|
|
||||||
|
|
||||||
void
|
void
|
||||||
fatal_error( const char* r)
|
fatal_error( const char* r)
|
||||||
{
|
{
|
||||||
|
@ -13,8 +13,6 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
|
||||||
VIO_RCSID(vio, viotest_sslconnect, "$Id$")
|
|
||||||
|
|
||||||
void
|
void
|
||||||
fatal_error( const char* r)
|
fatal_error( const char* r)
|
||||||
{
|
{
|
||||||
|
@ -11,8 +11,6 @@
|
|||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
VIO_RCSID(vio, Vio, "$Id$")
|
|
||||||
|
|
||||||
VIO_NS_USING;
|
VIO_NS_USING;
|
||||||
|
|
||||||
int
|
int
|
||||||
|
Loading…
x
Reference in New Issue
Block a user