mirror of
https://github.com/MariaDB/server.git
synced 2026-05-02 05:05:33 +02:00
merge with 3.23.42
config.guess: Auto merged config.sub: Auto merged ltconfig: Auto merged BitKeeper/deleted/.del-violite.c~d7b85be615595ace: Auto merged BitKeeper/deleted/.del-violite.c~984c09cffe14a11b: Auto merged client/Makefile.am: Auto merged include/errmsg.h: Auto merged include/global.h: Auto merged include/heap.h: Auto merged include/my_sys.h: Auto merged include/mysql_com.h: Auto merged isam/isamlog.c: Auto merged libmysql/libmysql.c: Auto merged merge/open.c: Auto merged myisam/ft_search.c: Auto merged myisam/ftdefs.h: Auto merged myisam/mi_test_all.sh: Auto merged myisam/myisamchk.c: Auto merged myisam/myisamlog.c: Auto merged myisam/myisampack.c: Auto merged myisam/sort.c: Auto merged myisammrg/myrg_open.c: Auto merged mysys/hash.c: Auto merged mysys/mf_casecnv.c: Auto merged mysys/mf_format.c: Auto merged mysys/my_lib.c: Auto merged mysys/tree.c: Auto merged sql-bench/bench-init.pl.sh: Auto merged sql/filesort.cc: Auto merged sql/ha_myisam.cc: Auto merged sql/ha_myisammrg.cc: Auto merged sql/handler.cc: Auto merged sql/handler.h: Auto merged sql/item_func.cc: Auto merged sql/item_strfunc.cc: Auto merged sql/lex.h: Auto merged sql/log.cc: Auto merged sql/log_event.cc: Auto merged sql/mysql_priv.h: Auto merged sql/mysqld.cc: Auto merged sql/net_serv.cc: Auto merged sql/slave.cc: Auto merged sql/sql_acl.cc: Auto merged sql/sql_base.cc: Auto merged sql/sql_class.cc: Auto merged sql/sql_class.h: Auto merged sql/sql_db.cc: Auto merged sql/sql_delete.cc: Auto merged sql/sql_insert.cc: Auto merged sql/sql_parse.cc: Auto merged sql/sql_select.cc: Auto merged sql/sql_show.cc: Auto merged mysql-test/r/func_time.result: Auto merged mysql-test/r/innodb.result: Auto merged mysql-test/t/bdb.test: Auto merged mysql-test/t/err000001.test: Auto merged mysql-test/t/func_time.test: Auto merged mysql-test/t/innodb.test: Auto merged mysql-test/t/overflow.test: Auto merged mysql-test/t/show_check.test: Auto merged sql/sql_table.cc: Auto merged sql/sql_test.cc: Auto merged sql/sql_update.cc: Auto merged sql/sql_yacc.yy: Auto merged strings/ctype.c: Auto merged Docs/manual.texi: Change to 3.23 manual. (I will later add the changes for 4.0 to this copy) client/mysql.cc: merge client/mysqlbinlog.cc: merge client/mysqldump.c: merge client/mysqltest.c: merge client/thread_test.c: merge configure.in: merge include/my_pthread.h: merge include/mysqld_error.h: merge libmysql/net.c: merge myisam/mi_cache.c: merge myisam/mi_check.c: merge mysql-test/t/fulltext.test: merge mysys/mf_qsort.c: merge sql/lock.cc: merge sql/md5.c: merge sql/mini_client.cc: merge sql/share/czech/errmsg.txt: merge sql/share/danish/errmsg.txt: merge sql/share/dutch/errmsg.txt: merge sql/share/english/errmsg.txt: merge sql/share/estonian/errmsg.txt: merge sql/share/french/errmsg.txt: merge sql/share/german/errmsg.txt: merge sql/share/greek/errmsg.txt: merge sql/share/hungarian/errmsg.txt: merge sql/share/italian/errmsg.txt: merge sql/share/japanese/errmsg.txt: merge sql/share/korean/errmsg.txt: merge sql/share/norwegian-ny/errmsg.txt: merge sql/share/norwegian/errmsg.txt: merge sql/share/polish/errmsg.txt: merge sql/share/portuguese/errmsg.txt: merge sql/share/romanian/errmsg.txt: merge sql/share/russian/errmsg.txt: merge sql/share/slovak/errmsg.txt: merge sql/share/spanish/errmsg.txt: merge sql/share/swedish/errmsg.txt: merge sql/sql_load.cc: merge sql/sql_repl.cc: merge
This commit is contained in:
commit
ddee00a6ed
250 changed files with 49828 additions and 42127 deletions
103
isam/isamchk.c
103
isam/isamchk.c
|
|
@ -44,7 +44,7 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */
|
|||
#define T_SORT_RECORDS 4096
|
||||
#define T_SORT_INDEX 8192
|
||||
#define T_WAIT_FOREVER 16384
|
||||
#define T_REP_BY_SORT 32768
|
||||
#define T_REP_BY_SORT 32768L
|
||||
|
||||
|
||||
#define O_NEW_INDEX 1 /* Bits set in out_flag */
|
||||
|
|
@ -74,17 +74,17 @@ SET_STACK_SIZE(9000) /* Minimum stack size for program */
|
|||
#define UPDATE_STAT 2
|
||||
#define UPDATE_SORT 4
|
||||
|
||||
typedef struct st_sort_key_blocks { /* Used when sorting */
|
||||
typedef struct st_isam_sort_key_blocks { /* Used when sorting */
|
||||
uchar *buff,*end_pos;
|
||||
uchar lastkey[N_MAX_POSSIBLE_KEY_BUFF];
|
||||
uint last_length;
|
||||
int inited;
|
||||
} SORT_KEY_BLOCKS;
|
||||
} ISAM_SORT_KEY_BLOCKS;
|
||||
|
||||
typedef struct st_sort_info {
|
||||
typedef struct st_isam_sort_info {
|
||||
N_INFO *info;
|
||||
enum data_file_type new_data_file_type;
|
||||
SORT_KEY_BLOCKS *key_block,*key_block_end;
|
||||
ISAM_SORT_KEY_BLOCKS *key_block,*key_block_end;
|
||||
uint key,find_length;
|
||||
ulong pos,max_pos,filepos,start_recpos,filelength,dupp,max_records,unique,
|
||||
buff_length;
|
||||
|
|
@ -92,9 +92,9 @@ typedef struct st_sort_info {
|
|||
char *record,*buff;
|
||||
N_KEYDEF *keyinfo;
|
||||
N_KEYSEG *keyseg;
|
||||
} SORT_INFO;
|
||||
} ISAM_SORT_INFO;
|
||||
|
||||
enum options {OPT_CHARSETS_DIR=256};
|
||||
enum ic_options {OPT_CHARSETS_DIR_IC=256};
|
||||
|
||||
static ulong use_buffers=0,read_buffer_length=0,write_buffer_length=0,
|
||||
sort_buffer_length=0,sort_key_blocks=0,crc=0,unique_count=0;
|
||||
|
|
@ -120,7 +120,7 @@ static const char *type_names[]=
|
|||
|
||||
static char temp_filename[FN_REFLEN], *isam_file_name, *default_charset;
|
||||
static IO_CACHE read_cache;
|
||||
static SORT_INFO sort_info;
|
||||
static ISAM_SORT_INFO sort_info;
|
||||
static int tmpfile_createflag=O_RDWR | O_TRUNC | O_EXCL;
|
||||
|
||||
static const char *load_default_groups[]= { "isamchk",0 };
|
||||
|
|
@ -137,8 +137,8 @@ static int chk_del(N_INFO *info,uint testflag);
|
|||
static int check_k_link(N_INFO *info,uint nr);
|
||||
static int chk_size(N_INFO *info);
|
||||
static int chk_key(N_INFO *info);
|
||||
static int chk_index(N_INFO *info,N_KEYDEF *keyinfo,ulong page,uchar *buff,
|
||||
ulong *keys,uint level);
|
||||
static int chk_index(N_INFO *info, N_KEYDEF *keyinfo, ulong page, uchar *buff,
|
||||
ulong *keys, uint level);
|
||||
static uint isam_key_length(N_INFO *info,N_KEYDEF *keyinfo);
|
||||
static unsigned long calc_checksum(ulong count);
|
||||
static int chk_data_link(N_INFO *info,int extend);
|
||||
|
|
@ -171,12 +171,12 @@ static int sort_key_cmp(const void *not_used, const void *a,const void *b);
|
|||
static int sort_key_write(const void *a);
|
||||
static ulong get_record_for_key(N_INFO *info,N_KEYDEF *keyinfo,
|
||||
uchar *key);
|
||||
static int sort_insert_key(reg1 SORT_KEY_BLOCKS *key_block,uchar *key,
|
||||
static int sort_insert_key(reg1 ISAM_SORT_KEY_BLOCKS *key_block,uchar *key,
|
||||
ulong prev_block);
|
||||
static int sort_delete_record(void);
|
||||
static void usage(void);
|
||||
static int flush_pending_blocks(void);
|
||||
static SORT_KEY_BLOCKS *alloc_key_blocks(uint blocks,uint buffer_length);
|
||||
static ISAM_SORT_KEY_BLOCKS *alloc_key_blocks(uint blocks,uint buffer_length);
|
||||
static int test_if_almost_full(N_INFO *info);
|
||||
static int recreate_database(N_INFO **info,char *filename);
|
||||
static void save_integer(byte *pos,uint pack_length,ulong value);
|
||||
|
|
@ -186,9 +186,7 @@ static int update_state_info(N_INFO *info,uint update);
|
|||
|
||||
/* Main program */
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int main( int argc, char **argv)
|
||||
{
|
||||
int error;
|
||||
MY_INIT(argv[0]);
|
||||
|
|
@ -255,7 +253,7 @@ static CHANGEABLE_VAR changeable_vars[] = {
|
|||
static struct option long_options[] =
|
||||
{
|
||||
{"analyze", no_argument, 0, 'a'},
|
||||
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR},
|
||||
{"character-sets-dir", required_argument, 0, OPT_CHARSETS_DIR_IC},
|
||||
#ifndef DBUG_OFF
|
||||
{"debug", required_argument, 0, '#'},
|
||||
#endif
|
||||
|
|
@ -284,7 +282,7 @@ static struct option long_options[] =
|
|||
|
||||
static void print_version(void)
|
||||
{
|
||||
printf("%s Ver 5.16 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
printf("%s Ver 5.17 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
}
|
||||
|
||||
|
|
@ -598,7 +596,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||
case 'C':
|
||||
default_charset=optarg;
|
||||
break;
|
||||
case OPT_CHARSETS_DIR:
|
||||
case OPT_CHARSETS_DIR_IC:
|
||||
charsets_dir = optarg;
|
||||
break;
|
||||
case 'b':
|
||||
|
|
@ -706,9 +704,7 @@ static void get_options(register int *argc,register char ***argv)
|
|||
|
||||
/* Check delete links */
|
||||
|
||||
static int chk_del(info,test_flag)
|
||||
reg1 N_INFO *info;
|
||||
uint test_flag;
|
||||
static int chk_del( reg1 N_INFO *info, uint test_flag)
|
||||
{
|
||||
reg2 ulong i;
|
||||
uint j,delete_link_length;
|
||||
|
|
@ -793,9 +789,7 @@ wrong:
|
|||
|
||||
/* Kontrollerar l{nkarna i nyckelfilen */
|
||||
|
||||
static int check_k_link(info,nr)
|
||||
register N_INFO *info;
|
||||
uint nr;
|
||||
static int check_k_link( register N_INFO *info, uint nr)
|
||||
{
|
||||
ulong next_link,records;
|
||||
DBUG_ENTER("check_k_link");
|
||||
|
|
@ -898,8 +892,7 @@ static int chk_size(register N_INFO *info)
|
|||
|
||||
/* Kontrollerar nycklarna */
|
||||
|
||||
static int chk_key(info)
|
||||
register N_INFO *info;
|
||||
static int chk_key( register N_INFO *info)
|
||||
{
|
||||
uint key;
|
||||
ulong keys,all_keydata,all_totaldata,key_totlength,length,
|
||||
|
|
@ -988,12 +981,8 @@ register N_INFO *info;
|
|||
|
||||
/* Check if index is ok */
|
||||
|
||||
static int chk_index(info,keyinfo,page,buff,keys,level)
|
||||
N_INFO *info;
|
||||
N_KEYDEF *keyinfo;
|
||||
ulong page,*keys;
|
||||
uchar *buff;
|
||||
uint level;
|
||||
static int chk_index(N_INFO *info, N_KEYDEF *keyinfo, ulong page, uchar *buff,
|
||||
ulong *keys,uint level)
|
||||
{
|
||||
int flag;
|
||||
uint used_length,comp_flag,nod_flag;
|
||||
|
|
@ -1129,9 +1118,7 @@ ulong count;
|
|||
|
||||
/* Calc length of key in normal isam */
|
||||
|
||||
static uint isam_key_length(info,keyinfo)
|
||||
N_INFO *info;
|
||||
reg1 N_KEYDEF *keyinfo;
|
||||
static uint isam_key_length( N_INFO *info, reg1 N_KEYDEF *keyinfo)
|
||||
{
|
||||
uint length;
|
||||
N_KEYSEG *keyseg;
|
||||
|
|
@ -2962,8 +2949,7 @@ static int sort_key_cmp(const void *not_used __attribute__((unused)),
|
|||
} /* sort_key_cmp */
|
||||
|
||||
|
||||
static int sort_key_write(a)
|
||||
const void *a;
|
||||
static int sort_key_write( const void *a)
|
||||
{
|
||||
int cmp=sort_info.key_block->inited ?
|
||||
_nisam_key_cmp(sort_info.keyseg,sort_info.key_block->lastkey,(uchar*) a,
|
||||
|
|
@ -2997,10 +2983,7 @@ const void *a;
|
|||
|
||||
/* get pointer to record from a key */
|
||||
|
||||
static ulong get_record_for_key(info,keyinfo,key)
|
||||
N_INFO *info;
|
||||
N_KEYDEF *keyinfo;
|
||||
uchar *key;
|
||||
static ulong get_record_for_key( N_INFO *info, N_KEYDEF *keyinfo, uchar *key)
|
||||
{
|
||||
return _nisam_dpos(info,0,key+_nisam_keylength(keyinfo,key));
|
||||
} /* get_record_for_key */
|
||||
|
|
@ -3008,10 +2991,8 @@ uchar *key;
|
|||
|
||||
/* Insert a key in sort-key-blocks */
|
||||
|
||||
static int sort_insert_key(key_block,key,prev_block)
|
||||
reg1 SORT_KEY_BLOCKS *key_block;
|
||||
uchar *key;
|
||||
ulong prev_block;
|
||||
static int sort_insert_key(reg1 ISAM_SORT_KEY_BLOCKS *key_block,
|
||||
uchar *key, ulong prev_block)
|
||||
{
|
||||
uint a_length,t_length,nod_flag;
|
||||
ulong filepos;
|
||||
|
|
@ -3140,7 +3121,7 @@ static int flush_pending_blocks()
|
|||
uint nod_flag,length;
|
||||
ulong filepos;
|
||||
N_INFO *info;
|
||||
SORT_KEY_BLOCKS *key_block;
|
||||
ISAM_SORT_KEY_BLOCKS *key_block;
|
||||
DBUG_ENTER("flush_pending_blocks");
|
||||
|
||||
filepos= NI_POS_ERROR; /* if empty file */
|
||||
|
|
@ -3169,16 +3150,15 @@ static int flush_pending_blocks()
|
|||
|
||||
/* alloc space and pointers for key_blocks */
|
||||
|
||||
static SORT_KEY_BLOCKS *alloc_key_blocks(blocks,buffer_length)
|
||||
uint blocks,buffer_length;
|
||||
static ISAM_SORT_KEY_BLOCKS *alloc_key_blocks(uint blocks, uint buffer_length)
|
||||
{
|
||||
reg1 uint i;
|
||||
SORT_KEY_BLOCKS *block;
|
||||
ISAM_SORT_KEY_BLOCKS *block;
|
||||
DBUG_ENTER("alloc_key_blocks");
|
||||
|
||||
if (!(block=(SORT_KEY_BLOCKS*) my_malloc((sizeof(SORT_KEY_BLOCKS)+
|
||||
buffer_length+IO_SIZE)*blocks,
|
||||
MYF(0))))
|
||||
if (!(block=(ISAM_SORT_KEY_BLOCKS*) my_malloc((sizeof(ISAM_SORT_KEY_BLOCKS)+
|
||||
buffer_length+IO_SIZE)*blocks,
|
||||
MYF(0))))
|
||||
{
|
||||
print_error("Not Enough memory for sort-key-blocks");
|
||||
return(0);
|
||||
|
|
@ -3253,8 +3233,7 @@ void print_error(const char *fmt,...)
|
|||
|
||||
/* Check if file is almost full */
|
||||
|
||||
static int test_if_almost_full(info)
|
||||
N_INFO *info;
|
||||
static int test_if_almost_full(N_INFO *info)
|
||||
{
|
||||
double diff= 0.9;
|
||||
if (info->s->base.options & HA_OPTION_COMPRESS_RECORD)
|
||||
|
|
@ -3274,9 +3253,7 @@ N_INFO *info;
|
|||
|
||||
/* Recreate table with bigger more alloced record-data */
|
||||
|
||||
static int recreate_database(org_info,filename)
|
||||
N_INFO **org_info;
|
||||
char *filename;
|
||||
static int recreate_database(N_INFO **org_info, char *filename)
|
||||
{
|
||||
int error;
|
||||
N_INFO info;
|
||||
|
|
@ -3369,10 +3346,7 @@ end:
|
|||
|
||||
/* Store long in 1,2,3 or 4 bytes */
|
||||
|
||||
static void save_integer(pos,pack_length,value)
|
||||
byte *pos;
|
||||
uint pack_length;
|
||||
ulong value;
|
||||
static void save_integer( byte *pos, uint pack_length, ulong value)
|
||||
{
|
||||
switch (pack_length) {
|
||||
case 4: int4store(pos,value); break;
|
||||
|
|
@ -3386,8 +3360,7 @@ ulong value;
|
|||
|
||||
/* write suffix to data file if neaded */
|
||||
|
||||
static int write_data_suffix(info)
|
||||
N_INFO *info;
|
||||
static int write_data_suffix( N_INFO *info)
|
||||
{
|
||||
if (info->s->base.options & HA_OPTION_COMPRESS_RECORD &&
|
||||
sort_info.fix_datafile)
|
||||
|
|
@ -3407,9 +3380,7 @@ N_INFO *info;
|
|||
|
||||
/* Update state and isamchk_time of indexfile */
|
||||
|
||||
static int update_state_info(info,update)
|
||||
N_INFO *info;
|
||||
uint update;
|
||||
static int update_state_info( N_INFO *info, uint update)
|
||||
{
|
||||
ISAM_SHARE *share=info->s;
|
||||
uint base_pos=uint2korr(info->s->state.header.base_pos);
|
||||
|
|
|
|||
208
isam/isamlog.c
208
isam/isamlog.c
|
|
@ -1,15 +1,15 @@
|
|||
/* 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 */
|
||||
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
#define FILENAME(A) (A ? A->show_name : "Unknown")
|
||||
|
||||
struct file_info {
|
||||
struct isamlog_file_info {
|
||||
long process;
|
||||
int filenr,id;
|
||||
my_string name,show_name,record;
|
||||
|
|
@ -46,7 +46,7 @@ struct test_if_open_param {
|
|||
struct st_access_param
|
||||
{
|
||||
ulong min_accessed;
|
||||
struct file_info *found;
|
||||
struct isamlog_file_info *found;
|
||||
};
|
||||
|
||||
#define NO_FILEPOS (ulong) ~0L
|
||||
|
|
@ -56,21 +56,22 @@ static void get_options(int *argc,char ***argv);
|
|||
static int examine_log(my_string file_name,char **table_names);
|
||||
static int read_string(IO_CACHE *file,gptr *to,uint length);
|
||||
static int file_info_compare(void *a,void *b);
|
||||
static int test_if_open(struct file_info *key,element_count count,
|
||||
static int test_if_open(struct isamlog_file_info *key,element_count count,
|
||||
struct test_if_open_param *param);
|
||||
static void fix_blob_pointers(N_INFO *isam,byte *record);
|
||||
static uint set_maximum_open_files(uint);
|
||||
static int test_when_accessed(struct file_info *key,element_count count,
|
||||
static int test_when_accessed(struct isamlog_file_info *key,element_count count,
|
||||
struct st_access_param *access_param);
|
||||
static void file_info_free(struct file_info *info);
|
||||
static void file_info_free(struct isamlog_file_info *info);
|
||||
static int close_some_file(TREE *tree);
|
||||
static int reopen_closed_file(TREE *tree,struct file_info *file_info);
|
||||
static int find_record_with_key(struct file_info *file_info,byte *record);
|
||||
static int reopen_closed_file(TREE *tree,struct isamlog_file_info *file_info);
|
||||
static int find_record_with_key(struct isamlog_file_info *file_info,
|
||||
byte *record);
|
||||
static void printf_log(const char *str,...);
|
||||
static bool cmp_filename(struct file_info *file_info,my_string name);
|
||||
static bool cmp_filename(struct isamlog_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;
|
||||
recover=0,prefix_remove=0,opt_processes=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,start_offset=0,
|
||||
record_pos= NO_FILEPOS,isamlog_filepos,isamlog_process;
|
||||
|
|
@ -78,9 +79,7 @@ static const char *command_name[]=
|
|||
{"open","write","update","delete","close","extra","lock","re-open",NullS};
|
||||
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char **argv;
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
int error,i,first;
|
||||
ulong total_count,total_error,total_recover;
|
||||
|
|
@ -92,11 +91,11 @@ 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 ISAM 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++)
|
||||
{
|
||||
|
|
@ -128,17 +127,15 @@ char **argv;
|
|||
} /* main */
|
||||
|
||||
|
||||
static void get_options(argc,argv)
|
||||
register int *argc;
|
||||
register char ***argv;
|
||||
static void get_options(register int *argc, register char ***argv)
|
||||
{
|
||||
int help,version;
|
||||
const char *usage;
|
||||
char *pos, option;
|
||||
const char *pos,*usage;
|
||||
char option;
|
||||
|
||||
help=0;
|
||||
usage="Usage: %s [-?iruvIV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
|
||||
pos= (char*) "";
|
||||
usage="Usage: %s [-?iruvIPV] [-c #] [-f #] [-F filepath/] [-o #] [-R file recordpos] [-w write_file] [log-filename [table ...]] \n";
|
||||
pos= "";
|
||||
|
||||
while (--*argc > 0 && *(pos = *(++*argv)) == '-' ) {
|
||||
while (*++pos)
|
||||
|
|
@ -147,7 +144,7 @@ register char ***argv;
|
|||
switch((option=*pos)) {
|
||||
case '#':
|
||||
DBUG_PUSH (++pos);
|
||||
pos= (char*) " "; /* Skipp rest of arg */
|
||||
pos=" "; /* Skipp rest of arg */
|
||||
break;
|
||||
case 'c':
|
||||
if (! *++pos)
|
||||
|
|
@ -158,7 +155,7 @@ register char ***argv;
|
|||
pos= *(++*argv);
|
||||
}
|
||||
number_of_commands=(ulong) atol(pos);
|
||||
pos= (char*) " ";
|
||||
pos=" ";
|
||||
break;
|
||||
case 'u':
|
||||
update=1;
|
||||
|
|
@ -172,7 +169,7 @@ register char ***argv;
|
|||
pos= *(++*argv);
|
||||
}
|
||||
max_files=(uint) atoi(pos);
|
||||
pos= (char*) " ";
|
||||
pos=" ";
|
||||
break;
|
||||
case 'i':
|
||||
test_info=1;
|
||||
|
|
@ -186,7 +183,7 @@ register char ***argv;
|
|||
pos= *(++*argv);
|
||||
}
|
||||
start_offset=(ulong) atol(pos);
|
||||
pos= (char*) " ";
|
||||
pos=" ";
|
||||
break;
|
||||
case 'p':
|
||||
if (! *++pos)
|
||||
|
|
@ -202,6 +199,9 @@ register char ***argv;
|
|||
update=1;
|
||||
recover++;
|
||||
break;
|
||||
case 'P':
|
||||
opt_processes=1;
|
||||
break;
|
||||
case 'R':
|
||||
if (! *++pos)
|
||||
{
|
||||
|
|
@ -210,11 +210,11 @@ register char ***argv;
|
|||
else
|
||||
pos= *(++*argv);
|
||||
}
|
||||
record_pos_file=pos;
|
||||
record_pos_file=(char*) pos;
|
||||
if (!--*argc)
|
||||
goto err;
|
||||
record_pos=(ulong) atol(*(++*argv));
|
||||
pos= (char*) " ";
|
||||
pos= " ";
|
||||
break;
|
||||
case 'v':
|
||||
verbose++;
|
||||
|
|
@ -227,8 +227,8 @@ register char ***argv;
|
|||
else
|
||||
pos= *(++*argv);
|
||||
}
|
||||
write_filename=pos;
|
||||
pos= (char*) " ";
|
||||
write_filename=(char*) pos;
|
||||
pos=" ";
|
||||
break;
|
||||
case 'F':
|
||||
if (! *++pos)
|
||||
|
|
@ -238,20 +238,20 @@ register char ***argv;
|
|||
else
|
||||
pos= *(++*argv);
|
||||
}
|
||||
filepath=pos;
|
||||
pos= (char*) " ";
|
||||
filepath= (char*) pos;
|
||||
pos=" ";
|
||||
break;
|
||||
case 'V':
|
||||
version=1;
|
||||
/* Fall through */
|
||||
case 'I':
|
||||
case '?':
|
||||
printf("%s Ver 3.2 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
printf("%s Ver 3.3 for %s at %s\n",my_progname,SYSTEM_TYPE,
|
||||
MACHINE_TYPE);
|
||||
puts("TCX Datakonsult AB, by Monty, for your professional use\n");
|
||||
puts("By Monty, for your professional use\n");
|
||||
if (version)
|
||||
break;
|
||||
puts("Write info about whats in a nisam log file.");
|
||||
puts("Write info about whats in a ISAM log file.");
|
||||
printf("If no file name is given %s is used\n",log_filename);
|
||||
puts("");
|
||||
printf(usage,my_progname);
|
||||
|
|
@ -261,6 +261,7 @@ 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("\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.");
|
||||
|
|
@ -281,7 +282,7 @@ register char ***argv;
|
|||
}
|
||||
if (*argc >= 1)
|
||||
{
|
||||
log_filename=pos;
|
||||
log_filename=(char*) pos;
|
||||
(*argc)--;
|
||||
(*argv)++;
|
||||
}
|
||||
|
|
@ -308,7 +309,8 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
FILE *write_file;
|
||||
enum ha_extra_function extra_command;
|
||||
TREE tree;
|
||||
struct file_info file_info,*curr_file_info;
|
||||
struct isamlog_file_info file_info,*curr_file_info;
|
||||
char llbuff[22],llbuff2[22];
|
||||
DBUG_ENTER("examine_log");
|
||||
|
||||
if ((file=my_open(file_name,O_RDONLY,MYF(MY_WME))) < 0)
|
||||
|
|
@ -336,8 +338,11 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
isamlog_filepos=my_b_tell(&cache)-9L;
|
||||
file_info.filenr=uint2korr(head+1);
|
||||
isamlog_process=file_info.process=(long) uint4korr(head+3);
|
||||
if (!opt_processes)
|
||||
file_info.process=0;
|
||||
result=uint2korr(head+7);
|
||||
if ((curr_file_info=(struct file_info*) tree_search(&tree,&file_info)))
|
||||
if ((curr_file_info=(struct isamlog_file_info*)
|
||||
tree_search(&tree,&file_info)))
|
||||
{
|
||||
curr_file_info->accessed=access_time;
|
||||
if (update && curr_file_info->used && curr_file_info->closed)
|
||||
|
|
@ -352,7 +357,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
command=(uint) head[0];
|
||||
if (command < sizeof(com_count)/sizeof(com_count[0][0])/3 &&
|
||||
(!curr_file_info || curr_file_info->used))
|
||||
(!table_names[0] || (curr_file_info && curr_file_info->used)))
|
||||
{
|
||||
com_count[command][0]++;
|
||||
if (result)
|
||||
|
|
@ -360,12 +365,15 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
switch ((enum nisam_log_commands) command) {
|
||||
case LOG_OPEN:
|
||||
com_count[command][0]--; /* Must be counted explicite */
|
||||
if (result)
|
||||
com_count[command][1]--;
|
||||
if (!table_names[0])
|
||||
{
|
||||
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;
|
||||
|
|
@ -376,11 +384,17 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
goto err;
|
||||
{
|
||||
uint i;
|
||||
char *pos=file_info.name,*to;
|
||||
char *pos,*to;
|
||||
|
||||
/* Fix if old DOS files to new format */
|
||||
for (pos=file_info.name; (pos=strchr(pos,'\\')) ; pos++)
|
||||
*pos= '/';
|
||||
|
||||
pos=file_info.name;
|
||||
for (i=0 ; i < prefix_remove ; i++)
|
||||
{
|
||||
char *next;
|
||||
if (!(next=strchr(pos,FN_LIBCHAR)))
|
||||
if (!(next=strchr(pos,'/')))
|
||||
break;
|
||||
pos=next+1;
|
||||
}
|
||||
|
|
@ -426,7 +440,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
files_open--;
|
||||
}
|
||||
if (!(file_info.isam= nisam_open(isam_file_name,O_RDWR,
|
||||
HA_OPEN_WAIT_IF_LOCKED)))
|
||||
HA_OPEN_WAIT_IF_LOCKED)))
|
||||
goto com_err;
|
||||
if (!(file_info.record=my_malloc(file_info.isam->s->base.reclength,
|
||||
MYF(MY_WME))))
|
||||
|
|
@ -438,7 +452,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
if (file_info.used)
|
||||
{
|
||||
if (verbose && !record_pos_file)
|
||||
printf_log("%s: open",file_info.show_name);
|
||||
printf_log("%s: open -> %d",file_info.show_name, file_info.filenr);
|
||||
com_count[command][0]++;
|
||||
if (result)
|
||||
com_count[command][1]++;
|
||||
|
|
@ -453,7 +467,6 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
{
|
||||
if (!curr_file_info->closed)
|
||||
files_open--;
|
||||
file_info_free(curr_file_info);
|
||||
VOID(tree_delete(&tree,(gptr) curr_file_info));
|
||||
}
|
||||
break;
|
||||
|
|
@ -464,14 +477,17 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
if (verbose && !record_pos_file &&
|
||||
(!table_names[0] || (curr_file_info && curr_file_info->used)))
|
||||
printf_log("%s: %s(%d) -> %d",FILENAME(curr_file_info),
|
||||
command_name[command], extra_command,result);
|
||||
command_name[command], (int) extra_command,result);
|
||||
if (update && curr_file_info && !curr_file_info->closed)
|
||||
{
|
||||
if (nisam_extra(curr_file_info->isam,extra_command) != (int) result)
|
||||
{
|
||||
fflush(stdout);
|
||||
VOID(fprintf(stderr,
|
||||
"Warning: error %d, expected %d on command %s at %lx\n",
|
||||
my_errno,result,command_name[command],isamlog_filepos));
|
||||
"Warning: error %d, expected %d on command %s at %s\n",
|
||||
my_errno,result,command_name[command],
|
||||
llstr(isamlog_filepos,llbuff)));
|
||||
fflush(stderr);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -501,6 +517,9 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
goto com_err;
|
||||
if (ni_result)
|
||||
com_count[command][2]++; /* Mark error */
|
||||
if (verbose)
|
||||
printf_log("error: Got result %d from mi_delete instead of %d",
|
||||
ni_result, result);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
|
@ -539,6 +558,8 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
result=0;
|
||||
goto com_err;
|
||||
}
|
||||
if (verbose)
|
||||
printf_log("error: Didn't find row to update with mi_rrnd");
|
||||
if (recover == 1 || result ||
|
||||
find_record_with_key(curr_file_info,buff))
|
||||
{
|
||||
|
|
@ -553,6 +574,9 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
{
|
||||
if (!recover)
|
||||
goto com_err;
|
||||
if (verbose)
|
||||
printf_log("error: Got result %d from mi_update instead of %d",
|
||||
ni_result, result);
|
||||
if (ni_result)
|
||||
com_count[command][2]++; /* Mark error */
|
||||
}
|
||||
|
|
@ -570,9 +594,10 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
if (! recover && filepos != curr_file_info->isam->lastpos)
|
||||
{
|
||||
printf("Warning: Wrote at position: %ld, should have been %ld",
|
||||
curr_file_info->isam->lastpos,(long) filepos);
|
||||
goto com_err;
|
||||
printf("error: Wrote at position: %s, should have been %s",
|
||||
llstr(curr_file_info->isam->lastpos,llbuff),
|
||||
llstr(filepos,llbuff2));
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -597,6 +622,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
VOID(fprintf(stderr,
|
||||
"Error: found unknown command %d in logfile, aborted\n",
|
||||
command));
|
||||
fflush(stderr);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
|
|
@ -609,11 +635,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:
|
||||
VOID(fprintf(stderr,"Got error %d, expected %d on command %s at %lx\n",
|
||||
my_errno,result,command_name[command],isamlog_filepos));
|
||||
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);
|
||||
|
|
@ -625,10 +656,7 @@ static int examine_log(my_string file_name, char **table_names)
|
|||
}
|
||||
|
||||
|
||||
static int read_string(file,to,length)
|
||||
IO_CACHE *file;
|
||||
reg1 gptr *to;
|
||||
reg2 uint length;
|
||||
static int read_string(IO_CACHE *file, reg1 gptr *to, reg2 uint length)
|
||||
{
|
||||
DBUG_ENTER("read_string");
|
||||
|
||||
|
|
@ -647,24 +675,22 @@ reg2 uint length;
|
|||
} /* read_string */
|
||||
|
||||
|
||||
static int file_info_compare(a,b)
|
||||
void *a;
|
||||
void *b;
|
||||
static int file_info_compare(void *a, void *b)
|
||||
{
|
||||
long lint;
|
||||
|
||||
if ((lint=((struct file_info*) a)->process -
|
||||
((struct file_info*) b)->process))
|
||||
if ((lint=((struct isamlog_file_info*) a)->process -
|
||||
((struct isamlog_file_info*) b)->process))
|
||||
return lint < 0L ? -1 : 1;
|
||||
return ((struct file_info*) a)->filenr - ((struct file_info*) b)->filenr;
|
||||
return (((struct isamlog_file_info*) a)->filenr -
|
||||
((struct isamlog_file_info*) b)->filenr);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
|
||||
static int test_if_open (key,count,param)
|
||||
struct file_info *key;
|
||||
element_count count __attribute__((unused));
|
||||
struct test_if_open_param *param;
|
||||
static int test_if_open (struct isamlog_file_info *key,
|
||||
element_count count __attribute__((unused)),
|
||||
struct test_if_open_param *param)
|
||||
{
|
||||
if (!strcmp(key->name,param->name) && key->id > param->max_id)
|
||||
param->max_id=key->id;
|
||||
|
|
@ -672,9 +698,7 @@ struct test_if_open_param *param;
|
|||
}
|
||||
|
||||
|
||||
static void fix_blob_pointers(info,record)
|
||||
N_INFO *info;
|
||||
byte *record;
|
||||
static void fix_blob_pointers( N_INFO *info, byte *record)
|
||||
{
|
||||
byte *pos;
|
||||
N_BLOB *blob,*end;
|
||||
|
|
@ -689,8 +713,7 @@ byte *record;
|
|||
}
|
||||
}
|
||||
|
||||
static uint set_maximum_open_files(maximum_files)
|
||||
uint maximum_files;
|
||||
static uint set_maximum_open_files(uint maximum_files)
|
||||
{
|
||||
#if defined(HAVE_GETRUSAGE) && defined(RLIMIT_NOFILE)
|
||||
struct rlimit rlimit;
|
||||
|
|
@ -725,10 +748,9 @@ uint maximum_files;
|
|||
/* close the file with hasn't been accessed for the longest time */
|
||||
/* ARGSUSED */
|
||||
|
||||
static int test_when_accessed (key,count,access_param)
|
||||
struct file_info *key;
|
||||
element_count count __attribute__((unused));
|
||||
struct st_access_param *access_param;
|
||||
static int test_when_accessed (struct isamlog_file_info *key,
|
||||
element_count count __attribute__((unused)),
|
||||
struct st_access_param *access_param)
|
||||
{
|
||||
if (key->accessed < access_param->min_accessed && ! key->closed)
|
||||
{
|
||||
|
|
@ -739,9 +761,9 @@ struct st_access_param *access_param;
|
|||
}
|
||||
|
||||
|
||||
static void file_info_free(fileinfo)
|
||||
struct file_info *fileinfo;
|
||||
static void file_info_free(struct isamlog_file_info *fileinfo)
|
||||
{
|
||||
DBUG_ENTER("file_info_free");
|
||||
if (update)
|
||||
{
|
||||
if (!fileinfo->closed)
|
||||
|
|
@ -751,12 +773,12 @@ struct file_info *fileinfo;
|
|||
}
|
||||
my_free(fileinfo->name,MYF(0));
|
||||
my_free(fileinfo->show_name,MYF(0));
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int close_some_file(tree)
|
||||
TREE *tree;
|
||||
static int close_some_file(TREE *tree)
|
||||
{
|
||||
struct st_access_param access_param;
|
||||
|
||||
|
|
@ -774,9 +796,7 @@ TREE *tree;
|
|||
}
|
||||
|
||||
|
||||
static int reopen_closed_file(tree,fileinfo)
|
||||
TREE *tree;
|
||||
struct file_info *fileinfo;
|
||||
static int reopen_closed_file(TREE *tree, struct isamlog_file_info *fileinfo)
|
||||
{
|
||||
char name[FN_REFLEN];
|
||||
if (close_some_file(tree))
|
||||
|
|
@ -794,9 +814,8 @@ struct file_info *fileinfo;
|
|||
|
||||
/* Try to find record with uniq key */
|
||||
|
||||
static int find_record_with_key(file_info,record)
|
||||
struct file_info *file_info;
|
||||
byte *record;
|
||||
static int find_record_with_key(struct isamlog_file_info *file_info,
|
||||
byte *record)
|
||||
{
|
||||
uint key;
|
||||
N_INFO *info=file_info->isam;
|
||||
|
|
@ -817,10 +836,11 @@ byte *record;
|
|||
|
||||
static void printf_log(const char *format,...)
|
||||
{
|
||||
char llbuff[21];
|
||||
va_list args;
|
||||
va_start(args,format);
|
||||
if (verbose > 2)
|
||||
printf("%9ld:",isamlog_filepos);
|
||||
printf("%9s:",llstr(isamlog_filepos,llbuff));
|
||||
if (verbose > 1)
|
||||
printf("%5ld ",isamlog_process); /* Write process number */
|
||||
(void) vprintf((char*) format,args);
|
||||
|
|
@ -829,9 +849,7 @@ static void printf_log(const char *format,...)
|
|||
}
|
||||
|
||||
|
||||
static bool cmp_filename(file_info,name)
|
||||
struct file_info *file_info;
|
||||
my_string name;
|
||||
static bool cmp_filename(struct isamlog_file_info *file_info,my_string name)
|
||||
{
|
||||
if (!file_info)
|
||||
return 1;
|
||||
|
|
|
|||
|
|
@ -21,9 +21,7 @@ static void get_options(int argc, char *argv[]);
|
|||
static int rec_pointer_size=0,verbose=0,remove_ant=0,pack_keys=1,flags[50],
|
||||
packed_field=FIELD_SKIPP_PRESPACE;
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
N_INFO *file;
|
||||
int i,j,error,deleted,found;
|
||||
|
|
@ -145,9 +143,7 @@ err:
|
|||
/* l{ser optioner */
|
||||
/* OBS! intierar endast DEBUG - ingen debuggning h{r ! */
|
||||
|
||||
static void get_options(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
static void get_options(int argc, char *argv[])
|
||||
{
|
||||
char *pos;
|
||||
|
||||
|
|
|
|||
59
isam/test2.c
59
isam/test2.c
|
|
@ -53,13 +53,11 @@ static char record[300],record2[300],key[100],key2[100],
|
|||
|
||||
/* Test program */
|
||||
|
||||
int main(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
uint i;
|
||||
int j,n1,n2,n3,error,k;
|
||||
uint write_count,update,dupp_keys,delete,start,length,blob_pos,
|
||||
uint write_count,update,dupp_keys,opt_delete,start,length,blob_pos,
|
||||
reclength,ant;
|
||||
ulong lastpos,range_records,records;
|
||||
N_INFO *file;
|
||||
|
|
@ -138,7 +136,7 @@ char *argv[];
|
|||
else
|
||||
recinfo[6].base.type= FIELD_LAST;
|
||||
|
||||
write_count=update=dupp_keys=delete=0;
|
||||
write_count=update=dupp_keys=opt_delete=0;
|
||||
blob_buffer=0;
|
||||
|
||||
for (i=999 ; i>0 ; i--) key1[i]=0;
|
||||
|
|
@ -232,7 +230,7 @@ char *argv[];
|
|||
printf("error: %d; can't delete record: \"%s\"\n", my_errno,read_record);
|
||||
goto err;
|
||||
}
|
||||
delete++;
|
||||
opt_delete++;
|
||||
key1[atoi(read_record+keyinfo[0].seg[0].base.start)]--;
|
||||
key3[atoi(read_record+keyinfo[2].seg[0].base.start)]=0;
|
||||
}
|
||||
|
|
@ -346,9 +344,9 @@ char *argv[];
|
|||
}
|
||||
while (nisam_rnext(file,read_record3,0) == 0 && ant < write_count+10)
|
||||
ant++;
|
||||
if (ant != write_count - delete)
|
||||
if (ant != write_count - opt_delete)
|
||||
{
|
||||
printf("next: I found: %d records of %d\n",ant,write_count - delete);
|
||||
printf("next: I found: %d records of %d\n",ant,write_count - opt_delete);
|
||||
goto end;
|
||||
}
|
||||
if (nisam_rlast(file,read_record2,0) ||
|
||||
|
|
@ -362,7 +360,7 @@ char *argv[];
|
|||
ant=1;
|
||||
while (nisam_rprev(file,read_record3,0) == 0 && ant < write_count+10)
|
||||
ant++;
|
||||
if (ant != write_count - delete)
|
||||
if (ant != write_count - opt_delete)
|
||||
{
|
||||
printf("prev: I found: %d records of %d\n",ant,write_count);
|
||||
goto end;
|
||||
|
|
@ -414,7 +412,7 @@ char *argv[];
|
|||
if (nisam_rkey(file,read_record,0,key,0,HA_READ_KEY_EXACT)) goto err;
|
||||
if (nisam_rnext(file,read_record3,0)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
while (nisam_rnext(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
|
@ -431,7 +429,7 @@ char *argv[];
|
|||
if (nisam_rprev(file,read_record3,0)) goto err;
|
||||
if (nisam_rprev(file,read_record3,0)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
while (nisam_rprev(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
|
@ -447,7 +445,7 @@ char *argv[];
|
|||
DBUG_PRINT("progpos",("first - delete - next -> last"));
|
||||
if (nisam_rkey(file,read_record3,0,key,0,HA_READ_KEY_EXACT)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=1;
|
||||
if (nisam_rnext(file,read_record,0))
|
||||
goto err; /* Skall finnas poster */
|
||||
|
|
@ -463,7 +461,7 @@ char *argv[];
|
|||
DBUG_PRINT("progpos",("last - delete - prev -> first"));
|
||||
if (nisam_rprev(file,read_record3,0)) goto err;
|
||||
if (nisam_delete(file,read_record3)) goto err;
|
||||
delete++;
|
||||
opt_delete++;
|
||||
ant=0;
|
||||
while (nisam_rprev(file,read_record3,0) == 0 &&
|
||||
bcmp(read_record3+start,key,length) == 0) ant++;
|
||||
|
|
@ -555,11 +553,11 @@ char *argv[];
|
|||
|
||||
printf("- nisam_info\n");
|
||||
nisam_info(file,&info,0);
|
||||
if (info.records != write_count-delete || info.deleted > delete + update
|
||||
if (info.records != write_count-opt_delete || info.deleted > opt_delete + update
|
||||
|| info.keys != keys)
|
||||
{
|
||||
puts("Wrong info from nisam_info");
|
||||
printf("Got: records: %ld delete: %ld i_keys: %d\n",
|
||||
printf("Got: records: %ld opt_delete: %ld i_keys: %d\n",
|
||||
info.records,info.deleted,info.keys);
|
||||
}
|
||||
if (verbose)
|
||||
|
|
@ -591,10 +589,10 @@ char *argv[];
|
|||
while ((error=nisam_rrnd(file,record,NI_POS_ERROR)) >= 0 &&
|
||||
ant < write_count + 10)
|
||||
ant+= error ? 0 : 1;
|
||||
if (ant != write_count-delete)
|
||||
if (ant != write_count-opt_delete)
|
||||
{
|
||||
printf("rrnd with cache: I can only find: %d records of %d\n",
|
||||
ant,write_count-delete);
|
||||
ant,write_count-opt_delete);
|
||||
goto end;
|
||||
}
|
||||
if (nisam_extra(file,HA_EXTRA_NO_CACHE))
|
||||
|
|
@ -648,14 +646,14 @@ char *argv[];
|
|||
printf("can't delete record: %s\n",read_record);
|
||||
goto err;
|
||||
}
|
||||
delete++;
|
||||
opt_delete++;
|
||||
}
|
||||
}
|
||||
if (my_errno != HA_ERR_END_OF_FILE && my_errno != HA_ERR_RECORD_DELETED)
|
||||
printf("error: %d from nisam_rrnd\n",my_errno);
|
||||
if (write_count != delete)
|
||||
if (write_count != opt_delete)
|
||||
{
|
||||
printf("Deleted only %d of %d records\n",write_count,delete);
|
||||
printf("Deleted only %d of %d records\n",write_count,opt_delete);
|
||||
goto err;
|
||||
}
|
||||
end:
|
||||
|
|
@ -663,7 +661,7 @@ end:
|
|||
goto err;
|
||||
nisam_panic(HA_PANIC_CLOSE); /* Should close log */
|
||||
printf("\nFollowing test have been made:\n");
|
||||
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,delete);
|
||||
printf("Write records: %d\nUpdate records: %d\nSame-key-read: %d\nDelete records: %d\n", write_count,update,dupp_keys,opt_delete);
|
||||
if (rec_pointer_size)
|
||||
printf("Record pointer size: %d\n",rec_pointer_size);
|
||||
if (key_cacheing)
|
||||
|
|
@ -692,9 +690,7 @@ err:
|
|||
/* l{ser optioner */
|
||||
/* OBS! intierar endast DEBUG - ingen debuggning h{r ! */
|
||||
|
||||
static void get_options(argc,argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
static void get_options( int argc, char *argv[])
|
||||
{
|
||||
char *pos,*progname;
|
||||
DEBUGGER_OFF;
|
||||
|
|
@ -785,8 +781,7 @@ char *argv[];
|
|||
|
||||
/* Ge ett randomv{rde inom ett intervall 0 <=x <= n */
|
||||
|
||||
static uint rnd(max_value)
|
||||
uint max_value;
|
||||
static uint rnd( uint max_value)
|
||||
{
|
||||
return (uint) ((rand() & 32767)/32767.0*max_value);
|
||||
} /* rnd */
|
||||
|
|
@ -794,9 +789,7 @@ uint max_value;
|
|||
|
||||
/* G|r en record av skiftande length */
|
||||
|
||||
static void fix_length(rec,length)
|
||||
byte *rec;
|
||||
uint length;
|
||||
static void fix_length( byte *rec, uint length)
|
||||
{
|
||||
bmove(rec+STANDAR_LENGTH,
|
||||
"0123456789012345678901234567890123456789012345678901234567890",
|
||||
|
|
@ -807,8 +800,7 @@ uint length;
|
|||
|
||||
/* Put maybe a blob in record */
|
||||
|
||||
static void put_blob_in_record(blob_pos,blob_buffer)
|
||||
char *blob_pos,**blob_buffer;
|
||||
static void put_blob_in_record(char *blob_pos, char **blob_buffer)
|
||||
{
|
||||
ulong i,length;
|
||||
if (use_blob)
|
||||
|
|
@ -836,10 +828,7 @@ char *blob_pos,**blob_buffer;
|
|||
}
|
||||
|
||||
|
||||
static void copy_key(info,inx,rec,key_buff)
|
||||
N_INFO *info;
|
||||
uint inx;
|
||||
uchar *rec,*key_buff;
|
||||
static void copy_key( N_INFO *info, uint inx, uchar *rec, uchar *key_buff)
|
||||
{
|
||||
N_KEYSEG *keyseg;
|
||||
|
||||
|
|
|
|||
|
|
@ -11,16 +11,16 @@ test2 -L -K -W -P
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Locking used
|
||||
|
|
@ -37,16 +37,16 @@ test2 -L -K -W -P -A
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Asyncron io with locking used
|
||||
|
|
@ -62,16 +62,16 @@ test2 -L -K -W -P -S -R1 -m500
|
|||
- Test read key-part
|
||||
- Read key (first) - next - delete - next -> last
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 484
|
||||
Update records: 48
|
||||
Same-key-read: 3
|
||||
Delete records: 484
|
||||
Write records: 475
|
||||
Update records: 44
|
||||
Same-key-read: 4
|
||||
Delete records: 475
|
||||
Record pointer size: 1
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
|
|
@ -79,8 +79,31 @@ Locking used
|
|||
test2 -L -K -R1 -m2000 ; Should give error 135
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
Error: 135 in write at record: 1122
|
||||
got error: 135 when using NISAM-database
|
||||
- Delete
|
||||
- Update
|
||||
- Same key: first - next -> last - prev -> first
|
||||
- All keys: first - next -> last - prev -> first
|
||||
- Test if: Read first - next - prev - prev - next == first
|
||||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Read first - delete - next -> last
|
||||
- Read last - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 1647
|
||||
Update records: 125
|
||||
Same-key-read: 8
|
||||
Delete records: 1647
|
||||
Record pointer size: 1
|
||||
Key cacheing used
|
||||
Locking used
|
||||
test2 -L -K -P -S -R3 -m50 -b1000000
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -92,9 +115,9 @@ test2 -L -K -P -S -R3 -m50 -b1000000
|
|||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
|
|
@ -118,16 +141,16 @@ test2 -L -B
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 912
|
||||
Update records: 81
|
||||
Write records: 903
|
||||
Update records: 86
|
||||
Same-key-read: 5
|
||||
Delete records: 912
|
||||
Delete records: 903
|
||||
Locking used
|
||||
blobs used
|
||||
test2 -L -K -W -P -m50 -l
|
||||
|
|
@ -141,9 +164,9 @@ test2 -L -K -W -P -m50 -l
|
|||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
|
|
@ -155,13 +178,13 @@ Key cacheing used
|
|||
Write cacheing used
|
||||
Locking used
|
||||
Commands Used count Errors Recover errors
|
||||
open 3 0 0
|
||||
write 150 0 0
|
||||
update 15 0 0
|
||||
delete 150 0 0
|
||||
close 3 0 0
|
||||
extra 18 0 0
|
||||
Total 339 0 0
|
||||
open 14 0 0
|
||||
write 700 0 0
|
||||
update 70 0 0
|
||||
delete 700 0 0
|
||||
close 14 0 0
|
||||
extra 84 0 0
|
||||
Total 1582 0 0
|
||||
test2 -L -K -W -P -m50 -l -b100
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -173,9 +196,9 @@ test2 -L -K -W -P -m50 -l -b100
|
|||
- Test if: Read last - prev - next - next - prev == last
|
||||
- Test read key-part
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
|
|
@ -187,13 +210,13 @@ Key cacheing used
|
|||
Write cacheing used
|
||||
Locking used
|
||||
Commands Used count Errors Recover errors
|
||||
open 4 0 0
|
||||
write 200 0 0
|
||||
update 20 0 0
|
||||
delete 200 0 0
|
||||
close 4 0 0
|
||||
extra 24 0 0
|
||||
Total 452 0 0
|
||||
open 15 0 0
|
||||
write 750 0 0
|
||||
update 75 0 0
|
||||
delete 750 0 0
|
||||
close 15 0 0
|
||||
extra 90 0 0
|
||||
Total 1695 0 0
|
||||
time test2
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -207,18 +230,16 @@ time test2
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
4.77user 6.81system 0:15.07elapsed 76%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
Delete records: 907
|
||||
time test2 -K
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -232,19 +253,17 @@ time test2 -K
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
6.09user 4.33system 0:11.66elapsed 89%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -258,19 +277,17 @@ time test2 -L
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Locking used
|
||||
5.01user 5.20system 0:10.86elapsed 94%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L -K
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -284,20 +301,18 @@ time test2 -L -K
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Locking used
|
||||
5.63user 0.97system 0:07.85elapsed 84%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L -K -W
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -311,21 +326,19 @@ time test2 -L -K -W
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Locking used
|
||||
5.28user 1.32system 0:08.86elapsed 74%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
time test2 -L -K -W -S
|
||||
- Creating isam-file
|
||||
- Writing key:s
|
||||
|
|
@ -339,18 +352,16 @@ time test2 -L -K -W -S
|
|||
- Read key (first) - next - delete - next -> last
|
||||
- Read last of key - prev - delete - prev -> first
|
||||
- Test if: Read rrnd - same
|
||||
- Test ni_records_in_range
|
||||
- ni_info
|
||||
- ni_extra(CACHE) + ni_rrnd.... + ni_extra(NO_CACHE)
|
||||
- Test nisam_records_in_range
|
||||
- nisam_info
|
||||
- nisam_extra(CACHE) + nisam_rrnd.... + nisam_extra(NO_CACHE)
|
||||
- Removing keys
|
||||
|
||||
Following test have been made:
|
||||
Write records: 915
|
||||
Update records: 82
|
||||
Write records: 907
|
||||
Update records: 87
|
||||
Same-key-read: 6
|
||||
Delete records: 915
|
||||
Delete records: 907
|
||||
Key cacheing used
|
||||
Write cacheing used
|
||||
Locking used
|
||||
5.32user 0.62system 0:06.13elapsed 96%CPU (0avgtext+0avgdata 0maxresident)k
|
||||
0inputs+0outputs (0major+0minor)pagefaults 0swaps
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue