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
274f2bc6
Commit
274f2bc6
authored
Nov 15, 2006
by
marko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
branches/zip: buf_LRU_free_block(): New function, split from
buf_LRU_search_and_free_block().
parent
2018ce35
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
64 additions
and
41 deletions
+64
-41
buf/buf0flu.c
buf/buf0flu.c
+1
-1
buf/buf0lru.c
buf/buf0lru.c
+55
-40
include/buf0lru.h
include/buf0lru.h
+8
-0
No files found.
buf/buf0flu.c
View file @
274f2bc6
...
...
@@ -116,7 +116,7 @@ buf_flush_ready_for_replace(
ut_ad
(
mutex_own
(
&
(
buf_pool
->
mutex
)));
ut_ad
(
mutex_own
(
&
block
->
mutex
));
#endif
/* UNIV_SYNC_DEBUG */
if
(
block
->
state
!=
BUF_BLOCK_FILE_PAGE
)
{
if
(
UNIV_UNLIKELY
(
block
->
state
!=
BUF_BLOCK_FILE_PAGE
)
)
{
ut_print_timestamp
(
stderr
);
fprintf
(
stderr
,
" InnoDB: Error: buffer block state %lu"
...
...
buf/buf0lru.c
View file @
274f2bc6
...
...
@@ -194,43 +194,30 @@ buf_LRU_get_recent_limit(void)
}
/**********************************************************************
Look for a replaceable block from the end of the LRU list and put it to
the free list if found. */
Try to free a block. */
ibool
buf_LRU_
search_and_
free_block
(
/*===============
===========
*/
buf_LRU_free_block
(
/*===============*/
/* out: TRUE if freed */
ulint
n_iterations
)
/* in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; if value is
k < 10, then we only search k/10 * [number
of pages in the buffer pool] from the end
of the LRU list */
buf_block_t
*
block
)
/* in: block to be freed */
{
buf_block_t
*
block
;
ulint
distance
=
0
;
ibool
freed
;
mutex_enter
(
&
(
buf_pool
->
mutex
));
freed
=
FALSE
;
block
=
UT_LIST_GET_LAST
(
buf_pool
->
LRU
);
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
buf_pool
->
mutex
));
ut_ad
(
mutex_own
(
&
block
->
mutex
));
#endif
/* UNIV_SYNC_DEBUG */
while
(
block
!=
NULL
)
{
ut_a
(
block
->
in_LRU_list
);
mutex_enter
(
&
block
->
mutex
);
if
(
!
buf_flush_ready_for_replace
(
block
))
{
if
(
buf_flush_ready_for_replace
(
block
))
{
return
(
FALSE
);
}
#ifdef UNIV_DEBUG
if
(
buf_debug_prints
)
{
fprintf
(
stderr
,
"Putting space %lu page %lu"
" to free list
\n
"
,
(
ulong
)
block
->
space
,
(
ulong
)
block
->
offset
);
fprintf
(
stderr
,
"Putting space %lu page %lu to free list
\n
"
,
(
ulong
)
block
->
space
,
(
ulong
)
block
->
offset
);
}
#endif
/* UNIV_DEBUG */
...
...
@@ -243,37 +230,65 @@ buf_LRU_search_and_free_block(
btr_search_drop_page_hash_index
(
block
);
ut_a
(
block
->
buf_fix_count
==
0
);
mutex_enter
(
&
(
buf_pool
->
mutex
));
mutex_enter
(
&
block
->
mutex
);
buf_LRU_block_free_hashed_page
(
block
);
freed
=
TRUE
;
return
(
TRUE
);
}
/**********************************************************************
Look for a replaceable block from the end of the LRU list and put it to
the free list if found. */
ibool
buf_LRU_search_and_free_block
(
/*==========================*/
/* out: TRUE if freed */
ulint
n_iterations
)
/* in: how many times this has been called
repeatedly without result: a high value means
that we should search farther; if value is
k < 10, then we only search k/10 * [number
of pages in the buffer pool] from the end
of the LRU list */
{
buf_block_t
*
block
;
ulint
distance
=
0
;
ibool
freed
;
mutex_enter
(
&
(
buf_pool
->
mutex
));
freed
=
FALSE
;
block
=
UT_LIST_GET_LAST
(
buf_pool
->
LRU
);
while
(
block
!=
NULL
)
{
mutex_enter
(
&
block
->
mutex
);
freed
=
buf_LRU_free_block
(
block
);
mutex_exit
(
&
block
->
mutex
);
if
(
freed
)
{
break
;
}
mutex_exit
(
&
block
->
mutex
);
block
=
UT_LIST_GET_PREV
(
LRU
,
block
);
distance
++
;
if
(
!
freed
&&
n_iterations
<=
10
if
(
n_iterations
<=
10
&&
distance
>
100
+
(
n_iterations
*
buf_pool
->
curr_size
)
/
10
)
{
buf_pool
->
LRU_flush_ended
=
0
;
mutex_exit
(
&
(
buf_pool
->
mutex
));
return
(
FALSE
);
goto
func_exit
;
}
}
if
(
buf_pool
->
LRU_flush_ended
>
0
)
{
buf_pool
->
LRU_flush_ended
--
;
}
func_exit:
if
(
!
freed
)
{
buf_pool
->
LRU_flush_ended
=
0
;
}
...
...
include/buf0lru.h
View file @
274f2bc6
...
...
@@ -66,6 +66,14 @@ buf_LRU_get_recent_limit(void);
/*==========================*/
/* out: the limit; zero if could not determine it */
/**********************************************************************
Try to free a block. */
ibool
buf_LRU_free_block
(
/*===============*/
/* out: TRUE if freed */
buf_block_t
*
block
);
/* in: block to be freed */
/**********************************************************************
Look for a replaceable block from the end of the LRU list and put it to
the free list if found. */
...
...
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