summaryrefslogtreecommitdiff
path: root/myisam
diff options
context:
space:
mode:
Diffstat (limited to 'myisam')
-rw-r--r--myisam/ft_boolean_search.c3
-rw-r--r--myisam/ft_dump.c10
-rw-r--r--myisam/ft_update.c6
-rw-r--r--myisam/mi_check.c33
-rw-r--r--myisam/mi_close.c2
-rw-r--r--myisam/mi_delete_all.c2
-rw-r--r--myisam/mi_extra.c4
-rw-r--r--myisam/mi_keycache.c20
-rw-r--r--myisam/mi_locking.c4
-rw-r--r--myisam/mi_page.c8
-rw-r--r--myisam/mi_panic.c2
-rw-r--r--myisam/mi_preload.c6
-rw-r--r--myisam/mi_test1.c2
-rw-r--r--myisam/mi_test2.c6
-rw-r--r--myisam/mi_test3.c2
-rw-r--r--myisam/myisamchk.c14
-rw-r--r--myisam/myisamdef.h4
-rw-r--r--myisam/myisamlog.c13
-rw-r--r--myisam/sort.c22
-rw-r--r--myisam/sp_test.c7
20 files changed, 87 insertions, 83 deletions
diff --git a/myisam/ft_boolean_search.c b/myisam/ft_boolean_search.c
index f3b593f7341..e44516c16d6 100644
--- a/myisam/ft_boolean_search.c
+++ b/myisam/ft_boolean_search.c
@@ -251,7 +251,8 @@ static int _ft2_search(FTB *ftb, FTB_WORD *ftbw, my_bool init_search)
}
/* going up to the first-level tree to continue search there */
- _mi_dpointer(info, ftbw->word+ftbw->off+HA_FT_WLEN, ftbw->key_root);
+ _mi_dpointer(info, (uchar*) (ftbw->word+ftbw->off+HA_FT_WLEN),
+ ftbw->key_root);
ftbw->key_root=info->s->state.key_root[ftb->keynr];
ftbw->keyinfo=info->s->keyinfo+ftb->keynr;
ftbw->off=0;
diff --git a/myisam/ft_dump.c b/myisam/ft_dump.c
index 5591a6ddb3e..8c40878cf00 100644
--- a/myisam/ft_dump.c
+++ b/myisam/ft_dump.c
@@ -80,7 +80,7 @@ int main(int argc,char *argv[])
if (argc < 2)
usage();
- init_key_cache(dflt_keycache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT,0);
+ init_key_cache(dflt_key_cache,MI_KEY_BLOCK_LENGTH,USE_BUFFER_INIT, 0, 0);
if (!(info=mi_open(argv[0],2,HA_OPEN_ABORT_IF_LOCKED)))
goto err;
@@ -172,9 +172,9 @@ int main(int argc,char *argv[])
if (dump)
{
if (subkeys>=0)
- printf("%9qx %20.7f %s\n",info->lastpos,weight,buf);
+ printf("%9lx %20.7f %s\n", (long) info->lastpos,weight,buf);
else
- printf("%9qx => %17d %s\n",info->lastpos,-subkeys,buf);
+ printf("%9lx => %17d %s\n",(long) info->lastpos,-subkeys,buf);
}
if (verbose && (total%HOW_OFTEN_TO_WRITE)==0)
printf("%10ld\r",total);
@@ -189,12 +189,12 @@ int main(int argc,char *argv[])
if ((ulong) count >= total/2)
break;
}
- printf("Total rows: %qu\nTotal words: %lu\n"
+ printf("Total rows: %lu\nTotal words: %lu\n"
"Unique words: %lu\nLongest word: %lu chars (%s)\n"
"Median length: %u\n"
"Average global weight: %f\n"
"Most common word: %lu times, weight: %f (%s)\n",
- (ulonglong)info->state->records, total, uniq, maxlen, buf_maxlen,
+ (long) info->state->records, total, uniq, maxlen, buf_maxlen,
inx, avg_gws/uniq, max_doc_cnt, min_gws, buf_min_gws);
}
if (lstats)
diff --git a/myisam/ft_update.c b/myisam/ft_update.c
index a87f239b8f8..b94a174b292 100644
--- a/myisam/ft_update.c
+++ b/myisam/ft_update.c
@@ -304,7 +304,7 @@ uint _mi_ft_convert_to_ft2(MI_INFO *info, uint keynr, uchar *key)
my_off_t root;
DYNAMIC_ARRAY *da=info->ft1_to_ft2;
MI_KEYDEF *keyinfo=&info->s->ft2_keyinfo;
- uchar *key_ptr=dynamic_array_ptr(da, 0), *end;
+ uchar *key_ptr= (uchar*) dynamic_array_ptr(da, 0), *end;
uint length, key_length;
DBUG_ENTER("_mi_ft_convert_to_ft2");
@@ -329,13 +329,13 @@ uint _mi_ft_convert_to_ft2(MI_INFO *info, uint keynr, uchar *key)
DBUG_RETURN(-1);
/* inserting the rest of key values */
- end=dynamic_array_ptr(da, da->elements);
+ end= (uchar*) dynamic_array_ptr(da, da->elements);
for (key_ptr+=length; key_ptr < end; key_ptr+=keyinfo->keylength)
if(_mi_ck_real_write_btree(info, keyinfo, key_ptr, 0, &root, SEARCH_SAME))
DBUG_RETURN(-1);
/* now, writing the word key entry */
- ft_intXstore(key+key_length, -da->elements);
+ ft_intXstore(key+key_length, - (int) da->elements);
_mi_dpointer(info, key+key_length+HA_FT_WLEN, root);
DBUG_RETURN(_mi_ck_real_write_btree(info,
diff --git a/myisam/mi_check.c b/myisam/mi_check.c
index cfdb696b60b..448e847f6e1 100644
--- a/myisam/mi_check.c
+++ b/myisam/mi_check.c
@@ -242,7 +242,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr)
if (next_link > info->state->key_file_length ||
next_link & (info->s->blocksize-1))
DBUG_RETURN(1);
- if (!(buff=key_cache_read(*info->s->key_cache,
+ if (!(buff=key_cache_read(info->s->key_cache,
info->s->kfile, next_link, DFLT_INIT_HITS,
(byte*) info->buff,
myisam_block_size, block_size, 1)))
@@ -262,7 +262,7 @@ static int check_k_link(MI_CHECK *param, register MI_INFO *info, uint nr)
} /* check_k_link */
- /* Kontrollerar storleken p} filerna */
+ /* Check sizes of files */
int chk_size(MI_CHECK *param, register MI_INFO *info)
{
@@ -273,8 +273,9 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
if (!(param->testflag & T_SILENT)) puts("- check file-size");
- flush_key_blocks(*info->s->key_cache,
- info->s->kfile, FLUSH_FORCE_WRITE); /* If called externally */
+ /* The following is needed if called externally (not from myisamchk) */
+ flush_key_blocks(info->s->key_cache,
+ info->s->kfile, FLUSH_FORCE_WRITE);
size=my_seek(info->s->kfile,0L,MY_SEEK_END,MYF(0));
if ((skr=(my_off_t) info->state->key_file_length) != size)
@@ -502,7 +503,7 @@ int chk_key(MI_CHECK *param, register MI_INFO *info)
param->record_checksum=old_record_checksum-init_checksum; /* Remove delete links */
else
param->record_checksum=0;
- DBUG_RETURN(0);
+ DBUG_RETURN(result);
} /* chk_key */
@@ -1143,8 +1144,8 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
param->testflag|=T_REP; /* for easy checking */
if (!param->using_global_keycache)
- VOID(init_key_cache(dflt_keycache, param->key_cache_block_size,
- param->use_buffers, &dflt_key_cache_var));
+ VOID(init_key_cache(dflt_key_cache, param->key_cache_block_size,
+ param->use_buffers, 0, 0));
if (init_io_cache(&param->read_cache,info->dfile,
(uint) param->read_buffer_length,
@@ -1365,7 +1366,7 @@ err:
VOID(end_io_cache(&param->read_cache));
info->opt_flag&= ~(READ_CACHE_USED | WRITE_CACHE_USED);
VOID(end_io_cache(&info->rec_cache));
- got_error|=flush_blocks(param, *share->key_cache, share->kfile);
+ got_error|=flush_blocks(param, share->key_cache, share->kfile);
if (!got_error && param->testflag & T_UNPACK)
{
share->state.header.options[0]&= (uchar) ~HA_OPTION_COMPRESS_RECORD;
@@ -1501,7 +1502,7 @@ void lock_memory(MI_CHECK *param __attribute__((unused)))
/* Flush all changed blocks to disk */
-int flush_blocks(MI_CHECK *param, KEY_CACHE_HANDLE key_cache, File file)
+int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file)
{
if (flush_key_blocks(key_cache, file, FLUSH_RELEASE))
{
@@ -1564,7 +1565,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, my_string name)
}
/* Flush key cache for this file if we are calling this outside myisamchk */
- flush_key_blocks(*share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED);
+ flush_key_blocks(share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED);
share->state.version=(ulong) time((time_t*) 0);
old_state= share->state; /* save state if not stored */
@@ -1874,7 +1875,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
Flush key cache for this file if we are calling this outside
myisamchk
*/
- flush_key_blocks(*share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED);
+ flush_key_blocks(share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED);
/* Clear the pointers to the given rows */
for (i=0 ; i < share->base.keys ; i++)
share->state.key_root[i]= HA_OFFSET_ERROR;
@@ -1884,7 +1885,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
}
else
{
- if (flush_key_blocks(*share->key_cache,share->kfile, FLUSH_FORCE_WRITE))
+ if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_FORCE_WRITE))
goto err;
key_map= ~key_map; /* Create the missing keys */
}
@@ -2076,7 +2077,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
memcpy( &share->state.state, info->state, sizeof(*info->state));
err:
- got_error|= flush_blocks(param, *share->key_cache, share->kfile);
+ got_error|= flush_blocks(param, share->key_cache, share->kfile);
VOID(end_io_cache(&info->rec_cache));
if (!got_error)
{
@@ -2237,7 +2238,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
Flush key cache for this file if we are calling this outside
myisamchk
*/
- flush_key_blocks(*share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED);
+ flush_key_blocks(share->key_cache,share->kfile, FLUSH_IGNORE_CHANGED);
/* Clear the pointers to the given rows */
for (i=0 ; i < share->base.keys ; i++)
share->state.key_root[i]= HA_OFFSET_ERROR;
@@ -2247,7 +2248,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
}
else
{
- if (flush_key_blocks(*share->key_cache,share->kfile, FLUSH_FORCE_WRITE))
+ if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_FORCE_WRITE))
goto err;
key_map= ~key_map; /* Create the missing keys */
}
@@ -2483,7 +2484,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
memcpy(&share->state.state, info->state, sizeof(*info->state));
err:
- got_error|= flush_blocks(param, *share->key_cache, share->kfile);
+ got_error|= flush_blocks(param, share->key_cache, share->kfile);
VOID(end_io_cache(&info->rec_cache));
if (!got_error)
{
diff --git a/myisam/mi_close.c b/myisam/mi_close.c
index 66d5b08bbc4..deb0ccee8f3 100644
--- a/myisam/mi_close.c
+++ b/myisam/mi_close.c
@@ -64,7 +64,7 @@ int mi_close(register MI_INFO *info)
if (flag)
{
if (share->kfile >= 0 &&
- flush_key_blocks(*share->key_cache, share->kfile,
+ flush_key_blocks(share->key_cache, share->kfile,
share->temporary ? FLUSH_IGNORE_CHANGED :
FLUSH_RELEASE))
error=my_errno;
diff --git a/myisam/mi_delete_all.c b/myisam/mi_delete_all.c
index 357df9ebe3e..3033249886f 100644
--- a/myisam/mi_delete_all.c
+++ b/myisam/mi_delete_all.c
@@ -53,7 +53,7 @@ int mi_delete_all_rows(MI_INFO *info)
If we are using delayed keys or if the user has done changes to the tables
since it was locked then there may be key blocks in the key cache
*/
- flush_key_blocks(*share->key_cache, share->kfile, FLUSH_IGNORE_CHANGED);
+ flush_key_blocks(share->key_cache, share->kfile, FLUSH_IGNORE_CHANGED);
if (my_chsize(info->dfile, 0, 0, MYF(MY_WME)) ||
my_chsize(share->kfile, share->base.keystart, 0, MYF(MY_WME)) )
goto err;
diff --git a/myisam/mi_extra.c b/myisam/mi_extra.c
index 327d795d17b..fcc753b62e5 100644
--- a/myisam/mi_extra.c
+++ b/myisam/mi_extra.c
@@ -283,7 +283,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
#ifdef __WIN__
/* Close the isam and data files as Win32 can't drop an open table */
pthread_mutex_lock(&share->intern_lock);
- if (flush_key_blocks(*share->keycache, share->kfile,
+ if (flush_key_blocks(share->key_cache, share->kfile,
(function == HA_EXTRA_FORCE_REOPEN ?
FLUSH_RELEASE : FLUSH_IGNORE_CHANGED)))
{
@@ -329,7 +329,7 @@ int mi_extra(MI_INFO *info, enum ha_extra_function function, void *extra_arg)
break;
case HA_EXTRA_FLUSH:
if (!share->temporary)
- flush_key_blocks(*share->key_cache, share->kfile, FLUSH_KEEP);
+ flush_key_blocks(share->key_cache, share->kfile, FLUSH_KEEP);
#ifdef HAVE_PWRITE
_mi_decrement_open_count(info);
#endif
diff --git a/myisam/mi_keycache.c b/myisam/mi_keycache.c
index c6fd1801740..2c808c68c98 100644
--- a/myisam/mi_keycache.c
+++ b/myisam/mi_keycache.c
@@ -49,19 +49,19 @@
int mi_assign_to_key_cache(MI_INFO *info,
ulonglong key_map __attribute__((unused)),
- KEY_CACHE_VAR *key_cache)
+ KEY_CACHE *key_cache)
{
int error= 0;
MYISAM_SHARE* share= info->s;
DBUG_ENTER("mi_assign_to_key_cache");
DBUG_PRINT("enter",("old_key_cache_handle: %lx new_key_cache_handle: %lx",
- share->key_cache, &key_cache->cache));
+ share->key_cache, key_cache));
/*
Skip operation if we didn't change key cache. This can happen if we
call this for all open instances of the same table
*/
- if (*share->key_cache == key_cache->cache)
+ if (share->key_cache == key_cache)
DBUG_RETURN(0);
/*
@@ -76,7 +76,7 @@ int mi_assign_to_key_cache(MI_INFO *info,
in the old key cache.
*/
- if (flush_key_blocks(*share->key_cache, share->kfile, FLUSH_REMOVE))
+ if (flush_key_blocks(share->key_cache, share->kfile, FLUSH_REMOVE))
{
error= my_errno;
mi_mark_crashed(info); /* Mark that table must be checked */
@@ -90,13 +90,13 @@ int mi_assign_to_key_cache(MI_INFO *info,
(This can never fail as there is never any not written data in the
new key cache)
*/
- (void) flush_key_blocks(key_cache->cache, share->kfile, FLUSH_REMOVE);
+ (void) flush_key_blocks(key_cache, share->kfile, FLUSH_REMOVE);
/*
Tell all threads to use the new key cache
This should be seen at the lastes for the next call to an myisam function.
*/
- share->key_cache= &key_cache->cache;
+ share->key_cache= key_cache;
/* store the key cache in the global hash structure for future opens */
if (multi_key_cache_set(share->unique_file_name, share->unique_name_length,
@@ -127,8 +127,8 @@ int mi_assign_to_key_cache(MI_INFO *info,
*/
-void mi_change_key_cache(KEY_CACHE_VAR *old_key_cache,
- KEY_CACHE_VAR *new_key_cache)
+void mi_change_key_cache(KEY_CACHE *old_key_cache,
+ KEY_CACHE *new_key_cache)
{
LIST *pos;
DBUG_ENTER("mi_change_key_cache");
@@ -141,7 +141,7 @@ void mi_change_key_cache(KEY_CACHE_VAR *old_key_cache,
{
MI_INFO *info= (MI_INFO*) pos->data;
MYISAM_SHARE *share= info->s;
- if (share->key_cache == &old_key_cache->cache)
+ if (share->key_cache == old_key_cache)
mi_assign_to_key_cache(info, (ulonglong) ~0, new_key_cache);
}
@@ -150,6 +150,6 @@ void mi_change_key_cache(KEY_CACHE_VAR *old_key_cache,
MyISAM list structure to ensure that another thread is not trying to
open a new table that will be associted with the old key cache
*/
- multi_key_cache_change(&old_key_cache->cache, &new_key_cache->cache);
+ multi_key_cache_change(old_key_cache, new_key_cache);
pthread_mutex_unlock(&THR_LOCK_myisam);
}
diff --git a/myisam/mi_locking.c b/myisam/mi_locking.c
index 2056b018a16..67ccca52d08 100644
--- a/myisam/mi_locking.c
+++ b/myisam/mi_locking.c
@@ -61,7 +61,7 @@ int mi_lock_database(MI_INFO *info, int lock_type)
count= --share->w_locks;
--share->tot_locks;
if (info->lock_type == F_WRLCK && !share->w_locks &&
- !share->delay_key_write && flush_key_blocks(*share->key_cache,
+ !share->delay_key_write && flush_key_blocks(share->key_cache,
share->kfile,FLUSH_KEEP))
{
error=my_errno;
@@ -389,7 +389,7 @@ int _mi_test_if_changed(register MI_INFO *info)
{ /* Keyfile has changed */
DBUG_PRINT("info",("index file changed"));
if (share->state.process != share->this_process)
- VOID(flush_key_blocks(*share->key_cache, share->kfile, FLUSH_RELEASE));
+ VOID(flush_key_blocks(share->key_cache, share->kfile, FLUSH_RELEASE));
share->last_process=share->state.process;
info->last_unique= share->state.unique;
info->last_loop= share->state.update_count;
diff --git a/myisam/mi_page.c b/myisam/mi_page.c
index 0aae267e05e..8c6981afa00 100644
--- a/myisam/mi_page.c
+++ b/myisam/mi_page.c
@@ -32,7 +32,7 @@ uchar *_mi_fetch_keypage(register MI_INFO *info, MI_KEYDEF *keyinfo,
DBUG_ENTER("_mi_fetch_keypage");
DBUG_PRINT("enter",("page: %ld",page));
- tmp=(uchar*) key_cache_read(*info->s->key_cache,
+ tmp=(uchar*) key_cache_read(info->s->key_cache,
info->s->kfile, page, level, (byte*) buff,
(uint) keyinfo->block_length,
(uint) keyinfo->block_length,
@@ -95,7 +95,7 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
length=keyinfo->block_length;
}
#endif
- DBUG_RETURN((key_cache_write(*info->s->key_cache,
+ DBUG_RETURN((key_cache_write(info->s->key_cache,
info->s->kfile,page, level, (byte*) buff,length,
(uint) keyinfo->block_length,
(int) ((info->lock_type != F_UNLCK) ||
@@ -117,7 +117,7 @@ int _mi_dispose(register MI_INFO *info, MI_KEYDEF *keyinfo, my_off_t pos,
info->s->state.key_del[keyinfo->block_size]=pos;
mi_sizestore(buff,old_link);
info->s->state.changed|= STATE_NOT_SORTED_PAGES;
- DBUG_RETURN(key_cache_write(*info->s->key_cache,
+ DBUG_RETURN(key_cache_write(info->s->key_cache,
info->s->kfile, pos , level, buff,
sizeof(buff),
(uint) keyinfo->block_length,
@@ -146,7 +146,7 @@ my_off_t _mi_new(register MI_INFO *info, MI_KEYDEF *keyinfo, int level)
}
else
{
- if (!key_cache_read(*info->s->key_cache,
+ if (!key_cache_read(info->s->key_cache,
info->s->kfile, pos, level,
buff,
(uint) sizeof(buff),
diff --git a/myisam/mi_panic.c b/myisam/mi_panic.c
index cefb3423ccc..78698d88c54 100644
--- a/myisam/mi_panic.c
+++ b/myisam/mi_panic.c
@@ -48,7 +48,7 @@ int mi_panic(enum ha_panic_function flag)
if (info->s->options & HA_OPTION_READ_ONLY_DATA)
break;
#endif
- if (flush_key_blocks(*info->s->key_cache, info->s->kfile, FLUSH_RELEASE))
+ if (flush_key_blocks(info->s->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/myisam/mi_preload.c b/myisam/mi_preload.c
index 3219c00b0e2..80489cbcd13 100644
--- a/myisam/mi_preload.c
+++ b/myisam/mi_preload.c
@@ -69,7 +69,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
if (!(buff= (uchar *) my_malloc(length, MYF(MY_WME))))
DBUG_RETURN(my_errno= HA_ERR_OUT_OF_MEM);
- if (flush_key_blocks(*share->key_cache,share->kfile, FLUSH_RELEASE))
+ if (flush_key_blocks(share->key_cache,share->kfile, FLUSH_RELEASE))
goto err;
do
@@ -87,7 +87,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if (mi_test_if_nod(buff))
{
- if (key_cache_insert(*share->key_cache,
+ if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
(byte*) buff, block_length))
goto err;
@@ -99,7 +99,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
}
else
{
- if (key_cache_insert(*share->key_cache,
+ if (key_cache_insert(share->key_cache,
share->kfile, pos, DFLT_INIT_HITS,
(byte*) buff, length))
goto err;
diff --git a/myisam/mi_test1.c b/myisam/mi_test1.c
index c1b76408a7c..64ffbe2db1d 100644
--- a/myisam/mi_test1.c
+++ b/myisam/mi_test1.c
@@ -50,7 +50,7 @@ int main(int argc,char *argv[])
MY_INIT(argv[0]);
my_init();
if (key_cacheing)
- init_key_cache(dflt_keycache,KEY_CACHE_BLOCK_SIZE,IO_SIZE*16,0);
+ init_key_cache(dflt_key_cache,KEY_CACHE_BLOCK_SIZE,IO_SIZE*16,0,0);
get_options(argc,argv);
exit(run_test("test1"));
diff --git a/myisam/mi_test2.c b/myisam/mi_test2.c
index 5918a2485b0..d3c3cc2c492 100644
--- a/myisam/mi_test2.c
+++ b/myisam/mi_test2.c
@@ -215,7 +215,7 @@ int main(int argc, char *argv[])
if (!silent)
printf("- Writing key:s\n");
if (key_cacheing)
- init_key_cache(dflt_keycache,key_cache_block_size,key_cache_size,0); /* Use a small cache */
+ init_key_cache(dflt_key_cache,key_cache_block_size,key_cache_size,0,0);
if (locking)
mi_lock_database(file,F_WRLCK);
if (write_cacheing)
@@ -276,7 +276,7 @@ int main(int argc, char *argv[])
}
}
if (key_cacheing)
- resize_key_cache(dflt_keycache,key_cache_block_size,key_cache_size*2);
+ resize_key_cache(dflt_key_cache,key_cache_block_size,key_cache_size*2,0,0);
if (!silent)
printf("- Delete\n");
@@ -829,7 +829,7 @@ reads: %10lu\n",
my_cache_r_requests, my_cache_read);
#endif
}
- end_key_cache(*dflt_keycache,1);
+ end_key_cache(dflt_key_cache,1);
if (blob_buffer)
my_free(blob_buffer,MYF(0));
my_end(silent ? MY_CHECK_ERROR : MY_CHECK_ERROR | MY_GIVE_INFO);
diff --git a/myisam/mi_test3.c b/myisam/mi_test3.c
index baeaba7bf24..dca04a9a64b 100644
--- a/myisam/mi_test3.c
+++ b/myisam/mi_test3.c
@@ -177,7 +177,7 @@ void start_test(int id)
exit(1);
}
if (key_cacheing && rnd(2) == 0)
- init_key_cache(dflt_keycache, KEY_CACHE_BLOCK_SIZE, 65536L,0);
+ init_key_cache(dflt_key_cache, KEY_CACHE_BLOCK_SIZE, 65536L, 0, 0);
printf("Process %d, pid: %d\n",id,getpid()); fflush(stdout);
for (error=i=0 ; i < tests && !error; i++)
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c
index 605baa14582..f034d6ae406 100644
--- a/myisam/myisamchk.c
+++ b/myisam/myisamchk.c
@@ -321,7 +321,7 @@ static struct my_option my_long_options[] =
{ "ft_max_word_len", OPT_FT_MAX_WORD_LEN, "", (gptr*) &ft_max_word_len,
(gptr*) &ft_max_word_len, 0, GET_ULONG, REQUIRED_ARG, HA_FT_MAXLEN, 10,
HA_FT_MAXLEN, 0, 1, 0},
- { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+ { 0, 0, 0, 0, 0, 0, GET_NO_ARG, NO_ARG, 0, 0, 0, 0, 0, 0}
};
@@ -1032,8 +1032,8 @@ static int myisamchk(MI_CHECK *param, my_string filename)
!(param->testflag & (T_FAST | T_FORCE_CREATE)))
{
if (param->testflag & (T_EXTEND | T_MEDIUM))
- VOID(init_key_cache(dflt_keycache,opt_key_cache_block_size,
- param->use_buffers,&dflt_key_cache_var));
+ VOID(init_key_cache(dflt_key_cache,opt_key_cache_block_size,
+ param->use_buffers, 0, 0));
VOID(init_io_cache(&param->read_cache,datafile,
(uint) param->read_buffer_length,
READ_CACHE,
@@ -1047,7 +1047,7 @@ static int myisamchk(MI_CHECK *param, my_string filename)
HA_OPTION_COMPRESS_RECORD)) ||
(param->testflag & (T_EXTEND | T_MEDIUM)))
error|=chk_data_link(param, info, param->testflag & T_EXTEND);
- error|=flush_blocks(param, *share->key_cache, share->kfile);
+ error|=flush_blocks(param, share->key_cache, share->kfile);
VOID(end_io_cache(&param->read_cache));
}
if (!error)
@@ -1456,8 +1456,8 @@ static int mi_sort_records(MI_CHECK *param,
if (share->state.key_root[sort_key] == HA_OFFSET_ERROR)
DBUG_RETURN(0); /* Nothing to do */
- init_key_cache(dflt_keycache, opt_key_cache_block_size, param->use_buffers,
- &dflt_key_cache_var);
+ init_key_cache(dflt_key_cache, opt_key_cache_block_size, param->use_buffers,
+ 0, 0);
if (init_io_cache(&info->rec_cache,-1,(uint) param->write_buffer_length,
WRITE_CACHE,share->pack.header_length,1,
MYF(MY_WME | MY_WAIT_IF_FULL)))
@@ -1571,7 +1571,7 @@ err:
my_free(sort_info.buff,MYF(MY_ALLOW_ZERO_PTR));
sort_info.buff=0;
share->state.sortkey=sort_key;
- DBUG_RETURN(flush_blocks(param, *share->key_cache, share->kfile) |
+ DBUG_RETURN(flush_blocks(param, share->key_cache, share->kfile) |
got_error);
} /* sort_records */
diff --git a/myisam/myisamdef.h b/myisam/myisamdef.h
index 4f1bed5d50a..c92d5a76815 100644
--- a/myisam/myisamdef.h
+++ b/myisam/myisamdef.h
@@ -166,7 +166,7 @@ typedef struct st_mi_isam_share { /* Shared between opens */
char *data_file_name, /* Resolved path names from symlinks */
*index_file_name;
byte *file_map; /* mem-map of file if possible */
- KEY_CACHE_HANDLE *key_cache; /* ref to the current key cache */
+ KEY_CACHE *key_cache; /* ref to the current key cache */
MI_DECODE_TREE *decode_trees;
uint16 *decode_tables;
int (*read_record)(struct st_myisam_info*, my_off_t, byte*);
@@ -713,7 +713,7 @@ int thr_write_keys(MI_SORT_PARAM *sort_param);
#ifdef THREAD
pthread_handler_decl(thr_find_all_keys,arg);
#endif
-int flush_blocks(MI_CHECK *param, KEY_CACHE_HANDLE key_cache, File file);
+int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file);
int sort_write_record(MI_SORT_PARAM *sort_param);
int _create_index_by_sort(MI_SORT_PARAM *info,my_bool no_messages, ulong);
diff --git a/myisam/myisamlog.c b/myisam/myisamlog.c
index fbe8b675821..c9b00be7d9e 100644
--- a/myisam/myisamlog.c
+++ b/myisam/myisamlog.c
@@ -71,7 +71,7 @@ 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,opt_myisam_with_debug=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,
isamlog_process;
@@ -201,9 +201,6 @@ 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;
@@ -333,8 +330,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(dflt_keycache,KEY_CACHE_BLOCK_SIZE,KEY_CACHE_SIZE,
- &dflt_key_cache_var));
+ 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 &&
@@ -648,7 +645,7 @@ static int examine_log(my_string file_name, char **table_names)
goto end;
}
}
- end_key_cache(*dflt_keycache,1);
+ end_key_cache(dflt_key_cache,1);
delete_tree(&tree);
VOID(end_io_cache(&cache));
VOID(my_close(file,MYF(0)));
@@ -668,7 +665,7 @@ static int examine_log(my_string file_name, char **table_names)
llstr(isamlog_filepos,llbuff)));
fflush(stderr);
end:
- end_key_cache(*dflt_keycache, 1);
+ end_key_cache(dflt_key_cache, 1);
delete_tree(&tree);
VOID(end_io_cache(&cache));
VOID(my_close(file,MYF(0)));
diff --git a/myisam/sort.c b/myisam/sort.c
index a41713f750f..651b2331cd1 100644
--- a/myisam/sort.c
+++ b/myisam/sort.c
@@ -84,7 +84,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
IO_CACHE *to_file,
char* key, uint sort_length,
uint count);
-inline int my_var_write(MI_SORT_PARAM *info,IO_CACHE *to_file,char *bufs);
+inline int my_var_write(MI_SORT_PARAM *info,IO_CACHE *to_file, byte *bufs);
/*
Creates a index of sorted keys
@@ -622,21 +622,25 @@ static int NEAR_F write_keys(MI_SORT_PARAM *info, register uchar **sort_keys,
DBUG_RETURN(0);
} /* write_keys */
-inline int my_var_write(MI_SORT_PARAM *info,IO_CACHE *to_file,char *bufs)
+
+inline int my_var_write(MI_SORT_PARAM *info, IO_CACHE *to_file, byte *bufs)
{
int err;
- uint16 len = _mi_keylength(info->keyinfo,bufs);
+ uint16 len = _mi_keylength(info->keyinfo, (uchar*) bufs);
- if ((err= my_b_write(to_file,(byte*)&len,sizeof(len))))
+ /* The following is safe as this is a local file */
+ if ((err= my_b_write(to_file, (byte*)&len, sizeof(len))))
return (err);
- if ((err= my_b_write(to_file,(byte*)bufs,(uint) len)))
+ if ((err= my_b_write(to_file,bufs, (uint) len)))
return (err);
return (0);
}
-static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, register uchar **sort_keys,
- uint count, BUFFPEK *buffpek, IO_CACHE *tempfile)
+static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info,
+ register uchar **sort_keys,
+ uint count, BUFFPEK *buffpek,
+ IO_CACHE *tempfile)
{
uchar **end;
int err;
@@ -653,7 +657,7 @@ static int NEAR_F write_keys_varlen(MI_SORT_PARAM *info, register uchar **sort_k
buffpek->count=count;
for (end=sort_keys+count ; sort_keys != end ; sort_keys++)
{
- if ((err= my_var_write(info,tempfile,*sort_keys)))
+ if ((err= my_var_write(info,tempfile, (byte*) *sort_keys)))
DBUG_RETURN(err);
}
DBUG_RETURN(0);
@@ -816,7 +820,7 @@ static int NEAR_F write_merge_key_varlen(MI_SORT_PARAM *info,
for (idx=1;idx<=count;idx++)
{
int err;
- if ((err= my_var_write(info,to_file,bufs)))
+ if ((err= my_var_write(info,to_file, (byte*) bufs)))
return (err);
bufs=bufs+sort_length;
}
diff --git a/myisam/sp_test.c b/myisam/sp_test.c
index c4847217efd..16a97771887 100644
--- a/myisam/sp_test.c
+++ b/myisam/sp_test.c
@@ -271,7 +271,8 @@ int run_test(const char *filename)
create_key(key, nrecords*upd);
print_key(key," INTERSECT\n");
- hrows=mi_records_in_range(file,0,key,0,HA_READ_MBR_INTERSECT,record+1,0,0);
+ hrows=mi_records_in_range(file,0,key,0,HA_READ_MBR_INTERSECT,record+1,0,
+ HA_READ_KEY_EXACT);
printf(" %ld rows\n", (long) hrows);
@@ -351,7 +352,7 @@ static void print_record(char * record, my_off_t offs,const char * tail)
printf(" len=%d ",len);
memcpy_fixed(&ptr,pos,sizeof(char*));
if(ptr)
- rtree_PrintWKB(ptr,SPDIMS);
+ rtree_PrintWKB((uchar*) ptr,SPDIMS);
else
printf("<NULL> ");
printf(" offs=%ld ",(long int)offs);
@@ -406,7 +407,7 @@ static void create_linestring(char *record,uint rownr)
pos++;
memset(blob_key,0,sizeof(blob_key));
- tmp=rtree_CreateLineStringWKB(x,SPDIMS,npoints,blob_key);
+ tmp=rtree_CreateLineStringWKB(x,SPDIMS,npoints, (uchar*) blob_key);
int4store(pos,tmp);
pos+=4;