#At file:///home/svoj/devel/innodb-snapshots/mysql-5.1-bugteam/ based on revid:svoj@stripped
3469 Sergey Vojtovich 2010-04-01
Applying InnoDB snapshot, fixes BUG#35077.
Detailed revision comments:
r6525 | marko | 2010-01-28 16:23:15 +0200 (Thu, 28 Jan 2010) | 11 lines
branches/zip: buf_LRU_invalidate_tablespace(): Do not unnecessarily
acquire the block_mutex for every block in the LRU list. Only acquire
it when holding buf_pool_mutex is not sufficient. This should speed up
the function and considerably reduce traffic on the memory bus and
caches.
I noticed this deficiency when working on Issue #157.
This deficiency popped up again in Issue #449 (Bug #35077),
which this fix does not fully address.
rb://78 revision 1 approved by Heikki Tuuri.
modified:
storage/innodb_plugin/buf/buf0lru.c
=== modified file 'storage/innodb_plugin/buf/buf0lru.c'
--- a/storage/innodb_plugin/buf/buf0lru.c 2009-11-03 10:26:07 +0000
+++ b/storage/innodb_plugin/buf/buf0lru.c 2010-04-01 11:27:18 +0000
@@ -347,20 +347,34 @@ scan_again:
all_freed = TRUE;
+rescan:
bpage = UT_LIST_GET_LAST(buf_pool->LRU);
while (bpage != NULL) {
- mutex_t* block_mutex = buf_page_get_mutex(bpage);
buf_page_t* prev_bpage;
ut_a(buf_page_in_file(bpage));
- mutex_enter(block_mutex);
prev_bpage = UT_LIST_GET_PREV(LRU, bpage);
- if (buf_page_get_space(bpage) == id) {
- if (bpage->buf_fix_count > 0
- || buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+ /* bpage->space and bpage->io_fix are protected by
+ buf_pool_mutex and block_mutex. It is safe to check
+ them while holding buf_pool_mutex only. */
+
+ if (buf_page_get_space(bpage) != id) {
+ /* Skip this block, as it does not belong to
+ the space that is being invalidated. */
+ } else if (buf_page_get_io_fix(bpage) != BUF_IO_NONE) {
+ /* We cannot remove this page during this scan
+ yet; maybe the system is currently reading it
+ in, or flushing the modifications to the file */
+
+ all_freed = FALSE;
+ } else {
+ mutex_t* block_mutex = buf_page_get_mutex(bpage);
+ mutex_enter(block_mutex);
+
+ if (bpage->buf_fix_count > 0) {
/* We cannot remove this page during
this scan yet; maybe the system is
@@ -423,12 +437,12 @@ scan_again:
buf_buddy_free() may have relocated
prev_bpage. Rescan the LRU list. */
- bpage = UT_LIST_GET_LAST(buf_pool->LRU);
- continue;
+ goto rescan;
}
- }
next_page:
- mutex_exit(block_mutex);
+ mutex_exit(block_mutex);
+ }
+
bpage = prev_bpage;
}
Attachment: [text/bzr-bundle] bzr/svoj@sun.com-20100401112718-vdkxufdgr2dkokqe.bundle
| Thread |
|---|
| • bzr commit into mysql-5.1-bugteam branch (svoj:3469) Bug#35077 | Sergey Vojtovich | 1 Apr |