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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
5f5fc659
Commit
5f5fc659
authored
Sep 30, 2005
by
unknown
Browse files
Options
Browse Files
Download
Plain Diff
Merge joreland@bk-internal.mysql.com:/home/bk/mysql-5.0
into perch.ndb.mysql.com:/home/jonas/src/mysql-5.0-push
parents
710a2e29
06e08e04
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
70 additions
and
2 deletions
+70
-2
mysys/mf_keycache.c
mysys/mf_keycache.c
+70
-2
No files found.
mysys/mf_keycache.c
View file @
5f5fc659
...
@@ -161,10 +161,12 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var;
...
@@ -161,10 +161,12 @@ KEY_CACHE *dflt_key_cache= &dflt_key_cache_var;
#define FLUSH_CACHE 2000
/* sort this many blocks at once */
#define FLUSH_CACHE 2000
/* sort this many blocks at once */
static
int
flush_all_key_blocks
(
KEY_CACHE
*
keycache
);
static
int
flush_all_key_blocks
(
KEY_CACHE
*
keycache
);
#ifdef THREAD
static
void
link_into_queue
(
KEYCACHE_WQUEUE
*
wqueue
,
static
void
link_into_queue
(
KEYCACHE_WQUEUE
*
wqueue
,
struct
st_my_thread_var
*
thread
);
struct
st_my_thread_var
*
thread
);
static
void
unlink_from_queue
(
KEYCACHE_WQUEUE
*
wqueue
,
static
void
unlink_from_queue
(
KEYCACHE_WQUEUE
*
wqueue
,
struct
st_my_thread_var
*
thread
);
struct
st_my_thread_var
*
thread
);
#endif
static
void
free_block
(
KEY_CACHE
*
keycache
,
BLOCK_LINK
*
block
);
static
void
free_block
(
KEY_CACHE
*
keycache
,
BLOCK_LINK
*
block
);
static
void
test_key_cache
(
KEY_CACHE
*
keycache
,
static
void
test_key_cache
(
KEY_CACHE
*
keycache
,
const
char
*
where
,
my_bool
lock
);
const
char
*
where
,
my_bool
lock
);
...
@@ -215,6 +217,7 @@ static void keycache_debug_print _VARARGS((const char *fmt,...));
...
@@ -215,6 +217,7 @@ static void keycache_debug_print _VARARGS((const char *fmt,...));
#endif
/* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */
#endif
/* defined(KEYCACHE_DEBUG_LOG) && defined(KEYCACHE_DEBUG) */
#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF)
#if defined(KEYCACHE_DEBUG) || !defined(DBUG_OFF)
#ifdef THREAD
static
long
keycache_thread_id
;
static
long
keycache_thread_id
;
#define KEYCACHE_THREAD_TRACE(l) \
#define KEYCACHE_THREAD_TRACE(l) \
KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id))
KEYCACHE_DBUG_PRINT(l,("|thread %ld",keycache_thread_id))
...
@@ -226,6 +229,11 @@ static long keycache_thread_id;
...
@@ -226,6 +229,11 @@ static long keycache_thread_id;
#define KEYCACHE_THREAD_TRACE_END(l) \
#define KEYCACHE_THREAD_TRACE_END(l) \
KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id))
KEYCACHE_DBUG_PRINT(l,("]thread %ld",keycache_thread_id))
#else
/* THREAD */
#define KEYCACHE_THREAD_TRACE(l) KEYCACHE_DBUG_PRINT(l,(""))
#define KEYCACHE_THREAD_TRACE_BEGIN(l) KEYCACHE_DBUG_PRINT(l,(""))
#define KEYCACHE_THREAD_TRACE_END(l) KEYCACHE_DBUG_PRINT(l,(""))
#endif
/* THREAD */
#else
#else
#define KEYCACHE_THREAD_TRACE_BEGIN(l)
#define KEYCACHE_THREAD_TRACE_BEGIN(l)
#define KEYCACHE_THREAD_TRACE_END(l)
#define KEYCACHE_THREAD_TRACE_END(l)
...
@@ -492,6 +500,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
...
@@ -492,6 +500,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
keycache_pthread_mutex_lock
(
&
keycache
->
cache_lock
);
keycache_pthread_mutex_lock
(
&
keycache
->
cache_lock
);
#ifdef THREAD
wqueue
=
&
keycache
->
resize_queue
;
wqueue
=
&
keycache
->
resize_queue
;
thread
=
my_thread_var
;
thread
=
my_thread_var
;
link_into_queue
(
wqueue
,
thread
);
link_into_queue
(
wqueue
,
thread
);
...
@@ -500,6 +509,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
...
@@ -500,6 +509,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
{
{
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
}
}
#endif
keycache
->
resize_in_flush
=
1
;
keycache
->
resize_in_flush
=
1
;
if
(
flush_all_key_blocks
(
keycache
))
if
(
flush_all_key_blocks
(
keycache
))
...
@@ -512,12 +522,16 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
...
@@ -512,12 +522,16 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
}
}
keycache
->
resize_in_flush
=
0
;
keycache
->
resize_in_flush
=
0
;
keycache
->
can_be_used
=
0
;
keycache
->
can_be_used
=
0
;
#ifdef THREAD
while
(
keycache
->
cnt_for_resize_op
)
while
(
keycache
->
cnt_for_resize_op
)
{
{
KEYCACHE_DBUG_PRINT
(
"resize_key_cache: wait"
,
KEYCACHE_DBUG_PRINT
(
"resize_key_cache: wait"
,
(
"suspend thread %ld"
,
thread
->
id
));
(
"suspend thread %ld"
,
thread
->
id
));
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
}
}
#else
KEYCACHE_DBUG_ASSERT
(
keycache
->
cnt_for_resize_op
==
0
);
#endif
end_key_cache
(
keycache
,
0
);
/* Don't free mutex */
end_key_cache
(
keycache
,
0
);
/* Don't free mutex */
/* The following will work even if use_mem is 0 */
/* The following will work even if use_mem is 0 */
...
@@ -525,6 +539,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
...
@@ -525,6 +539,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
division_limit
,
age_threshold
);
division_limit
,
age_threshold
);
finish:
finish:
#ifdef THREAD
unlink_from_queue
(
wqueue
,
thread
);
unlink_from_queue
(
wqueue
,
thread
);
/* Signal for the next resize request to proceeed if any */
/* Signal for the next resize request to proceeed if any */
if
(
wqueue
->
last_thread
)
if
(
wqueue
->
last_thread
)
...
@@ -533,6 +548,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
...
@@ -533,6 +548,7 @@ int resize_key_cache(KEY_CACHE *keycache, uint key_cache_block_size,
(
"thread %ld"
,
wqueue
->
last_thread
->
next
->
id
));
(
"thread %ld"
,
wqueue
->
last_thread
->
next
->
id
));
keycache_pthread_cond_signal
(
&
wqueue
->
last_thread
->
next
->
suspend
);
keycache_pthread_cond_signal
(
&
wqueue
->
last_thread
->
next
->
suspend
);
}
}
#endif
keycache_pthread_mutex_unlock
(
&
keycache
->
cache_lock
);
keycache_pthread_mutex_unlock
(
&
keycache
->
cache_lock
);
return
blocks
;
return
blocks
;
}
}
...
@@ -553,6 +569,7 @@ static inline void inc_counter_for_resize_op(KEY_CACHE *keycache)
...
@@ -553,6 +569,7 @@ static inline void inc_counter_for_resize_op(KEY_CACHE *keycache)
*/
*/
static
inline
void
dec_counter_for_resize_op
(
KEY_CACHE
*
keycache
)
static
inline
void
dec_counter_for_resize_op
(
KEY_CACHE
*
keycache
)
{
{
#ifdef THREAD
struct
st_my_thread_var
*
last_thread
;
struct
st_my_thread_var
*
last_thread
;
if
(
!--
keycache
->
cnt_for_resize_op
&&
if
(
!--
keycache
->
cnt_for_resize_op
&&
(
last_thread
=
keycache
->
resize_queue
.
last_thread
))
(
last_thread
=
keycache
->
resize_queue
.
last_thread
))
...
@@ -561,6 +578,9 @@ static inline void dec_counter_for_resize_op(KEY_CACHE *keycache)
...
@@ -561,6 +578,9 @@ static inline void dec_counter_for_resize_op(KEY_CACHE *keycache)
(
"thread %ld"
,
last_thread
->
next
->
id
));
(
"thread %ld"
,
last_thread
->
next
->
id
));
keycache_pthread_cond_signal
(
&
last_thread
->
next
->
suspend
);
keycache_pthread_cond_signal
(
&
last_thread
->
next
->
suspend
);
}
}
#else
keycache
->
cnt_for_resize_op
--
;
#endif
}
}
/*
/*
...
@@ -650,6 +670,7 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
...
@@ -650,6 +670,7 @@ void end_key_cache(KEY_CACHE *keycache, my_bool cleanup)
}
/* end_key_cache */
}
/* end_key_cache */
#ifdef THREAD
/*
/*
Link a thread into double-linked queue of waiting threads.
Link a thread into double-linked queue of waiting threads.
...
@@ -786,6 +807,7 @@ static void release_queue(KEYCACHE_WQUEUE *wqueue)
...
@@ -786,6 +807,7 @@ static void release_queue(KEYCACHE_WQUEUE *wqueue)
while
(
thread
!=
last
);
while
(
thread
!=
last
);
wqueue
->
last_thread
=
NULL
;
wqueue
->
last_thread
=
NULL
;
}
}
#endif
/*
/*
...
@@ -893,6 +915,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
...
@@ -893,6 +915,7 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
BLOCK_LINK
**
pins
;
BLOCK_LINK
**
pins
;
KEYCACHE_DBUG_ASSERT
(
!
(
block
->
hash_link
&&
block
->
hash_link
->
requests
));
KEYCACHE_DBUG_ASSERT
(
!
(
block
->
hash_link
&&
block
->
hash_link
->
requests
));
#ifdef THREAD
if
(
!
hot
&&
keycache
->
waiting_for_block
.
last_thread
)
if
(
!
hot
&&
keycache
->
waiting_for_block
.
last_thread
)
{
{
/* Signal that in the LRU warm sub-chain an available block has appeared */
/* Signal that in the LRU warm sub-chain an available block has appeared */
...
@@ -929,6 +952,10 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
...
@@ -929,6 +952,10 @@ static void link_block(KEY_CACHE *keycache, BLOCK_LINK *block, my_bool hot,
#endif
#endif
return
;
return
;
}
}
#else
/* THREAD */
KEYCACHE_DBUG_ASSERT
(
!
(
!
hot
&&
keycache
->
waiting_for_block
.
last_thread
));
/* Condition not transformed using DeMorgan, to keep the text identical */
#endif
/* THREAD */
pins
=
hot
?
&
keycache
->
used_ins
:
&
keycache
->
used_last
;
pins
=
hot
?
&
keycache
->
used_ins
:
&
keycache
->
used_last
;
ins
=
*
pins
;
ins
=
*
pins
;
if
(
ins
)
if
(
ins
)
...
@@ -1101,6 +1128,7 @@ static inline void remove_reader(BLOCK_LINK *block)
...
@@ -1101,6 +1128,7 @@ static inline void remove_reader(BLOCK_LINK *block)
static
inline
void
wait_for_readers
(
KEY_CACHE
*
keycache
,
BLOCK_LINK
*
block
)
static
inline
void
wait_for_readers
(
KEY_CACHE
*
keycache
,
BLOCK_LINK
*
block
)
{
{
#ifdef THREAD
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
while
(
block
->
hash_link
->
requests
)
while
(
block
->
hash_link
->
requests
)
{
{
...
@@ -1111,6 +1139,9 @@ static inline void wait_for_readers(KEY_CACHE *keycache, BLOCK_LINK *block)
...
@@ -1111,6 +1139,9 @@ static inline void wait_for_readers(KEY_CACHE *keycache, BLOCK_LINK *block)
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
block
->
condvar
=
NULL
;
block
->
condvar
=
NULL
;
}
}
#else
KEYCACHE_DBUG_ASSERT
(
block
->
hash_link
->
requests
==
0
);
#endif
}
}
...
@@ -1140,6 +1171,7 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
...
@@ -1140,6 +1171,7 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
if
((
*
hash_link
->
prev
=
hash_link
->
next
))
if
((
*
hash_link
->
prev
=
hash_link
->
next
))
hash_link
->
next
->
prev
=
hash_link
->
prev
;
hash_link
->
next
->
prev
=
hash_link
->
prev
;
hash_link
->
block
=
NULL
;
hash_link
->
block
=
NULL
;
#ifdef THREAD
if
(
keycache
->
waiting_for_hash_link
.
last_thread
)
if
(
keycache
->
waiting_for_hash_link
.
last_thread
)
{
{
/* Signal that a free hash link has appeared */
/* Signal that a free hash link has appeared */
...
@@ -1175,6 +1207,9 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
...
@@ -1175,6 +1207,9 @@ static void unlink_hash(KEY_CACHE *keycache, HASH_LINK *hash_link)
hash_link
);
hash_link
);
return
;
return
;
}
}
#else
/* THREAD */
KEYCACHE_DBUG_ASSERT
(
!
(
keycache
->
waiting_for_hash_link
.
last_thread
));
#endif
/* THREAD */
hash_link
->
next
=
keycache
->
free_hash_list
;
hash_link
->
next
=
keycache
->
free_hash_list
;
keycache
->
free_hash_list
=
hash_link
;
keycache
->
free_hash_list
=
hash_link
;
}
}
...
@@ -1240,6 +1275,7 @@ static HASH_LINK *get_hash_link(KEY_CACHE *keycache,
...
@@ -1240,6 +1275,7 @@ static HASH_LINK *get_hash_link(KEY_CACHE *keycache,
}
}
else
else
{
{
#ifdef THREAD
/* Wait for a free hash link */
/* Wait for a free hash link */
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
KEYCACHE_DBUG_PRINT
(
"get_hash_link"
,
(
"waiting"
));
KEYCACHE_DBUG_PRINT
(
"get_hash_link"
,
(
"waiting"
));
...
@@ -1252,6 +1288,9 @@ static HASH_LINK *get_hash_link(KEY_CACHE *keycache,
...
@@ -1252,6 +1288,9 @@ static HASH_LINK *get_hash_link(KEY_CACHE *keycache,
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
keycache_pthread_cond_wait
(
&
thread
->
suspend
,
&
keycache
->
cache_lock
);
&
keycache
->
cache_lock
);
thread
->
opt_info
=
NULL
;
thread
->
opt_info
=
NULL
;
#else
KEYCACHE_DBUG_ASSERT
(
0
);
#endif
goto
restart
;
goto
restart
;
}
}
hash_link
->
file
=
file
;
hash_link
->
file
=
file
;
...
@@ -1363,6 +1402,7 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
...
@@ -1363,6 +1402,7 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
/* Wait intil the page is flushed on disk */
/* Wait intil the page is flushed on disk */
hash_link
->
requests
--
;
hash_link
->
requests
--
;
{
{
#ifdef THREAD
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_SAVED
],
thread
);
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_SAVED
],
thread
);
do
do
...
@@ -1373,6 +1413,16 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
...
@@ -1373,6 +1413,16 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
&
keycache
->
cache_lock
);
&
keycache
->
cache_lock
);
}
}
while
(
thread
->
next
);
while
(
thread
->
next
);
#else
KEYCACHE_DBUG_ASSERT
(
0
);
/*
Given the use of "resize_in_flush", it seems impossible
that this whole branch is ever entered in single-threaded case
because "(wrmode && keycache->resize_in_flush)" cannot be true.
TODO: Check this, and then put the whole branch into the
"#ifdef THREAD" guard.
*/
#endif
}
}
/* Invalidate page in the block if it has not been done yet */
/* Invalidate page in the block if it has not been done yet */
if
(
block
->
status
)
if
(
block
->
status
)
...
@@ -1401,6 +1451,7 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
...
@@ -1401,6 +1451,7 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
KEYCACHE_DBUG_PRINT
(
"find_key_block"
,
KEYCACHE_DBUG_PRINT
(
"find_key_block"
,
(
"request waiting for old page to be saved"
));
(
"request waiting for old page to be saved"
));
{
{
#ifdef THREAD
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
/* Put the request into the queue of those waiting for the old page */
/* Put the request into the queue of those waiting for the old page */
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_SAVED
],
thread
);
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_SAVED
],
thread
);
...
@@ -1413,6 +1464,10 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
...
@@ -1413,6 +1464,10 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
&
keycache
->
cache_lock
);
&
keycache
->
cache_lock
);
}
}
while
(
thread
->
next
);
while
(
thread
->
next
);
#else
KEYCACHE_DBUG_ASSERT
(
0
);
/* No parallel requests in single-threaded case */
#endif
}
}
KEYCACHE_DBUG_PRINT
(
"find_key_block"
,
KEYCACHE_DBUG_PRINT
(
"find_key_block"
,
(
"request for old page resubmitted"
));
(
"request for old page resubmitted"
));
...
@@ -1471,6 +1526,7 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
...
@@ -1471,6 +1526,7 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
all of them must get the same block
all of them must get the same block
*/
*/
#ifdef THREAD
if
(
!
keycache
->
used_last
)
if
(
!
keycache
->
used_last
)
{
{
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
...
@@ -1486,6 +1542,9 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
...
@@ -1486,6 +1542,9 @@ static BLOCK_LINK *find_key_block(KEY_CACHE *keycache,
while
(
thread
->
next
);
while
(
thread
->
next
);
thread
->
opt_info
=
NULL
;
thread
->
opt_info
=
NULL
;
}
}
#else
KEYCACHE_DBUG_ASSERT
(
keycache
->
used_last
);
#endif
block
=
hash_link
->
block
;
block
=
hash_link
->
block
;
if
(
!
block
)
if
(
!
block
)
{
{
...
@@ -1674,6 +1733,7 @@ static void read_block(KEY_CACHE *keycache,
...
@@ -1674,6 +1733,7 @@ static void read_block(KEY_CACHE *keycache,
KEYCACHE_DBUG_PRINT
(
"read_block"
,
KEYCACHE_DBUG_PRINT
(
"read_block"
,
(
"secondary request waiting for new page to be read"
));
(
"secondary request waiting for new page to be read"
));
{
{
#ifdef THREAD
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
/* Put the request into a queue and wait until it can be processed */
/* Put the request into a queue and wait until it can be processed */
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_REQUESTED
],
thread
);
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_REQUESTED
],
thread
);
...
@@ -1685,6 +1745,10 @@ static void read_block(KEY_CACHE *keycache,
...
@@ -1685,6 +1745,10 @@ static void read_block(KEY_CACHE *keycache,
&
keycache
->
cache_lock
);
&
keycache
->
cache_lock
);
}
}
while
(
thread
->
next
);
while
(
thread
->
next
);
#else
KEYCACHE_DBUG_ASSERT
(
0
);
/* No parallel requests in single-threaded case */
#endif
}
}
KEYCACHE_DBUG_PRINT
(
"read_block"
,
KEYCACHE_DBUG_PRINT
(
"read_block"
,
(
"secondary request: new page in cache"
));
(
"secondary request: new page in cache"
));
...
@@ -1822,7 +1886,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
...
@@ -1822,7 +1886,7 @@ byte *key_cache_read(KEY_CACHE *keycache,
#ifndef THREAD
#ifndef THREAD
/* This is only true if we where able to read everything in one block */
/* This is only true if we where able to read everything in one block */
if
(
return_buffer
)
if
(
return_buffer
)
return
(
block
->
buffer
);
DBUG_RETURN
(
block
->
buffer
);
#endif
#endif
buff
+=
read_length
;
buff
+=
read_length
;
filepos
+=
read_length
+
offset
;
filepos
+=
read_length
+
offset
;
...
@@ -2398,6 +2462,7 @@ static int flush_key_blocks_int(KEY_CACHE *keycache,
...
@@ -2398,6 +2462,7 @@ static int flush_key_blocks_int(KEY_CACHE *keycache,
#endif
#endif
block
=
first_in_switch
;
block
=
first_in_switch
;
{
{
#ifdef THREAD
struct
st_my_thread_var
*
thread
=
my_thread_var
;
struct
st_my_thread_var
*
thread
=
my_thread_var
;
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_SAVED
],
thread
);
add_to_queue
(
&
block
->
wqueue
[
COND_FOR_SAVED
],
thread
);
do
do
...
@@ -2408,6 +2473,10 @@ static int flush_key_blocks_int(KEY_CACHE *keycache,
...
@@ -2408,6 +2473,10 @@ static int flush_key_blocks_int(KEY_CACHE *keycache,
&
keycache
->
cache_lock
);
&
keycache
->
cache_lock
);
}
}
while
(
thread
->
next
);
while
(
thread
->
next
);
#else
KEYCACHE_DBUG_ASSERT
(
0
);
/* No parallel requests in single-threaded case */
#endif
}
}
#if defined(KEYCACHE_DEBUG)
#if defined(KEYCACHE_DEBUG)
cnt
++
;
cnt
++
;
...
@@ -2574,7 +2643,6 @@ static void test_key_cache(KEY_CACHE *keycache __attribute__((unused)),
...
@@ -2574,7 +2643,6 @@ static void test_key_cache(KEY_CACHE *keycache __attribute__((unused)),
static
void
keycache_dump
(
KEY_CACHE
*
keycache
)
static
void
keycache_dump
(
KEY_CACHE
*
keycache
)
{
{
FILE
*
keycache_dump_file
=
fopen
(
KEYCACHE_DUMP_FILE
,
"w"
);
FILE
*
keycache_dump_file
=
fopen
(
KEYCACHE_DUMP_FILE
,
"w"
);
struct
st_my_thread_var
*
thread_var
=
my_thread_var
;
struct
st_my_thread_var
*
last
;
struct
st_my_thread_var
*
last
;
struct
st_my_thread_var
*
thread
;
struct
st_my_thread_var
*
thread
;
BLOCK_LINK
*
block
;
BLOCK_LINK
*
block
;
...
...
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