MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:vasil.dimov Date:July 30 2010 3:47pm
Subject:bzr push into mysql-next-mr-innodb branch (vasil.dimov:3251 to 3252)
View as plain text  
 3252 Vasil Dimov	2010-07-30 [merge]
      Merge mysql-trunk-innodb -> mysql-next-mr-innodb

    modified:
      storage/innobase/buf/buf0flu.c
 3251 Vasil Dimov	2010-07-29
      Followup to vasil.dimov@stripped
      Also need to change the type in the header file.

    modified:
      storage/innobase/include/srv0srv.h
=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c	revid:vasil.dimov@stripped
+++ b/storage/innobase/buf/buf0flu.c	revid:vasil.dimov@stripped
@@ -1253,8 +1253,12 @@ buf_flush_try_neighbors(
 /*====================*/
 	ulint		space,		/*!< in: space id */
 	ulint		offset,		/*!< in: page offset */
-	enum buf_flush	flush_type)	/*!< in: BUF_FLUSH_LRU or
+	enum buf_flush	flush_type,	/*!< in: BUF_FLUSH_LRU or
 					BUF_FLUSH_LIST */
+	ulint		n_flushed,	/*!< in: number of pages
+					flushed so far in this batch */
+	ulint		n_to_flush)	/*!< in: maximum number of pages
+					we are allowed to flush */
 {
 	ulint		i;
 	ulint		low;
@@ -1295,6 +1299,21 @@ buf_flush_try_neighbors(
 
 		buf_page_t*	bpage;
 
+		if ((count + n_flushed) >= n_to_flush) {
+
+			/* We have already flushed enough pages and
+			should call it a day. There is, however, one
+			exception. If the page whose neighbors we
+			are flushing has not been flushed yet then
+			we'll try to flush the victim that we
+			selected originally. */
+			if (i <= offset) {
+				i = offset;
+			} else {
+				break;
+			}
+		}
+
 		buf_pool = buf_pool_get(space, i);
 
 		buf_pool_mutex_enter(buf_pool);
@@ -1362,6 +1381,8 @@ buf_flush_page_and_try_neighbors(
 					buf_page_in_file(bpage) */
 	enum buf_flush	flush_type,	/*!< in: BUF_FLUSH_LRU
 					or BUF_FLUSH_LIST */
+	ulint		n_to_flush,	/*!< in: number of pages to
+					flush */
 	ulint*		count)		/*!< in/out: number of pages
 					flushed */
 {
@@ -1395,7 +1416,11 @@ buf_flush_page_and_try_neighbors(
 		mutex_exit(block_mutex);
 
 		/* Try to flush also all the neighbors */
-		*count += buf_flush_try_neighbors(space, offset, flush_type);
+		*count += buf_flush_try_neighbors(space,
+						  offset,
+						  flush_type,
+						  *count,
+						  n_to_flush);
 
 		buf_pool_mutex_enter(buf_pool);
 		flushed = TRUE;
@@ -1435,7 +1460,7 @@ buf_flush_LRU_list_batch(
 		a page that isn't ready for flushing. */
 		while (bpage != NULL
 		       && !buf_flush_page_and_try_neighbors(
-				bpage, BUF_FLUSH_LRU, &count)) {
+				bpage, BUF_FLUSH_LRU, max, &count)) {
 
 			bpage = UT_LIST_GET_PREV(LRU, bpage);
 		}
@@ -1516,7 +1541,7 @@ buf_flush_flush_list_batch(
 		while (bpage != NULL
 		       && len > 0
 		       && !buf_flush_page_and_try_neighbors(
-				bpage, BUF_FLUSH_LIST, &count)) {
+				bpage, BUF_FLUSH_LIST, min_n, &count)) {
 
 			buf_flush_list_mutex_enter(buf_pool);
 


Attachment: [text/bzr-bundle] bzr/vasil.dimov@oracle.com-20100730154558-pinrhv0z3zrou29s.bundle
Thread
bzr push into mysql-next-mr-innodb branch (vasil.dimov:3251 to 3252) vasil.dimov30 Jul