Commit 1a991bd1 authored by unknown's avatar unknown

Merge work:/home/bk/mysql into donna.mysql.com:/home/my/bk/mysql


Docs/manual.texi:
  Auto merged
parents fe179a55 aba45653
This diff is collapsed.
......@@ -62,6 +62,7 @@ char *argv[];
HP_KEYSEG keyseg[MAX_KEYS*5];
HEAP_PTR position;
MY_INIT(argv[0]); /* init my_sys library & pthreads */
LINT_INIT(position);
filename= "test2";
filename2= "test2_2";
......
......@@ -574,9 +574,9 @@ static int compress(MRG_INFO *mrg,char *result_table)
end_file_buffer();
if (verbose && mrg->records)
printf("Min record length: %6d Max length: %6d Mean total length: %6d\n",
printf("Min record length: %6d Max length: %6d Mean total length: %6lu\n",
mrg->min_pack_length,mrg->max_pack_length,
(long) new_length/mrg->records);
(ulong) new_length/mrg->records);
if (!test_only)
{
......@@ -763,11 +763,11 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts)
{
global_count=count;
if (!(element=tree_insert(&count->int_tree,pos,0)) ||
element->count == 1 &&
count->tree_buff + tree_buff_length <
count->tree_pos + count->field_length ||
count->field_length == 1 &&
count->int_tree.elements_in_tree > 1)
(element->count == 1 &&
count->tree_buff + tree_buff_length <
count->tree_pos + count->field_length ||
count->field_length == 1 &&
count->int_tree.elements_in_tree > 1))
{
delete_tree(&count->int_tree);
my_free(count->tree_buff,MYF(0));
......@@ -1760,8 +1760,8 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts)
if (max_record_length >= max_allowed_length)
{
fprintf(stderr,
"Error: Found record with packed-length: %d, max is: %d\n",
max_record_length,max_allowed_length);
"Error: Found record with packed-length: %d, max is: %lu\n",
max_record_length, (ulong) max_allowed_length);
error=1;
break;
}
......
......@@ -31,6 +31,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
uchar old_key[N_MAX_KEY_BUFF],*new_key;
DBUG_ENTER("nisam_update");
LINT_INIT(save_errno);
if (!(info->update & HA_STATE_AKTIV))
{
my_errno=HA_ERR_KEY_NOT_FOUND;
......@@ -54,7 +55,7 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
info->s->base.max_key_file_length -
info->s->blocksize* INDEX_BLOCK_MARGIN *info->s->state.keys)
{
my_errno=HA_ERR_INDEX_FILE_FULL;
save_errno=HA_ERR_INDEX_FILE_FULL;
goto err_end;
}
......@@ -108,12 +109,9 @@ int nisam_update(register N_INFO *info, const byte *oldrec, const byte *newrec)
info->update= (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED | HA_STATE_AKTIV |
key_changed);
err_end:
nisam_log_record(LOG_UPDATE,info,newrec,info->lastpos,my_errno);
nisam_log_record(LOG_UPDATE,info,newrec,info->lastpos,save_errno);
VOID(_nisam_writeinfo(info,1));
allow_break(); /* Allow SIGHUP & SIGINT */
if (save_errno == HA_ERR_KEY_NOT_FOUND)
my_errno=HA_ERR_CRASHED;
else
my_errno=save_errno;
my_errno=(save_errno == HA_ERR_KEY_NOT_FOUND) ? HA_ERR_CRASHED : save_errno;
DBUG_RETURN(-1);
} /* nisam_update */
......@@ -87,7 +87,7 @@ FT_WORD * ft_linearize(MI_INFO *info, uint keynr, byte *keybuf, TREE *wtree)
}
delete_tree(wtree);
my_free((char*) wtree,MYF(0));
if (wlist==NULL)
if (!wlist)
return NULL;
docstat.list->pos=NULL;
......
......@@ -37,9 +37,8 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
byte *pos;
uint i;
i=info->s->keyinfo[keynr].keysegs-FT_SEGS;
keyseg=info->s->keyinfo[keynr].seg;
while(i--)
for (i=info->s->keyinfo[keynr].keysegs-FT_SEGS ; i-- ; )
{
uint len;
......@@ -61,10 +60,12 @@ static FT_WORD * _mi_ft_parserecord(MI_INFO *info, uint keynr, byte *keybuf,
}
else
len=keyseg->length;
parsed=ft_parse(parsed, pos, len);
if (parsed==NULL) return NULL;
if (!(parsed=ft_parse(parsed, pos, len)))
return NULL;
}
/* Handle the case where all columns are NULL */
if (!parsed && !(parsed=ft_parse(0, "", 0)))
return NULL;
return ft_linearize(info, keynr, keybuf, parsed);
}
......
......@@ -314,7 +314,7 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
int chk_key(MI_CHECK *param, register MI_INFO *info)
{
uint key,found_keys=0,full_text_keys=0;
uint key,found_keys=0,full_text_keys=0,result=0;
ha_rows keys;
ha_checksum old_record_checksum,init_checksum;
my_off_t all_keydata,all_totaldata,key_totlength,length;
......@@ -361,7 +361,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{
mi_check_print_error(param,"Can't read indexpage from filepos: %s",
llstr(share->state.key_root[key],buff));
DBUG_RETURN(-1);
if (!(param->testflag & T_INFO))
DBUG_RETURN(-1);
result= -1;
continue;
}
param->key_file_blocks+=keyinfo->block_length;
keys=0;
......@@ -377,7 +380,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
{
mi_check_print_error(param,"Found %s keys of %s",llstr(keys,buff),
llstr(info->state->records,buff2));
if (!(param->testflag & T_INFO))
DBUG_RETURN(-1);
result= -1;
continue;
}
if (found_keys - full_text_keys == 1 &&
((share->options &
......@@ -391,7 +397,10 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
key+1);
else
mi_check_print_error(param,"Key 1 doesn't point at all records");
DBUG_RETURN(-1);
if (!(param->testflag & T_INFO))
DBUG_RETURN(-1);
result= -1;
continue;
}
}
else
......
......@@ -39,13 +39,13 @@ int _mi_rkey(MI_INFO *info, byte *buf, int inx, const byte *key, uint key_len,
if (raw_key)
{
if (key_len == 0)
key_len=USE_WHOLE_KEY;
key_buff=info->lastkey+info->s->base.max_key_length;
pack_key_length=_mi_pack_key(info,(uint) inx,key_buff,(uchar*) key,key_len);
info->last_rkey_length=pack_key_length;
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,share->keyinfo[inx].seg,
key_buff,pack_key_length););
if (key_len == 0)
key_len=USE_WHOLE_KEY;
key_buff=info->lastkey+info->s->base.max_key_length;
pack_key_length=_mi_pack_key(info,(uint) inx,key_buff,(uchar*) key,key_len);
info->last_rkey_length=pack_key_length;
DBUG_EXECUTE("key",_mi_print_key(DBUG_FILE,share->keyinfo[inx].seg,
key_buff,pack_key_length););
}
else
{
......
......@@ -193,7 +193,7 @@ static struct option long_options[] =
static void print_version(void)
{
printf("%s Ver 1.31 for %s at %s\n",my_progname,SYSTEM_TYPE,
printf("%s Ver 1.32 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
}
......
/* Copyright (C) 2000 MySQL AB & MySQL Finland AB & TCX DataKonsult AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
......@@ -32,6 +32,7 @@
struct file_info {
long process;
int filenr,id;
uint rnd;
my_string name,show_name,record;
MI_INFO *isam;
bool closed,used;
......@@ -70,13 +71,14 @@ static void printf_log(const char *str,...);
static bool cmp_filename(struct file_info *file_info,my_string name);
static uint verbose=0,update=0,test_info=0,max_files=0,re_open_count=0,
recover=0,prefix_remove=0,opt_processes=0;
recover=0,prefix_remove=0,opt_processes=0,opt_myisam_with_debug=0;
static my_string log_filename=0,filepath=0,write_filename=0,record_pos_file=0;
static ulong com_count[10][3],number_of_commands=(ulong) ~0L,
isamlog_process;
static my_off_t isamlog_filepos,start_offset=0,record_pos= HA_OFFSET_ERROR;
static const char *command_name[]=
{"open","write","update","delete","close","extra","lock","re-open","delete-all", NullS};
{"open","write","update","delete","close","extra","lock","re-open",
"delete-all", NullS};
int main(int argc, char **argv)
......@@ -91,11 +93,11 @@ int main(int argc, char **argv)
max_files=(set_maximum_open_files(min(max_files,8))-6)/2;
if (update)
printf("Trying to %s isamfiles according to log '%s'\n",
printf("Trying to %s MyISAM files according to log '%s'\n",
(recover ? "recover" : "update"),log_filename);
error= examine_log(log_filename,argv);
if (update && ! error)
puts("isamfile:s updated successfully");
puts("Tables updated successfully");
total_count=total_error=total_recover=0;
for (i=first=0 ; command_name[i] ; i++)
{
......@@ -134,7 +136,7 @@ static void get_options(register int *argc, register char ***argv)
char option;
help=0;
usage="Usage: %s [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
usage="Usage: %s [-?iruvDIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
pos="";
while (--*argc > 0 && *(pos = *(++*argv)) == '-' ) {
......@@ -199,6 +201,9 @@ static void get_options(register int *argc, register char ***argv)
update=1;
recover++;
break;
case 'D':
opt_myisam_with_debug=1;
break;
case 'P':
opt_processes=1;
break;
......@@ -246,7 +251,7 @@ static void get_options(register int *argc, register char ***argv)
/* Fall through */
case 'I':
case '?':
printf("%s Ver 1.2 for %s at %s\n",my_progname,SYSTEM_TYPE,
printf("%s Ver 1.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
MACHINE_TYPE);
puts("By Monty, for your professional use\n");
if (version)
......@@ -261,7 +266,7 @@ static void get_options(register int *argc, register char ***argv)
puts(" -o \"offset\" -p # \"remove # components from path\"");
puts(" -r \"recover\" -R \"file recordposition\"");
puts(" -u \"update\" -v \"verbose\" -w \"write file\"");
puts(" -P \"processes\"");
puts(" -D \"myisam compileled with DBUG\" -P \"processes\"");
puts("\nOne can give a second and a third '-v' for more verbose.");
puts("Normaly one does a update (-u).");
puts("If a recover is done all writes and all possibly updates and deletes is done\nand errors are only counted.");
......@@ -365,14 +370,16 @@ static int examine_log(my_string file_name, char **table_names)
case MI_LOG_OPEN:
if (!table_names[0])
{
com_count[command][0]--; /* Must be counted explicite */
com_count[command][0]--; /* Must be counted explicite */
if (result)
com_count[command][1]--;
}
if (curr_file_info)
printf("\nWarning: %s is opened twice with same process and filenumber\n",
{
printf("\nWarning: %s is opened with same process and filenumber\nMaybe you should use the -P option ?\n",
curr_file_info->show_name);
}
if (my_b_read(&cache,(byte*) head,2))
goto err;
file_info.name=0;
......@@ -389,7 +396,7 @@ static int examine_log(my_string file_name, char **table_names)
for (pos=file_info.name; pos=strchr(pos,'\\') ; pos++)
*pos= '/';
pos=file_info.name;
pos=file_info.name;
for (i=0 ; i < prefix_remove ; i++)
{
char *next;
......@@ -446,6 +453,10 @@ static int examine_log(my_string file_name, char **table_names)
goto end;
files_open++;
file_info.closed=0;
if (opt_myisam_with_debug)
file_info.isam->s->rnd= 0;
else
file_info.isam->s->rnd= isamlog_process;
}
VOID(tree_insert(&tree,(gptr) &file_info,0));
if (file_info.used)
......@@ -482,10 +493,12 @@ static int examine_log(my_string file_name, char **table_names)
if (mi_extra(curr_file_info->isam,
(int) extra_command) != (int) result)
{
fflush(stdout);
VOID(fprintf(stderr,
"Warning: error %d, expected %d on command %s at %s\n",
my_errno,result,command_name[command],
llstr(isamlog_filepos,llbuff)));
fflush(stderr);
}
}
break;
......@@ -628,9 +641,11 @@ static int examine_log(my_string file_name, char **table_names)
command_name[command],result);
break;
default:
fflush(stdout);
VOID(fprintf(stderr,
"Error: found unknown command %d in logfile, aborted\n",
command));
fflush(stderr);
goto end;
}
}
......@@ -643,12 +658,16 @@ static int examine_log(my_string file_name, char **table_names)
DBUG_RETURN(0);
err:
fflush(stdout);
VOID(fprintf(stderr,"Got error %d when reading from logfile\n",my_errno));
fflush(stderr);
goto end;
com_err:
fflush(stdout);
VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %s\n",
my_errno,result,command_name[command],
llstr(isamlog_filepos,llbuff)));
fflush(stderr);
end:
end_key_cache();
delete_tree(&tree);
......@@ -792,6 +811,7 @@ static int close_some_file(TREE *tree)
(void*) &access_param,left_root_right));
if (!access_param.found)
return 1; /* No open file that is possibly to close */
access_param.found->rnd=access_param.found->isam->s->rnd;
if (mi_close(access_param.found->isam))
return 1;
access_param.found->closed=1;
......@@ -811,6 +831,7 @@ static int reopen_closed_file(TREE *tree, struct file_info *fileinfo)
if (!(fileinfo->isam= mi_open(name,O_RDWR,HA_OPEN_WAIT_IF_LOCKED)))
return 1;
fileinfo->closed=0;
fileinfo->isam->s->rnd=fileinfo->rnd;
re_open_count++;
return 0;
}
......
......@@ -45,6 +45,7 @@ int myrg_rkey(MYRG_INFO *info,byte *record,int inx, const byte *key,
MI_INFO *mi;
int err;
byte *buf=((search_flag == HA_READ_KEY_EXACT) ? record: 0);
LINT_INIT(key_buff);
if (_myrg_init_queue(info,inx,search_flag))
return my_errno;
......
......@@ -30,10 +30,9 @@ static my_string NEAR_F expand_tilde(my_string *path);
/* Pack a dirname ; Changes HOME to ~/ and current dev to ./ */
/* from is a dirname (from dirname() ?) ending with FN_LIBCHAR */
/* to may be == from */
void pack_dirname(my_string to, const char *from)
/* to may be == from */
{
int cwd_err;
uint d_length,length,buff_length;
......
......@@ -20,6 +20,7 @@
#include "mysys_priv.h"
#include "mysys_err.h"
#include <errno.h>
#include <stdio.h>
#ifdef HAVE_FSEEKO
#undef ftell
......
......@@ -388,7 +388,6 @@ int ha_berkeley::close(void)
bool ha_berkeley::fix_rec_buff_for_blob(ulong length)
{
uint extra;
if (! rec_buff || length > alloced_rec_buff_length)
{
byte *newptr;
......@@ -663,7 +662,7 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
const byte * new_row, DBT *prim_key)
{
DBT row, old_key;
int error,new_error;
int error;
DBUG_ENTER("update_primary_key");
if (primary_key_changed)
......@@ -705,9 +704,8 @@ int ha_berkeley::update_primary_key(DB_TXN *trans, bool primary_key_changed,
int ha_berkeley::update_row(const byte * old_row, byte * new_row)
{
DBT row, prim_key, key, old_prim_key;
DBT prim_key, key, old_prim_key;
int error;
uint keynr;
DB_TXN *sub_trans;
bool primary_key_changed;
DBUG_ENTER("update_row");
......@@ -1242,7 +1240,7 @@ THR_LOCK_DATA **ha_berkeley::store_lock(THD *thd, THR_LOCK_DATA **to,
static int create_sub_table(const char *table_name, const char *sub_name,
DBTYPE type, int flags)
{
int error,error2;
int error;
DB *file;
DBUG_ENTER("create_sub_table");
DBUG_PRINT("enter",("sub_name: %s",sub_name));
......
......@@ -37,7 +37,6 @@
/* static functions defined in this file */
static void NEAR_F set_form_timestamp(TABLE *table, byte *record);
static int NEAR_F delete_file(const char *name,const char *ext,int extflag);
ulong ha_read_count, ha_write_count, ha_delete_count, ha_update_count,
......
......@@ -775,7 +775,10 @@ longlong Item_func_locate::val_int()
return 0; /* purecov: inspected */
}
null_value=0;
uint start=0,start0=0;
uint start=0;
#ifdef USE_MB
uint start0=0;
#endif
if (arg_count == 3)
{
start=(uint) args[2]->val_int()-1;
......
......@@ -843,7 +843,7 @@ class Item_func_match :public Item_real_func
FT_DOCLIST *ft_handler;
Item_func_match(List<Item> &a, Item *b): Item_real_func(b),
fields(a), table(0), ft_handler(0), master(0) {}
fields(a), table(0), master(0), ft_handler(0) {}
~Item_func_match()
{
if (!master)
......
......@@ -412,7 +412,6 @@ net_real_write(NET *net,const char *packet,ulong len)
static void my_net_skip_rest(NET *net, ulong remain, thr_alarm_t *alarmed)
{
char buff[1024];
ALARM alarm_buff;
uint retry_count=0;
if (!thr_alarm_in_use(alarmed))
......
This diff is collapsed.
......@@ -553,11 +553,11 @@ bool select_dump::send_data(List<Item> &items)
}
while ((item=li++))
{
Item_result result_type=item->result_type();
res=item->str_result(&tmp);
if (!res)
if (!res) // If NULL
{
if (my_b_write(&cache,(byte*) "",1)) goto err; // NULL
if (my_b_write(&cache,(byte*) "",1))
goto err;
}
else if (my_b_write(&cache,(byte*) res->ptr(),res->length()))
{
......
......@@ -753,13 +753,11 @@ store_create_info(THD *thd, TABLE *table, String* packet)
for (uint j=0 ; j < key_info->key_parts ; j++,key_part++)
{
if(j)
if (j)
packet->append(',');
if(key_part->field)
if (key_part->field)
packet->append(key_part->field->field_name);
KEY *key=table->key_info+i;
if (!key_part->field ||
(key_part->length !=
table->field[key_part->fieldnr-1]->key_length() &&
......
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