diff options
Diffstat (limited to 'isam')
-rw-r--r-- | isam/Makefile.am | 2 | ||||
-rw-r--r-- | isam/_key.c | 23 | ||||
-rw-r--r-- | isam/_locking.c | 4 | ||||
-rw-r--r-- | isam/_page.c | 24 | ||||
-rw-r--r-- | isam/_search.c | 34 | ||||
-rw-r--r-- | isam/close.c | 3 | ||||
-rw-r--r-- | isam/extra.c | 2 | ||||
-rw-r--r-- | isam/isamchk.c | 21 | ||||
-rw-r--r-- | isam/isamdef.h | 2 | ||||
-rw-r--r-- | isam/isamlog.c | 14 | ||||
-rw-r--r-- | isam/open.c | 19 | ||||
-rw-r--r-- | isam/pack_isam.c | 27 | ||||
-rw-r--r-- | isam/panic.c | 2 | ||||
-rw-r--r-- | isam/static.c | 2 | ||||
-rw-r--r-- | isam/test2.c | 6 | ||||
-rw-r--r-- | isam/test3.c | 3 |
16 files changed, 102 insertions, 86 deletions
diff --git a/isam/Makefile.am b/isam/Makefile.am index 8f23138f29f..6d9e4176d43 100644 --- a/isam/Makefile.am +++ b/isam/Makefile.am @@ -14,7 +14,7 @@ # along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -INCLUDES = @MT_INCLUDES@ -I$(srcdir)/../include -I../include +INCLUDES = @MT_INCLUDES@ -I$(top_srcdir)/include LDADD = @CLIENT_EXTRA_LDFLAGS@ libnisam.a ../mysys/libmysys.a \ ../dbug/libdbug.a ../strings/libmystrings.a pkglib_LIBRARIES = libnisam.a diff --git a/isam/_key.c b/isam/_key.c index c0d667cb32d..65d6885869e 100644 --- a/isam/_key.c +++ b/isam/_key.c @@ -53,12 +53,11 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char * } *key++= (uchar) (length=(uint) (end-pos)); memcpy((byte*) key,(byte*) pos,(size_t) length); -#ifdef USE_STRCOLL - if (!use_strcoll(default_charset_info)) -#endif + if (!use_strnxfrm(default_charset_info)) { if (type == HA_KEYTYPE_TEXT) - case_sort((byte*) key,length); + my_strnxfrm(default_charset_info,(uchar*) key, length, + (uchar*) key, length); } key+=length; } @@ -66,12 +65,13 @@ uint _nisam_make_key(register N_INFO *info, uint keynr, uchar *key, const char * { memcpy((byte*) key,(byte*) record+keyseg->base.start, (size_t) keyseg->base.length); -#ifdef USE_STRCOLL - if (!use_strcoll(default_charset_info)) -#endif + if (!use_strnxfrm(default_charset_info)) { if (type == HA_KEYTYPE_TEXT) - case_sort((byte*) key,(uint) keyseg->base.length); + my_strnxfrm(default_charset_info,(uchar*) key, + (uint) keyseg->base.length, + (uchar*) key, + (uint) keyseg->base.length); } #ifdef NAN_TEST else if (type == HA_KEYTYPE_FLOAT) @@ -149,12 +149,11 @@ uint _nisam_pack_key(register N_INFO *info, uint keynr, uchar *key, uchar *old, } else memcpy((byte*) key,old,(size_t) length); -#ifdef USE_STRCOLL - if (!use_strcoll(default_charset_info)) -#endif + if (!use_strnxfrm(default_charset_info)) { if (type == HA_KEYTYPE_TEXT) - case_sort((byte*) key,length); + my_strnxfrm(default_charset_info,(uchar*) key,length, + (uchar*) key,length); } key+= length; } diff --git a/isam/_locking.c b/isam/_locking.c index be9741a4237..e19804549e5 100644 --- a/isam/_locking.c +++ b/isam/_locking.c @@ -50,7 +50,7 @@ int nisam_lock_database(N_INFO *info, int lock_type) else count= --share->w_locks; if (info->lock_type == F_WRLCK && !share->w_locks && - flush_key_blocks(share->kfile,FLUSH_KEEP)) + flush_key_blocks(dflt_key_cache,share->kfile,FLUSH_KEEP)) error=my_errno; if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) if (end_io_cache(&info->rec_cache)) @@ -329,7 +329,7 @@ int _nisam_test_if_changed(register N_INFO *info) share->state.uniq != info->last_uniq) { /* Keyfile has changed */ if (share->state.process != share->this_process) - VOID(flush_key_blocks(share->kfile,FLUSH_RELEASE)); + VOID(flush_key_blocks(dflt_key_cache,share->kfile,FLUSH_RELEASE)); share->last_process=share->state.process; info->last_loop= share->state.loop; info->last_uniq= share->state.uniq; diff --git a/isam/_page.c b/isam/_page.c index 65733d66b77..e31115e624f 100644 --- a/isam/_page.c +++ b/isam/_page.c @@ -27,10 +27,11 @@ uchar *_nisam_fetch_keypage(register N_INFO *info, N_KEYDEF *keyinfo, my_off_t page, uchar *buff, int return_buffer) { uchar *tmp; - tmp=(uchar*) key_cache_read(info->s->kfile,page,(byte*) buff, - (uint) keyinfo->base.block_length, - (uint) keyinfo->base.block_length, - return_buffer); + tmp=(uchar*) key_cache_read(dflt_key_cache, + info->s->kfile,page,DFLT_INIT_HITS,(byte*) buff, + (uint) keyinfo->base.block_length, + (uint) keyinfo->base.block_length, + return_buffer); if (tmp == info->buff) { info->update|=HA_STATE_BUFF_SAVED; @@ -83,9 +84,11 @@ int _nisam_write_keypage(register N_INFO *info, register N_KEYDEF *keyinfo, length=keyinfo->base.block_length; } #endif - return (key_cache_write(info->s->kfile,page,(byte*) buff,length, - (uint) keyinfo->base.block_length, - (int) (info->lock_type != F_UNLCK))); + return (key_cache_write(dflt_key_cache, + info->s->kfile,page,DFLT_INIT_HITS, + (byte*) buff,length, + (uint) keyinfo->base.block_length, + (int) (info->lock_type != F_UNLCK))); } /* nisam_write_keypage */ @@ -99,7 +102,9 @@ int _nisam_dispose(register N_INFO *info, N_KEYDEF *keyinfo, my_off_t pos) old_link=info->s->state.key_del[keynr]; info->s->state.key_del[keynr]=(ulong) pos; - DBUG_RETURN(key_cache_write(info->s->kfile,pos,(byte*) &old_link, + DBUG_RETURN(key_cache_write(dflt_key_cache, + info->s->kfile,pos,DFLT_INIT_HITS, + (byte*) &old_link, sizeof(long), (uint) keyinfo->base.block_length, (int) (info->lock_type != F_UNLCK))); @@ -126,7 +131,8 @@ ulong _nisam_new(register N_INFO *info, N_KEYDEF *keyinfo) } else { - if (!key_cache_read(info->s->kfile,pos, + if (!key_cache_read(dflt_key_cache, + info->s->kfile,pos,DFLT_INIT_HITS, (byte*) &info->s->state.key_del[keynr], (uint) sizeof(long), (uint) keyinfo->base.block_length,0)) diff --git a/isam/_search.c b/isam/_search.c index 32492f83929..fbffd6786e1 100644 --- a/isam/_search.c +++ b/isam/_search.c @@ -118,7 +118,7 @@ int _nisam_search(register N_INFO *info, register N_KEYDEF *keyinfo, uchar *key, if ((nextflag & (SEARCH_SMALLER | SEARCH_LAST)) && flag != 0) { keypos=_nisam_get_last_key(info,keyinfo,buff,lastkey,keypos); - if ((nextflag & SEARCH_LAST) && + if (!(nextflag & SEARCH_SMALLER) && _nisam_key_cmp(keyinfo->seg, lastkey, key, key_len, SEARCH_FIND)) { my_errno=HA_ERR_KEY_NOT_FOUND; /* Didn't find key */ @@ -331,8 +331,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar (int) *as : b_length; end= a+ min(key_length,(uint) length); -#ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) { + if (use_strnxfrm(default_charset_info)) { if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY) { while (a < end) @@ -349,7 +348,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar } } else -#endif { while (a < end) if ((flag= (int) *a++ - (int) *b++)) @@ -382,8 +380,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar } else { -#ifdef USE_STRCOLL - if (use_strcoll(default_charset_info)) { + if (use_strnxfrm(default_charset_info)) { if (((enum ha_base_keytype) keyseg->base.type) == HA_KEYTYPE_BINARY) { while (a < end) @@ -400,7 +397,6 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar } } else -#endif { while (a < end) if ((flag= (int) *a++ - (int) *b++)) @@ -493,7 +489,7 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar int alength,blength; if (swap_flag) - swap(uchar*,a,b); + swap_variables(uchar*, a, b); alength= *a++; blength= *b++; if ((flag=(int) (keyseg->base.length-key_length)) < 0) flag=0; @@ -508,18 +504,20 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar if (*a == '-' && *b == '-') { swap_flag=1; - swap(uchar*,a,b); + swap_variables(uchar*, a, b); } end=a+alength; while (a < end) if (*a++ != *b++) { a--; b--; - if (isdigit((char) *a) && isdigit((char) *b)) + if (my_isdigit(default_charset_info, (char) *a) && + my_isdigit(default_charset_info, (char) *b)) return ((int) *a - (int) *b); - if (*a == '-' || isdigit((char) *b)) + if (*a == '-' || my_isdigit(default_charset_info,(char) *b)) return (-1); - if (*b == '-' || *b++ == ' ' || isdigit((char) *a)) + if (*b == '-' || *b++ == ' ' || + my_isdigit(default_charset_info,(char) *a)) return (1); if (*a++ == ' ') return (-1); @@ -533,24 +531,26 @@ int _nisam_key_cmp(register N_KEYSEG *keyseg, register uchar *a, register uchar if (swap_flag) { end=b+(int) (end-a); - swap(uchar*,a,b); + swap_variables(uchar*, a, b); } while (a < end) if (*a++ != *b++) { a--; b--; - if (isdigit((char) *a) && isdigit((char) *b)) + if (my_isdigit(default_charset_info,(char) *a) && + my_isdigit(default_charset_info,(char) *b)) return ((int) *a - (int) *b); - if (*a == '-' || isdigit((char) *b)) + if (*a == '-' || my_isdigit(default_charset_info,(char) *b)) return (-1); - if (*b == '-' || *b++ == ' ' || isdigit((char) *a)) + if (*b == '-' || *b++ == ' ' || + my_isdigit(default_charset_info,(char) *a)) return (1); if (*a++ == ' ') return -1; } } if (swap_flag) - swap(uchar*,a,b); + swap_variables(uchar*, a, b); break; } #ifdef HAVE_LONG_LONG diff --git a/isam/close.c b/isam/close.c index f1465990100..37425653a5d 100644 --- a/isam/close.c +++ b/isam/close.c @@ -56,7 +56,8 @@ int nisam_close(register N_INFO *info) if (flag) { - if (share->kfile >= 0 && flush_key_blocks(share->kfile,FLUSH_RELEASE)) + if (share->kfile >= 0 && + flush_key_blocks(dflt_key_cache,share->kfile,FLUSH_RELEASE)) error=my_errno; if (share->kfile >= 0 && my_close(share->kfile,MYF(0))) error = my_errno; diff --git a/isam/extra.c b/isam/extra.c index 3bf1dd012ed..421404311c8 100644 --- a/isam/extra.c +++ b/isam/extra.c @@ -215,7 +215,7 @@ int nisam_extra(N_INFO *info, enum ha_extra_function function) info->s->last_version= 0L; /* Impossible version */ #ifdef __WIN__ /* Close the isam and data files as Win32 can't drop an open table */ - if (flush_key_blocks(info->s->kfile,FLUSH_RELEASE)) + if (flush_key_blocks(dflt_key_cache, info->s->kfile, FLUSH_RELEASE)) error=my_errno; if (info->opt_flag & (READ_CACHE_USED | WRITE_CACHE_USED)) { diff --git a/isam/isamchk.c b/isam/isamchk.c index daa9464eb4f..513c1ea3a5d 100644 --- a/isam/isamchk.c +++ b/isam/isamchk.c @@ -286,8 +286,8 @@ static struct my_option my_long_options[] = "Change the value of a variable. Please note that this option is deprecated; you can set variables directly with --variable-name=value.", 0, 0, 0, GET_STR, REQUIRED_ARG, 0, 0, 0, 0, 0, 0}, {"block-search", 'b', "For debugging.", (gptr*) &search_after_block, - (gptr*) &search_after_block, 0, GET_ULONG, REQUIRED_ARG, NI_POS_ERROR, 0, - 0, 0, 0, 0}, + (gptr*) &search_after_block, 0, GET_ULONG, REQUIRED_ARG, + (longlong) NI_POS_ERROR, 0, 0, 0, 0, 0}, {"silent", 's', "Only print errors. One can use two -s to make isamchk very silent.", 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}, @@ -522,7 +522,8 @@ static int nisamchk(my_string filename) if (!rep_quick) { if (testflag & T_EXTEND) - VOID(init_key_cache(use_buffers)); + VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE, + use_buffers,0,0)); VOID(init_io_cache(&read_cache,datafile,(uint) read_buffer_length, READ_CACHE,share->pack.header_length,1, MYF(MY_WME))); @@ -687,7 +688,7 @@ static void get_options(register int *argc, register char ***argv) } if (default_charset) { - if (set_default_charset_by_name(default_charset, MYF(MY_WME))) + if (!(default_charset_info= get_charset_by_name(default_charset, MYF(MY_WME)))) exit(1); } return; @@ -1334,7 +1335,7 @@ int extend; print_error("Found wrong record at %lu",(ulong) start_recpos); got_error=1; } - crc^=checksum(record,info->s->base.reclength); + crc^=_nisam_checksum(record,info->s->base.reclength); link_used+=info->s->pack.ref_length; used+=block_info.rec_len+info->s->pack.ref_length; } @@ -1465,7 +1466,7 @@ my_string name; printf("Data records: %lu\n",(ulong) share->state.records); } - VOID(init_key_cache(use_buffers)); + VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,use_buffers,0,0)); if (init_io_cache(&read_cache,info->dfile,(uint) read_buffer_length, READ_CACHE,share->pack.header_length,1,MYF(MY_WME))) goto err; @@ -1893,12 +1894,12 @@ static void lock_memory(void) static int flush_blocks(file) File file; { - if (flush_key_blocks(file,FLUSH_RELEASE)) + if (flush_key_blocks(dflt_key_cache,file,FLUSH_RELEASE)) { print_error("%d when trying to write bufferts",my_errno); return(1); } - end_key_cache(); + end_key_cache(dflt_key_cache,1); return 0; } /* flush_blocks */ @@ -1942,7 +1943,7 @@ int write_info; if (share->state.key_root[sort_key] == NI_POS_ERROR) DBUG_RETURN(0); /* Nothing to do */ - init_key_cache(use_buffers); + init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,use_buffers, 0, 0); if (init_io_cache(&info->rec_cache,-1,(uint) write_buffer_length, WRITE_CACHE,share->pack.header_length,1, MYF(MY_WME | MY_WAIT_IF_FULL))) @@ -3418,6 +3419,6 @@ static int update_state_info( N_INFO *info, uint update) return 0; } err: - print_error("%d when updateing keyfile",my_errno); + print_error("%d when updating keyfile",my_errno); return 1; } diff --git a/isam/isamdef.h b/isam/isamdef.h index 0884b18e997..7d89730fe32 100644 --- a/isam/isamdef.h +++ b/isam/isamdef.h @@ -24,6 +24,7 @@ #else #include <my_no_pthread.h> #endif +#include <keycache.h> #ifdef my_write #undef my_write /* We want test if disk full */ @@ -358,6 +359,7 @@ extern int _nisam_read_pack_record(N_INFO *info,ulong filepos,byte *buf); extern int _nisam_read_rnd_pack_record(N_INFO*, byte *,ulong, int); extern int _nisam_pack_rec_unpack(N_INFO *info,byte *to,byte *from, uint reclength); +extern ulong _nisam_checksum(const byte *mem, uint count); typedef struct st_sortinfo { uint key_length; diff --git a/isam/isamlog.c b/isam/isamlog.c index 0367c03e08a..75a35ef9704 100644 --- a/isam/isamlog.c +++ b/isam/isamlog.c @@ -329,8 +329,8 @@ static int examine_log(my_string file_name, char **table_names) bzero((gptr) com_count,sizeof(com_count)); init_tree(&tree,0,0,sizeof(file_info),(qsort_cmp2) file_info_compare,1, (tree_element_free) file_info_free, NULL); - VOID(init_key_cache(KEY_CACHE_SIZE)); - + VOID(init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE, + 0,0)); files_open=0; access_time=0; while (access_time++ != number_of_commands && !my_b_read(&cache,(byte*) head,9)) @@ -342,7 +342,7 @@ static int examine_log(my_string file_name, char **table_names) file_info.process=0; result=uint2korr(head+7); if ((curr_file_info=(struct isamlog_file_info*) - tree_search(&tree,&file_info))) + tree_search(&tree, &file_info, tree.custom_arg))) { curr_file_info->accessed=access_time; if (update && curr_file_info->used && curr_file_info->closed) @@ -444,7 +444,7 @@ static int examine_log(my_string file_name, char **table_names) files_open++; file_info.closed=0; } - VOID(tree_insert(&tree,(gptr) &file_info,0)); + VOID(tree_insert(&tree, (gptr) &file_info, 0, tree.custom_arg)); if (file_info.used) { if (verbose && !record_pos_file) @@ -463,7 +463,7 @@ static int examine_log(my_string file_name, char **table_names) { if (!curr_file_info->closed) files_open--; - VOID(tree_delete(&tree,(gptr) curr_file_info)); + VOID(tree_delete(&tree, (gptr) curr_file_info, tree.custom_arg)); } break; case LOG_EXTRA: @@ -622,7 +622,7 @@ static int examine_log(my_string file_name, char **table_names) goto end; } } - end_key_cache(); + end_key_cache(dflt_key_cache,1); delete_tree(&tree); VOID(end_io_cache(&cache)); VOID(my_close(file,MYF(0))); @@ -642,7 +642,7 @@ static int examine_log(my_string file_name, char **table_names) llstr(isamlog_filepos,llbuff))); fflush(stderr); end: - end_key_cache(); + end_key_cache(dflt_key_cache,1); delete_tree(&tree); VOID(end_io_cache(&cache)); VOID(my_close(file,MYF(0))); diff --git a/isam/open.c b/isam/open.c index 9dc27981507..be62fd86192 100644 --- a/isam/open.c +++ b/isam/open.c @@ -456,3 +456,22 @@ static void setup_key_functions(register N_KEYDEF *keyinfo) } return; } + +/* + Calculate a long checksum for a memoryblock. Used to verify pack_isam + + SYNOPSIS + checksum() + mem Pointer to memory block + count Count of bytes +*/ + +ulong _nisam_checksum(const byte *mem, uint count) +{ + ulong crc; + for (crc= 0; count-- ; mem++) + crc= ((crc << 1) + *((uchar*) mem)) + + test(crc & ((ulong) 1L << (8*sizeof(ulong)-1))); + return crc; +} + diff --git a/isam/pack_isam.c b/isam/pack_isam.c index b2e21afc743..9108070f918 100644 --- a/isam/pack_isam.c +++ b/isam/pack_isam.c @@ -46,22 +46,6 @@ #define OLD_EXT ".OLD" #define WRITE_COUNT MY_HOW_OFTEN_TO_WRITE -#ifdef __WIN__ -static double ulonglong2double(ulonglong value) -{ - longlong nr=(longlong) value; - if (nr >= 0) - return (double) nr; - return (18446744073709551616.0 + (double) nr); -} - -#if SIZEOF_OFF_T > 4 -#define my_off_t2double(A) ulonglong2double(A) -#else -#define my_off_t2double(A) ((double) (A)) -#endif /* SIZEOF_OFF_T > 4 */ -#endif - struct st_file_buffer { File file; char *buffer,*pos,*end; @@ -687,7 +671,8 @@ static HUFF_COUNTS *init_huff_count(N_INFO *info,my_off_t records) (type == FIELD_NORMAL || type == FIELD_SKIP_ZERO)) count[i].max_zero_fill= count[i].field_length; - init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree,0,NULL,NULL); + init_tree(&count[i].int_tree,0,0,-1,(qsort_cmp2) compare_tree,0, + NULL, NULL); if (records) count[i].tree_pos=count[i].tree_buff = my_malloc(count[i].field_length > 1 ? tree_buff_length : 2, @@ -753,7 +738,7 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) { if (! error) { - crc^=checksum(record,reclength); + crc^=_nisam_checksum(record,reclength); for (pos=record,count=huff_counts ; count < end_count ; count++, @@ -765,7 +750,8 @@ static int get_statistic(MRG_INFO *mrg,HUFF_COUNTS *huff_counts) if (count->tree_buff) { global_count=count; - if (!(element=tree_insert(&count->int_tree,pos,0)) || + if (!(element=tree_insert(&count->int_tree, pos, 0, + count->int_tree.custom_arg)) || ((element->count == 1 && count->tree_buff + tree_buff_length < count->tree_pos + count->field_length) || @@ -1736,7 +1722,8 @@ static int compress_isam_file(MRG_INFO *mrg, HUFF_COUNTS *huff_counts) break; case FIELD_INTERVALL: global_count=count; - pos=(byte*) tree_search(&count->int_tree,start_pos); + pos=(byte*) tree_search(&count->int_tree, start_pos, + count->int_tree.custom_arg); intervall=(uint) (pos - count->tree_buff)/field_length; write_bits(tree->code[intervall],(uint) tree->code_len[intervall]); start_pos=end_pos; diff --git a/isam/panic.c b/isam/panic.c index e51e83671df..7af979a5104 100644 --- a/isam/panic.c +++ b/isam/panic.c @@ -48,7 +48,7 @@ int nisam_panic(enum ha_panic_function flag) if (info->s->base.options & HA_OPTION_READ_ONLY_DATA) break; #endif - if (flush_key_blocks(info->s->kfile,FLUSH_RELEASE)) + if (flush_key_blocks(dflt_key_cache,info->s->kfile,FLUSH_RELEASE)) error=my_errno; if (info->opt_flag & WRITE_CACHE_USED) if (flush_io_cache(&info->rec_cache)) diff --git a/isam/static.c b/isam/static.c index 9c68a0cfdba..0a8dc809ad7 100644 --- a/isam/static.c +++ b/isam/static.c @@ -41,5 +41,5 @@ uint NEAR nisam_read_vec[]= { SEARCH_FIND, SEARCH_FIND | SEARCH_BIGGER, SEARCH_FIND | SEARCH_SMALLER, SEARCH_NO_FIND | SEARCH_BIGGER, SEARCH_NO_FIND | SEARCH_SMALLER, - SEARCH_FIND, SEARCH_LAST + SEARCH_FIND, SEARCH_LAST,SEARCH_LAST | SEARCH_SMALLER }; diff --git a/isam/test2.c b/isam/test2.c index 5b09cc8b716..4b22f2d679c 100644 --- a/isam/test2.c +++ b/isam/test2.c @@ -156,7 +156,7 @@ int main(int argc, char *argv[]) goto err; printf("- Writing key:s\n"); if (key_cacheing) - init_key_cache(IO_SIZE*16); /* Use a small cache */ + init_key_cache(dflt_key_cache,512,IO_SIZE*16,0,0); /* Use a small cache */ if (locking) nisam_lock_database(file,F_WRLCK); if (write_cacheing) @@ -526,7 +526,7 @@ int main(int argc, char *argv[]) if (j != 0 && k != 0) { if (j > k) - swap(int,j,k); + swap_variables(int, j, k); sprintf(key,"%6d",j); sprintf(key2,"%6d",k); range_records=nisam_records_in_range(file,0,key,0,HA_READ_AFTER_KEY, @@ -674,7 +674,7 @@ end: puts("Locking used"); if (use_blob) puts("blobs used"); - end_key_cache(); + end_key_cache(dflt_key_cache,1); if (blob_buffer) my_free(blob_buffer,MYF(0)); my_end(MY_CHECK_ERROR | MY_GIVE_INFO); diff --git a/isam/test3.c b/isam/test3.c index 228030f5832..9195fcbf1b6 100644 --- a/isam/test3.c +++ b/isam/test3.c @@ -20,6 +20,7 @@ #include "nisam.h" #include <sys/types.h> +#include <keycache.h> #ifdef HAVE_SYS_WAIT_H # include <sys/wait.h> #endif @@ -173,7 +174,7 @@ void start_test(int id) exit(1); } if (key_cacheing && rnd(2) == 0) - init_key_cache(65536L); + init_key_cache(dflt_key_cache,512,65536L,0,0); printf("Process %d, pid: %d\n",id,(int) getpid()); fflush(stdout); for (error=i=0 ; i < tests && !error; i++) |