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
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
Hide 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
...
...
@@ -193,6 +193,53 @@ buf_LRU_get_recent_limit(void)
return
(
limit
);
}
/**********************************************************************
Try to free a block. */
ibool
buf_LRU_free_block
(
/*===============*/
/* out: TRUE if freed */
buf_block_t
*
block
)
/* in: block to be freed */
{
#ifdef UNIV_SYNC_DEBUG
ut_ad
(
mutex_own
(
&
buf_pool
->
mutex
));
ut_ad
(
mutex_own
(
&
block
->
mutex
));
#endif
/* UNIV_SYNC_DEBUG */
ut_a
(
block
->
in_LRU_list
);
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
);
}
#endif
/* UNIV_DEBUG */
buf_LRU_block_remove_hashed_page
(
block
);
mutex_exit
(
&
(
buf_pool
->
mutex
));
mutex_exit
(
&
block
->
mutex
);
/* Remove possible adaptive hash index on the page */
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
);
return
(
TRUE
);
}
/**********************************************************************
Look for a replaceable block from the end of the LRU list and put it to
the free list if found. */
...
...
@@ -218,62 +265,30 @@ buf_LRU_search_and_free_block(
block
=
UT_LIST_GET_LAST
(
buf_pool
->
LRU
);
while
(
block
!=
NULL
)
{
ut_a
(
block
->
in_LRU_list
);
mutex_enter
(
&
block
->
mutex
);
freed
=
buf_LRU_free_block
(
block
);
mutex_exit
(
&
block
->
mutex
);
if
(
buf_flush_ready_for_replace
(
block
))
{
#ifdef UNIV_DEBUG
if
(
buf_debug_prints
)
{
fprintf
(
stderr
,
"Putting space %lu page %lu"
" to free list
\n
"
,
(
ulong
)
block
->
space
,
(
ulong
)
block
->
offset
);
}
#endif
/* UNIV_DEBUG */
buf_LRU_block_remove_hashed_page
(
block
);
mutex_exit
(
&
(
buf_pool
->
mutex
));
mutex_exit
(
&
block
->
mutex
);
/* Remove possible adaptive hash index on the page */
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
;
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