Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
10a8adc1
Commit
10a8adc1
authored
Jun 30, 2003
by
igor@rurik.mysql.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Many files:
Added multiple key cache
parent
4c7714b7
Changes
22
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
573 additions
and
466 deletions
+573
-466
include/my_sys.h
include/my_sys.h
+14
-7
isam/_locking.c
isam/_locking.c
+2
-2
isam/_page.c
isam/_page.c
+13
-9
isam/close.c
isam/close.c
+2
-1
isam/isamchk.c
isam/isamchk.c
+6
-5
isam/panic.c
isam/panic.c
+1
-1
isam/test2.c
isam/test2.c
+2
-2
isam/test3.c
isam/test3.c
+1
-1
myisam/mi_check.c
myisam/mi_check.c
+13
-10
myisam/mi_close.c
myisam/mi_close.c
+1
-1
myisam/mi_delete_all.c
myisam/mi_delete_all.c
+1
-1
myisam/mi_extra.c
myisam/mi_extra.c
+2
-2
myisam/mi_locking.c
myisam/mi_locking.c
+3
-2
myisam/mi_page.c
myisam/mi_page.c
+8
-4
myisam/mi_panic.c
myisam/mi_panic.c
+1
-1
myisam/mi_preload.c
myisam/mi_preload.c
+5
-3
myisam/mi_test1.c
myisam/mi_test1.c
+1
-1
myisam/mi_test2.c
myisam/mi_test2.c
+7
-4
myisam/mi_test3.c
myisam/mi_test3.c
+1
-1
myisam/myisamchk.c
myisam/myisamchk.c
+3
-2
myisam/myisamlog.c
myisam/myisamlog.c
+3
-3
mysys/mf_keycache.c
mysys/mf_keycache.c
+483
-403
No files found.
include/my_sys.h
View file @
10a8adc1
...
...
@@ -248,6 +248,8 @@ extern my_bool NEAR my_disable_locking,NEAR my_disable_async_io,
extern
char
wild_many
,
wild_one
,
wild_prefix
;
extern
const
char
*
charsets_dir
;
extern
char
*
defaults_extra_file
;
extern
void
*
dflt_keycache
;
#define dflt_key_block_size DEFAULT_KEYCACHE_BLOCK_SIZE
typedef
struct
wild_file_pack
/* Struct to hold info when selecting files */
{
...
...
@@ -639,16 +641,21 @@ extern int flush_write_cache(RECORD_CACHE *info);
extern
long
my_clock
(
void
);
extern
sig_handler
sigtstp_handler
(
int
signal_number
);
extern
void
handle_recived_signals
(
void
);
extern
int
init_key_cache
(
ulong
use_mem
);
extern
int
resize_key_cache
(
ulong
use_mem
);
extern
byte
*
key_cache_read
(
File
file
,
my_off_t
filepos
,
byte
*
buff
,
uint
length
,
extern
int
init_key_cache
(
void
**
pkeycache
,
uint
key_cache_block_size
,
ulong
use_mem
);
extern
int
resize_key_cache
(
void
**
pkeycache
,
ulong
use_mem
);
extern
byte
*
key_cache_read
(
void
*
pkeycache
,
File
file
,
my_off_t
filepos
,
byte
*
buff
,
uint
length
,
uint
block_length
,
int
return_buffer
);
extern
int
key_cache_insert
(
File
file
,
my_off_t
filepos
,
extern
int
key_cache_insert
(
void
*
pkeycache
,
File
file
,
my_off_t
filepos
,
byte
*
buff
,
uint
length
);
extern
int
key_cache_write
(
File
file
,
my_off_t
filepos
,
byte
*
buff
,
uint
length
,
extern
int
key_cache_write
(
void
*
pkeycache
,
File
file
,
my_off_t
filepos
,
byte
*
buff
,
uint
length
,
uint
block_length
,
int
force_write
);
extern
int
flush_key_blocks
(
int
file
,
enum
flush_type
type
);
extern
void
end_key_cache
(
void
);
extern
int
flush_key_blocks
(
void
*
pkeycache
,
int
file
,
enum
flush_type
type
);
extern
void
end_key_cache
(
void
**
pkeycache
,
my_bool
cleanup
);
extern
sig_handler
my_set_alarm_variable
(
int
signo
);
extern
void
my_string_ptr_sort
(
void
*
base
,
uint
items
,
size_s
size
);
extern
void
radixsort_for_str_ptr
(
uchar
*
base
[],
uint
number_of_elements
,
...
...
isam/_locking.c
View file @
10a8adc1
...
...
@@ -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_keycache
,
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_keycache
,
share
->
kfile
,
FLUSH_RELEASE
));
share
->
last_process
=
share
->
state
.
process
;
info
->
last_loop
=
share
->
state
.
loop
;
info
->
last_uniq
=
share
->
state
.
uniq
;
...
...
isam/_page.c
View file @
10a8adc1
...
...
@@ -27,7 +27,8 @@ 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
,
tmp
=
(
uchar
*
)
key_cache_read
(
dflt_keycache
,
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
(
uint
)
keyinfo
->
base
.
block_length
,
(
uint
)
keyinfo
->
base
.
block_length
,
return_buffer
);
...
...
@@ -83,7 +84,8 @@ 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
,
return
(
key_cache_write
(
dflt_keycache
,
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
length
,
(
uint
)
keyinfo
->
base
.
block_length
,
(
int
)
(
info
->
lock_type
!=
F_UNLCK
)));
}
/* nisam_write_keypage */
...
...
@@ -99,7 +101,8 @@ 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_keycache
,
info
->
s
->
kfile
,
pos
,(
byte
*
)
&
old_link
,
sizeof
(
long
),
(
uint
)
keyinfo
->
base
.
block_length
,
(
int
)
(
info
->
lock_type
!=
F_UNLCK
)));
...
...
@@ -126,7 +129,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_keycache
,
info
->
s
->
kfile
,
pos
,
(
byte
*
)
&
info
->
s
->
state
.
key_del
[
keynr
],
(
uint
)
sizeof
(
long
),
(
uint
)
keyinfo
->
base
.
block_length
,
0
))
...
...
isam/close.c
View file @
10a8adc1
...
...
@@ -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_keycache
,
share
->
kfile
,
FLUSH_RELEASE
))
error
=
my_errno
;
if
(
share
->
kfile
>=
0
&&
my_close
(
share
->
kfile
,
MYF
(
0
)))
error
=
my_errno
;
...
...
isam/isamchk.c
View file @
10a8adc1
...
...
@@ -516,7 +516,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_keycache
,
dflt_key_block_size
,
use_buffers
));
VOID
(
init_io_cache
(
&
read_cache
,
datafile
,(
uint
)
read_buffer_length
,
READ_CACHE
,
share
->
pack
.
header_length
,
1
,
MYF
(
MY_WME
)));
...
...
@@ -1459,7 +1460,7 @@ my_string name;
printf
(
"Data records: %lu
\n
"
,(
ulong
)
share
->
state
.
records
);
}
VOID
(
init_key_cache
(
use_buffers
));
VOID
(
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
use_buffers
));
if
(
init_io_cache
(
&
read_cache
,
info
->
dfile
,(
uint
)
read_buffer_length
,
READ_CACHE
,
share
->
pack
.
header_length
,
1
,
MYF
(
MY_WME
)))
goto
err
;
...
...
@@ -1887,12 +1888,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_keycache
,
file
,
FLUSH_RELEASE
))
{
print_error
(
"%d when trying to write bufferts"
,
my_errno
);
return
(
1
);
}
end_key_cache
();
end_key_cache
(
&
dflt_keycache
,
1
);
return
0
;
}
/* flush_blocks */
...
...
@@ -1936,7 +1937,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_keycache
,
dflt_key_block_size
,
use_buffers
);
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
)))
...
...
isam/panic.c
View file @
10a8adc1
...
...
@@ -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_keycache
,
info
->
s
->
kfile
,
FLUSH_RELEASE
))
error
=
my_errno
;
if
(
info
->
opt_flag
&
WRITE_CACHE_USED
)
if
(
flush_io_cache
(
&
info
->
rec_cache
))
...
...
isam/test2.c
View file @
10a8adc1
...
...
@@ -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_keycache
,
dflt_key_block_size
,
IO_SIZE
*
16
);
/* Use a small cache */
if
(
locking
)
nisam_lock_database
(
file
,
F_WRLCK
);
if
(
write_cacheing
)
...
...
@@ -674,7 +674,7 @@ end:
puts
(
"Locking used"
);
if
(
use_blob
)
puts
(
"blobs used"
);
end_key_cache
();
end_key_cache
(
&
dflt_keycache
,
1
);
if
(
blob_buffer
)
my_free
(
blob_buffer
,
MYF
(
0
));
my_end
(
MY_CHECK_ERROR
|
MY_GIVE_INFO
);
...
...
isam/test3.c
View file @
10a8adc1
...
...
@@ -173,7 +173,7 @@ void start_test(int id)
exit
(
1
);
}
if
(
key_cacheing
&&
rnd
(
2
)
==
0
)
init_key_cache
(
65536L
);
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
65536L
);
printf
(
"Process %d, pid: %d
\n
"
,
id
,(
int
)
getpid
());
fflush
(
stdout
);
for
(
error
=
i
=
0
;
i
<
tests
&&
!
error
;
i
++
)
...
...
myisam/mi_check.c
View file @
10a8adc1
...
...
@@ -230,7 +230,8 @@ 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
->
kfile
,
next_link
,
(
byte
*
)
info
->
buff
,
if
(
!
(
buff
=
key_cache_read
(
dflt_keycache
,
info
->
s
->
kfile
,
next_link
,
(
byte
*
)
info
->
buff
,
myisam_block_size
,
block_size
,
1
)))
DBUG_RETURN
(
1
);
next_link
=
mi_sizekorr
(
buff
);
...
...
@@ -259,7 +260,8 @@ int chk_size(MI_CHECK *param, register MI_INFO *info)
if
(
!
(
param
->
testflag
&
T_SILENT
))
puts
(
"- check file-size"
);
flush_key_blocks
(
info
->
s
->
kfile
,
FLUSH_FORCE_WRITE
);
/* If called externally */
flush_key_blocks
(
dflt_keycache
,
info
->
s
->
kfile
,
FLUSH_FORCE_WRITE
);
/* If called externally */
size
=
my_seek
(
info
->
s
->
kfile
,
0L
,
MY_SEEK_END
,
MYF
(
0
));
if
((
skr
=
(
my_off_t
)
info
->
state
->
key_file_length
)
!=
size
)
...
...
@@ -1119,7 +1121,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
(
param
->
use_buffers
));
VOID
(
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
param
->
use_buffers
));
if
(
init_io_cache
(
&
param
->
read_cache
,
info
->
dfile
,
(
uint
)
param
->
read_buffer_length
,
...
...
@@ -1477,13 +1480,13 @@ void lock_memory(MI_CHECK *param __attribute__((unused)))
int
flush_blocks
(
MI_CHECK
*
param
,
File
file
)
{
if
(
flush_key_blocks
(
file
,
FLUSH_RELEASE
))
if
(
flush_key_blocks
(
dflt_keycache
,
file
,
FLUSH_RELEASE
))
{
mi_check_print_error
(
param
,
"%d when trying to write bufferts"
,
my_errno
);
return
(
1
);
}
if
(
!
param
->
using_global_keycache
)
end_key_cache
();
end_key_cache
(
&
dflt_keycache
,
1
);
return
0
;
}
/* flush_blocks */
...
...
@@ -1537,7 +1540,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
->
kfile
,
FLUSH_IGNORE_CHANGED
);
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_IGNORE_CHANGED
);
share
->
state
.
version
=
(
ulong
)
time
((
time_t
*
)
0
);
old_state
=
share
->
state
;
/* save state if not stored */
...
...
@@ -1843,7 +1846,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
->
kfile
,
FLUSH_IGNORE_CHANGED
);
flush_key_blocks
(
dflt_keycache
,
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
;
...
...
@@ -1853,7 +1856,7 @@ int mi_repair_by_sort(MI_CHECK *param, register MI_INFO *info,
}
else
{
if
(
flush_key_blocks
(
share
->
kfile
,
FLUSH_FORCE_WRITE
))
if
(
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_FORCE_WRITE
))
goto
err
;
key_map
=
~
key_map
;
/* Create the missing keys */
}
...
...
@@ -2206,7 +2209,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
->
kfile
,
FLUSH_IGNORE_CHANGED
);
flush_key_blocks
(
dflt_keycache
,
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
;
...
...
@@ -2216,7 +2219,7 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
}
else
{
if
(
flush_key_blocks
(
share
->
kfile
,
FLUSH_FORCE_WRITE
))
if
(
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_FORCE_WRITE
))
goto
err
;
key_map
=
~
key_map
;
/* Create the missing keys */
}
...
...
myisam/mi_close.c
View file @
10a8adc1
...
...
@@ -64,7 +64,7 @@ int mi_close(register MI_INFO *info)
if
(
flag
)
{
if
(
share
->
kfile
>=
0
&&
flush_key_blocks
(
share
->
kfile
,
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
share
->
temporary
?
FLUSH_IGNORE_CHANGED
:
FLUSH_RELEASE
))
error
=
my_errno
;
...
...
myisam/mi_delete_all.c
View file @
10a8adc1
...
...
@@ -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
->
kfile
,
FLUSH_IGNORE_CHANGED
);
flush_key_blocks
(
dflt_keycache
,
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
;
...
...
myisam/mi_extra.c
View file @
10a8adc1
...
...
@@ -279,7 +279,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
->
kfile
,
if
(
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
(
function
==
HA_EXTRA_FORCE_REOPEN
?
FLUSH_RELEASE
:
FLUSH_IGNORE_CHANGED
)))
{
...
...
@@ -325,7 +325,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
->
kfile
,
FLUSH_KEEP
);
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_KEEP
);
#ifdef HAVE_PWRITE
_mi_decrement_open_count
(
info
);
#endif
...
...
myisam/mi_locking.c
View file @
10a8adc1
...
...
@@ -51,7 +51,8 @@ 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
->
kfile
,
FLUSH_KEEP
))
!
share
->
delay_key_write
&&
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_KEEP
))
{
error
=
my_errno
;
mi_mark_crashed
(
info
);
/* Mark that table must be checked */
...
...
@@ -385,7 +386,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
->
kfile
,
FLUSH_RELEASE
));
VOID
(
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_RELEASE
));
share
->
last_process
=
share
->
state
.
process
;
info
->
last_unique
=
share
->
state
.
unique
;
info
->
last_loop
=
share
->
state
.
update_count
;
...
...
myisam/mi_page.c
View file @
10a8adc1
...
...
@@ -31,7 +31,8 @@ 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
->
kfile
,
page
,(
byte
*
)
buff
,
tmp
=
(
uchar
*
)
key_cache_read
(
dflt_keycache
,
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
(
uint
)
keyinfo
->
block_length
,
(
uint
)
keyinfo
->
block_length
,
return_buffer
);
...
...
@@ -92,7 +93,8 @@ int _mi_write_keypage(register MI_INFO *info, register MI_KEYDEF *keyinfo,
length
=
keyinfo
->
block_length
;
}
#endif
DBUG_RETURN
((
key_cache_write
(
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
length
,
DBUG_RETURN
((
key_cache_write
(
dflt_keycache
,
info
->
s
->
kfile
,
page
,(
byte
*
)
buff
,
length
,
(
uint
)
keyinfo
->
block_length
,
(
int
)
((
info
->
lock_type
!=
F_UNLCK
)
||
info
->
s
->
delay_key_write
))));
...
...
@@ -112,7 +114,8 @@ 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
->
kfile
,
pos
,
buff
,
DBUG_RETURN
(
key_cache_write
(
dflt_keycache
,
info
->
s
->
kfile
,
pos
,
buff
,
sizeof
(
buff
),
(
uint
)
keyinfo
->
block_length
,
(
int
)
(
info
->
lock_type
!=
F_UNLCK
)));
...
...
@@ -140,7 +143,8 @@ my_off_t _mi_new(register MI_INFO *info, MI_KEYDEF *keyinfo)
}
else
{
if
(
!
key_cache_read
(
info
->
s
->
kfile
,
pos
,
if
(
!
key_cache_read
(
dflt_keycache
,
info
->
s
->
kfile
,
pos
,
buff
,
(
uint
)
sizeof
(
buff
),
(
uint
)
keyinfo
->
block_length
,
0
))
...
...
myisam/mi_panic.c
View file @
10a8adc1
...
...
@@ -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
->
kfile
,
FLUSH_RELEASE
))
if
(
flush_key_blocks
(
dflt_keycache
,
info
->
s
->
kfile
,
FLUSH_RELEASE
))
error
=
my_errno
;
if
(
info
->
opt_flag
&
WRITE_CACHE_USED
)
if
(
flush_io_cache
(
&
info
->
rec_cache
))
...
...
myisam/mi_preload.c
View file @
10a8adc1
...
...
@@ -72,7 +72,7 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
if
(
!
(
buff
=
(
uchar
*
)
my_malloc
(
length
,
MYF
(
MY_WME
))))
return
(
my_errno
=
HA_ERR_OUT_OF_MEM
);
if
(
flush_key_blocks
(
share
->
kfile
,
FLUSH_RELEASE
))
if
(
flush_key_blocks
(
dflt_keycache
,
share
->
kfile
,
FLUSH_RELEASE
))
goto
err
;
do
...
...
@@ -89,7 +89,8 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
{
if
(
mi_test_if_nod
(
buff
))
{
if
(
key_cache_insert
(
share
->
kfile
,
pos
,
(
byte
*
)
buff
,
block_length
))
if
(
key_cache_insert
(
dflt_keycache
,
share
->
kfile
,
pos
,
(
byte
*
)
buff
,
block_length
))
goto
err
;
}
pos
+=
block_length
;
...
...
@@ -99,7 +100,8 @@ int mi_preload(MI_INFO *info, ulonglong key_map, my_bool ignore_leaves)
}
else
{
if
(
key_cache_insert
(
share
->
kfile
,
pos
,
(
byte
*
)
buff
,
length
))
if
(
key_cache_insert
(
dflt_keycache
,
share
->
kfile
,
pos
,
(
byte
*
)
buff
,
length
))
goto
err
;
pos
+=
length
;
}
...
...
myisam/mi_test1.c
View file @
10a8adc1
...
...
@@ -50,7 +50,7 @@ int main(int argc,char *argv[])
MY_INIT
(
argv
[
0
]);
my_init
();
if
(
key_cacheing
)
init_key_cache
(
IO_SIZE
*
16
);
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
IO_SIZE
*
16
);
get_options
(
argc
,
argv
);
exit
(
run_test
(
"test1"
));
...
...
myisam/mi_test2.c
View file @
10a8adc1
...
...
@@ -214,7 +214,7 @@ int main(int argc, char *argv[])
if
(
!
silent
)
printf
(
"- Writing key:s
\n
"
);
if
(
key_cacheing
)
init_key_cache
(
key_cache_size
);
/* Use a small cache */
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
key_cache_size
);
/* Use a small cache */
if
(
locking
)
mi_lock_database
(
file
,
F_WRLCK
);
if
(
write_cacheing
)
...
...
@@ -274,7 +274,7 @@ int main(int argc, char *argv[])
goto
end
;
}
if
(
key_cacheing
)
resize_key_cache
(
key_cache_size
*
2
);
resize_key_cache
(
&
dflt_keycache
,
key_cache_size
*
2
);
}
if
(
!
silent
)
...
...
@@ -816,16 +816,19 @@ end:
puts
(
"Locking used"
);
if
(
use_blob
)
puts
(
"blobs used"
);
#if 0
printf("key cache status: \n\
blocks used:%10lu\n\
w_requests: %10lu\n\
writes: %10lu\n\
r_requests: %10lu\n\
reads: %10lu\n",
my_blocks_used
,
my_cache_w_requests
,
my_cache_write
,
my_blocks_used,
my_cache_w_requests, my_cache_write,
my_cache_r_requests, my_cache_read);
#endif
}
end_key_cache
();
end_key_cache
(
&
dflt_keycache
,
1
);
if
(
blob_buffer
)
my_free
(
blob_buffer
,
MYF
(
0
));
my_end
(
silent
?
MY_CHECK_ERROR
:
MY_CHECK_ERROR
|
MY_GIVE_INFO
);
...
...
myisam/mi_test3.c
View file @
10a8adc1
...
...
@@ -177,7 +177,7 @@ void start_test(int id)
exit
(
1
);
}
if
(
key_cacheing
&&
rnd
(
2
)
==
0
)
init_key_cache
(
65536L
);
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
65536L
);
printf
(
"Process %d, pid: %d
\n
"
,
id
,
getpid
());
fflush
(
stdout
);
for
(
error
=
i
=
0
;
i
<
tests
&&
!
error
;
i
++
)
...
...
myisam/myisamchk.c
View file @
10a8adc1
...
...
@@ -1020,7 +1020,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
(
param
->
use_buffers
));
VOID
(
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
param
->
use_buffers
));
VOID
(
init_io_cache
(
&
param
->
read_cache
,
datafile
,
(
uint
)
param
->
read_buffer_length
,
READ_CACHE
,
...
...
@@ -1437,7 +1438,7 @@ 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
(
param
->
use_buffers
);
init_key_cache
(
&
dflt_keycache
,
dflt_key_block_size
,
param
->
use_buffers
);
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
)))
...
...
myisam/myisamlog.c
View file @
10a8adc1
...
...
@@ -333,7 +333,7 @@ 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_keycache
,
dflt_key_block_size
,
KEY_CACHE_SIZE
));
files_open
=
0
;
access_time
=
0
;
while
(
access_time
++
!=
number_of_commands
&&
...
...
@@ -639,7 +639,7 @@ static int examine_log(my_string file_name, char **table_names)
goto
end
;
}
}
end_key_cache
();
end_key_cache
(
&
dflt_keycache
,
1
);
delete_tree
(
&
tree
);
VOID
(
end_io_cache
(
&
cache
));
VOID
(
my_close
(
file
,
MYF
(
0
)));
...
...
@@ -659,7 +659,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_keycache
,
1
);
delete_tree
(
&
tree
);
VOID
(
end_io_cache
(
&
cache
));
VOID
(
my_close
(
file
,
MYF
(
0
)));
...
...
mysys/mf_keycache.c
View file @
10a8adc1
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment