List:Commits« Previous MessageNext Message »
From:Inaam Rana Date:July 26 2010 5:34pm
Subject:bzr commit into mysql-next-mr-innodb branch (inaam.rana:3246)
View as plain text  
#At file:///home/inaam/w/page_hash/ based on revid:inaam.rana@stripped

 3246 Inaam Rana	2010-07-26
      Number of page_hash_mutexes must be a power of 2. Round it up
      if user has provided a number that is not power of 2.

    modified:
      storage/innobase/buf/buf0buf.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/buf0buf.h
=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	revid:inaam.rana@stripped
+++ b/storage/innobase/buf/buf0buf.c	revid:inaam.rana@stripped
@@ -1231,7 +1231,13 @@ buf_pool_init_instance(
 		buf_pool->curr_size = chunk->size;
 		buf_pool->curr_pool_size = buf_pool->curr_size * UNIV_PAGE_SIZE;
 
+		/* Number of mutexes portecting page_hash must be a
+		power of two */
+		srv_n_page_hash_mutexes =
+				 ut_2_power_up(srv_n_page_hash_mutexes);
 		ut_a(srv_n_page_hash_mutexes != 0);
+		ut_a(srv_n_page_hash_mutexes <= MAX_PAGE_HASH_MUTEXES);
+
 		buf_pool->page_hash = ha_create(2 * buf_pool->curr_size,
 						srv_n_page_hash_mutexes,
 						MEM_HEAP_FOR_PAGE_HASH,
@@ -1753,6 +1759,8 @@ buf_pool_page_hash_rebuild_instance(
 	hash_table_free(buf_pool->page_hash);
 
 	ut_a(srv_n_page_hash_mutexes != 0);
+	ut_a(srv_n_page_hash_mutexes <= MAX_PAGE_HASH_MUTEXES);
+
 	buf_pool->page_hash = page_hash
 			    = ha_create(2 * buf_pool->curr_size,
 					srv_n_page_hash_mutexes,

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:inaam.rana@stripped
+++ b/storage/innobase/handler/ha_innodb.cc	revid:inaam.rana@stripped
@@ -11196,8 +11196,8 @@ static MYSQL_SYSVAR_LONGLONG(buffer_pool
 
 static MYSQL_SYSVAR_ULONG(page_hash_mutexes, srv_n_page_hash_mutexes,
   PLUGIN_VAR_OPCMDARG | PLUGIN_VAR_READONLY,
-  "Number of mutexes protecting buffer pool page_hash",
-  NULL, NULL, 256, 1, 1024, 0);
+  "Number of mutexes protecting buffer pool page_hash. Rounded up to the next power of 2",
+  NULL, NULL, 256, 1, MAX_PAGE_HASH_MUTEXES, 0);
 
 static MYSQL_SYSVAR_LONG(buffer_pool_instances, innobase_buffer_pool_instances,
   PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_READONLY,

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	revid:inaam.rana@stripped
+++ b/storage/innobase/include/buf0buf.h	revid:inaam.rana@stripped
@@ -66,6 +66,9 @@ Created 11/5/1995 Heikki Tuuri
 #define MAX_BUFFER_POOLS 64		/*!< The maximum number of buffer
 					pools that can be defined */
 
+#define MAX_PAGE_HASH_MUTEXES	1024	/*!< The maximum number of
+					page_hash mutexes */
+
 #define BUF_POOL_WATCH_SIZE 1		/*!< Maximum number of concurrent
 					buffer pool watches */
 


Attachment: [text/bzr-bundle] bzr/inaam.rana@oracle.com-20100726173345-hoaud5e28e3l2u5k.bundle
Thread
bzr commit into mysql-next-mr-innodb branch (inaam.rana:3246) Inaam Rana26 Jul