List:Commits« Previous MessageNext Message »
From:marko.makela Date:October 27 2010 7:06am
Subject:bzr push into mysql-trunk-innodb branch (marko.makela:3289 to 3290)
View as plain text  
 3290 Marko Mäkelä	2010-10-27 [merge]
      Merge mysql-5.5-innodb to mysql-trunk-innodb.

    modified:
      storage/innobase/CMakeLists.txt
      storage/innobase/buf/buf0buf.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/include/buf0buf.h
      storage/innobase/include/buf0buf.ic
 3289 Marko Mäkelä	2010-10-27
      Remove a reference to ut0auxconf.h,
      which was needed when the InnoDB Plugin 1.0 was distributed
      separately from MySQL 5.1. Somehow, this reference was not removed
      when the corresponding change was merged from mysql-5.5-innodb
      revision-id: marko.makela@stripped9112752-ac5w7zyzbv10nvi1

    modified:
      storage/innobase/include/univ.i
=== modified file 'storage/innobase/CMakeLists.txt'
--- a/storage/innobase/CMakeLists.txt	revid:marko.makela@strippede
+++ b/storage/innobase/CMakeLists.txt	revid:marko.makela@stripped
@@ -13,7 +13,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
 
-# This is the CMakeLists for InnoDB Plugin
+# This is the CMakeLists for InnoDB
 
 INCLUDE(CheckFunctionExists)
 INCLUDE(CheckCSourceCompiles)
@@ -254,29 +254,7 @@ IF(WITH_INNODB)
   SET(WITH_INNOBASE_STORAGE_ENGINE TRUE)
 ENDIF()
 
-
-#The plugin's CMakeLists.txt still needs to work with previous versions of MySQL.
-IF(EXISTS ${SOURCE_DIR}/storage/mysql_storage_engine.cmake)
-	# Old plugin support on Windows only, 
-	# use tricks to force ha_innodb.dll name for DLL
-	INCLUDE(${SOURCE_DIR}/storage/mysql_storage_engine.cmake)
-	MYSQL_STORAGE_ENGINE(INNOBASE)
-	GET_TARGET_PROPERTY(LIB_LOCATION ha_innobase LOCATION)
-	IF(LIB_LOCATION)
-		SET_TARGET_PROPERTIES(ha_innobase PROPERTIES OUTPUT_NAME ha_innodb)
-	ENDIF()
-ELSEIF (MYSQL_VERSION_ID LESS "50137")
-	# Windows only, no plugin support
-	IF (NOT SOURCE_SUBLIBS)
-		ADD_DEFINITIONS(-DMYSQL_SERVER)
-		ADD_LIBRARY(innobase STATIC ${INNOBASE_SOURCES})
-		# Require mysqld_error.h, which is built as part of the GenError
-		ADD_DEPENDENCIES(innobase GenError)
-	ENDIF()
-ELSE()
-	# New plugin support, cross-platform ,  base name for shared module is "ha_innodb"
-	MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE 
-		DEFAULT
-		MODULE_OUTPUT_NAME ha_innodb
-		LINK_LIBRARIES ${ZLIB_LIBRARY})
-ENDIF()
+MYSQL_ADD_PLUGIN(innobase ${INNOBASE_SOURCES} STORAGE_ENGINE 
+  DEFAULT
+  MODULE_OUTPUT_NAME ha_innodb
+  LINK_LIBRARIES ${ZLIB_LIBRARY})

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	revid:marko.makela@strippede
+++ b/storage/innobase/buf/buf0buf.c	revid:marko.makela@oracle.com-20101027065957-lx0nlsth2l750d1o
@@ -247,8 +247,8 @@ static const int WAIT_FOR_READ	= 5000;
 /** Number of attemtps made to read in a page in the buffer pool */
 static const ulint BUF_PAGE_READ_MAX_RETRIES = 100;
 
-/** The buffer buf_pool of the database */
-UNIV_INTERN buf_pool_t*	buf_pool_ptr[MAX_BUFFER_POOLS];
+/** The buffer pools of the database */
+UNIV_INTERN buf_pool_t*	buf_pool_ptr;
 
 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
 static ulint	buf_dbg_counter	= 0; /*!< This is used to insert validation
@@ -866,7 +866,7 @@ buf_block_init(
 
 	block->frame = frame;
 
-	block->page.buf_pool = buf_pool;
+	block->page.buf_pool_index = buf_pool_index(buf_pool);
 	block->page.state = BUF_BLOCK_NOT_USED;
 	block->page.buf_fix_count = 0;
 	block->page.io_fix = BUF_IO_NONE;
@@ -1300,8 +1300,6 @@ buf_pool_free_instance(
 	ha_clear(buf_pool->page_hash);
 	hash_table_free(buf_pool->page_hash);
 	hash_table_free(buf_pool->zip_hash);
-	mem_free(buf_pool);
-	buf_pool = NULL;
 }
 
 /********************************************************************//**
@@ -1314,25 +1312,22 @@ buf_pool_init(
 	ulint	total_size,	/*!< in: size of the total pool in bytes */
 	ulint	n_instances)	/*!< in: number of instances */
 {
-	ulint	i;
+	ulint		i;
+	const ulint	size	= total_size / n_instances;
+
+	ut_ad(n_instances < MAX_BUFFER_POOLS);
+	ut_ad(n_instances == srv_buf_pool_instances);
 
 	/* We create an extra buffer pool instance, this instance is used
 	for flushing the flush lists, to keep track of n_flush for all
 	the buffer pools and also used as a waiting object during flushing. */
-	for (i = 0; i < n_instances; i++) {
-		buf_pool_t*	ptr;
-		ulint		size;
-
-		ptr = mem_zalloc(sizeof(*ptr));
+	buf_pool_ptr = mem_zalloc(n_instances * sizeof *buf_pool_ptr);
 
-		size = total_size / n_instances;
-
-		buf_pool_ptr[i] = ptr;
+	for (i = 0; i < n_instances; i++) {
+		buf_pool_t*	ptr	= &buf_pool_ptr[i];
 
 		if (buf_pool_init_instance(ptr, size, i) != DB_SUCCESS) {
 
-			mem_free(buf_pool_ptr[i]);
-
 			/* Free all the instances created so far. */
 			buf_pool_free(i);
 
@@ -1361,8 +1356,10 @@ buf_pool_free(
 
 	for (i = 0; i < n_instances; i++) {
 		buf_pool_free_instance(buf_pool_from_array(i));
-		buf_pool_ptr[i] = NULL;
 	}
+
+	mem_free(buf_pool_ptr);
+	buf_pool_ptr = NULL;
 }
 
 /********************************************************************//**
@@ -3891,7 +3888,7 @@ err_exit:
 		bpage = buf_buddy_alloc(buf_pool, sizeof *bpage, &lru);
 
 		/* Initialize the buf_pool pointer. */
-		bpage->buf_pool = buf_pool;
+		bpage->buf_pool_index = buf_pool_index(buf_pool);
 
 		mutex_enter(hash_mutex);
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@stripped79yw0pw5yfe
+++ b/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@strippedd1o
@@ -89,10 +89,6 @@ extern "C" {
 #  define MYSQL_PLUGIN_IMPORT /* nothing */
 # endif /* MYSQL_PLUGIN_IMPORT */
 
-#if MYSQL_VERSION_ID < 50124
-bool check_global_access(THD *thd, ulong want_access);
-#endif /* MYSQL_VERSION_ID < 50124 */
-
 /** to protect innobase_open_files */
 static mysql_mutex_t innobase_share_mutex;
 /** to force correct commit order in binlog */
@@ -2029,11 +2025,7 @@ innobase_convert_identifier(
 				FALSE=id is an UTF-8 string */
 {
 	char nz[NAME_LEN + 1];
-#if MYSQL_VERSION_ID >= 50141
 	char nz2[NAME_LEN + 1 + EXPLAIN_FILENAME_MAX_EXTRA_LENGTH];
-#else /* MYSQL_VERSION_ID >= 50141 */
-	char nz2[NAME_LEN + 1 + sizeof srv_mysql50_table_name_prefix];
-#endif /* MYSQL_VERSION_ID >= 50141 */
 
 	const char*	s	= id;
 	int		q;
@@ -2051,13 +2043,9 @@ innobase_convert_identifier(
 		nz[idlen] = 0;
 
 		s = nz2;
-#if MYSQL_VERSION_ID >= 50141
 		idlen = explain_filename((THD*) thd, nz, nz2, sizeof nz2,
 					 EXPLAIN_PARTITIONS_AS_COMMENT);
 		goto no_quote;
-#else /* MYSQL_VERSION_ID >= 50141 */
-		idlen = filename_to_tablename(nz, nz2, sizeof nz2);
-#endif /* MYSQL_VERSION_ID >= 50141 */
 	}
 
 	/* See if the identifier needs to be quoted. */
@@ -2068,9 +2056,7 @@ innobase_convert_identifier(
 	}
 
 	if (q == EOF) {
-#if MYSQL_VERSION_ID >= 50141
 no_quote:
-#endif /* MYSQL_VERSION_ID >= 50141 */
 		if (UNIV_UNLIKELY(idlen > buflen)) {
 			idlen = buflen;
 		}

=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h	revid:marko.makela@stripped20101027064047-ye93479yw0pw5yfe
+++ b/storage/innobase/handler/ha_innodb.h	revid:marko.makela@stripped65957-lx0nlsth2l750d1o
@@ -276,14 +276,13 @@ int thd_binlog_format(const MYSQL_THD th
 */
 void thd_mark_transaction_to_rollback(MYSQL_THD thd, bool all);
 
-#if MYSQL_VERSION_ID > 50140
 /**
   Check if binary logging is filtered for thread's current db.
   @param  thd   Thread handle
   @retval 1 the query is not filtered, 0 otherwise.
 */
 bool thd_binlog_filter_ok(const MYSQL_THD thd);
-#endif /* MYSQL_VERSION_ID > 50140 */
+
 /**
   Check if the query may generate row changes which
   may end up in the binary.

=== modified file 'storage/innobase/include/buf0buf.h'
--- a/storage/innobase/include/buf0buf.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/buf0buf.h	revid:marko.makela@oracle.com-20101027065957-lx0nlsth2l750d1o
@@ -72,7 +72,7 @@ Created 11/5/1995 Heikki Tuuri
 #define BUF_POOL_WATCH_SIZE 1		/*!< Maximum number of concurrent
 					buffer pool watches */
 
-extern	buf_pool_t*	buf_pool_ptr[MAX_BUFFER_POOLS]; /*!< The buffer pools
+extern	buf_pool_t*	buf_pool_ptr;	/*!< The buffer pools
 					of the database */
 #ifdef UNIV_DEBUG
 extern ibool		buf_debug_prints;/*!< If this is set TRUE, the program
@@ -1037,6 +1037,15 @@ buf_page_address_fold(
 	ulint	space,	/*!< in: space id */
 	ulint	offset)	/*!< in: offset of the page within space */
 	__attribute__((const));
+/********************************************************************//**
+Calculates the index of a buffer pool to the buf_pool[] array.
+@return	the position of the buffer pool in buf_pool[] */
+UNIV_INLINE
+ulint
+buf_pool_index(
+/*===========*/
+	const buf_pool_t*	buf_pool)	/*!< in: buffer pool */
+	__attribute__((nonnull, const));
 /******************************************************************//**
 Returns the buffer pool instance given a page instance
 @return buf_pool */
@@ -1068,8 +1077,9 @@ Returns the buffer pool instance given i
 UNIV_INLINE
 buf_pool_t*
 buf_pool_from_array(
-/*====================*/
-	ulint	index);	/*!< in: array index to get buffer pool instance from */
+/*================*/
+	ulint	index);		/*!< in: array index to get
+				buffer pool instance from */
 /******************************************************************//**
 Returns the control block of a file page, NULL if not found.
 @return	block, NULL if not found */
@@ -1236,8 +1246,13 @@ struct buf_page_struct{
 	unsigned	io_fix:2;	/*!< type of pending I/O operation;
 					also protected by buf_pool->mutex
 					@see enum buf_io_fix */
-	unsigned	buf_fix_count:25;/*!< count of how manyfold this block
+	unsigned	buf_fix_count:19;/*!< count of how manyfold this block
 					is currently bufferfixed */
+	unsigned	buf_pool_index:6;/*!< index number of the buffer pool
+					that this block belongs to */
+# if MAX_BUFFER_POOLS > 64
+#  error "MAX_BUFFER_POOLS > 64; redefine buf_pool_index:6"
+# endif
 	/* @} */
 #endif /* !UNIV_HOTBACKUP */
 	page_zip_des_t	zip;		/*!< compressed page; zip.data
@@ -1356,8 +1371,6 @@ struct buf_page_struct{
 					frees a page in buffer pool */
 # endif /* UNIV_DEBUG_FILE_ACCESSES */
 #endif /* !UNIV_HOTBACKUP */
-	buf_pool_t*	buf_pool;	/*!< buffer pool instance this
-					page belongs to */
 };
 
 /** The buffer control block structure */

=== modified file 'storage/innobase/include/buf0buf.ic'
--- a/storage/innobase/include/buf0buf.ic	revid:marko.makela@stripped1027064047-ye93479yw0pw5yfe
+++ b/storage/innobase/include/buf0buf.ic	revid:marko.makela@stripped-lx0nlsth2l750d1o
@@ -46,6 +46,48 @@ buf_pool_get_curr_size(void)
 	return(srv_buf_pool_curr_size);
 }
 
+/********************************************************************//**
+Calculates the index of a buffer pool to the buf_pool[] array.
+@return	the position of the buffer pool in buf_pool[] */
+UNIV_INLINE
+ulint
+buf_pool_index(
+/*===========*/
+	const buf_pool_t*	buf_pool)	/*!< in: buffer pool */
+{
+	ulint	i = buf_pool - buf_pool_ptr;
+	ut_ad(i < MAX_BUFFER_POOLS);
+	ut_ad(i < srv_buf_pool_instances);
+	return(i);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given a page instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_bpage(
+/*================*/
+	const buf_page_t*	bpage) /*!< in: buffer pool page */
+{
+	ulint	i;
+	i = bpage->buf_pool_index;
+	ut_ad(i < srv_buf_pool_instances);
+	return(&buf_pool_ptr[i]);
+}
+
+/******************************************************************//**
+Returns the buffer pool instance given a block instance
+@return buf_pool */
+UNIV_INLINE
+buf_pool_t*
+buf_pool_from_block(
+/*================*/
+	const buf_block_t*	block) /*!< in: block */
+{
+	return(buf_pool_from_bpage(&block->page));
+}
+
 /*********************************************************************//**
 Gets the current size of buffer buf_pool in pages.
 @return size in pages*/
@@ -885,33 +927,6 @@ buf_block_buf_fix_dec(
 }
 
 /******************************************************************//**
-Returns the buffer pool instance given a page instance
-@return buf_pool */
-UNIV_INLINE
-buf_pool_t*
-buf_pool_from_bpage(
-/*================*/
-	const buf_page_t*	bpage) /*!< in: buffer pool page */
-{
-	/* Every page must be in some buffer pool. */
-	ut_ad(bpage->buf_pool != NULL);
-
-	return(bpage->buf_pool);
-}
-
-/******************************************************************//**
-Returns the buffer pool instance given a block instance
-@return buf_pool */
-UNIV_INLINE
-buf_pool_t*
-buf_pool_from_block(
-/*================*/
-	const buf_block_t*	block) /*!< in: block */
-{
-	return(buf_pool_from_bpage(&block->page));
-}
-
-/******************************************************************//**
 Returns the buffer pool instance given space and offset of page
 @return buffer pool */
 UNIV_INLINE
@@ -928,7 +943,7 @@ buf_pool_get(
 	ignored_offset = offset >> 6; /* 2log of BUF_READ_AHEAD_AREA (64)*/
 	fold = buf_page_address_fold(space, ignored_offset);
 	index = fold % srv_buf_pool_instances;
-	return buf_pool_ptr[index];
+	return(&buf_pool_ptr[index]);
 }
 
 /******************************************************************//**
@@ -938,10 +953,12 @@ UNIV_INLINE
 buf_pool_t*
 buf_pool_from_array(
 /*================*/
-	ulint	index) 		/*!< in: array index to get
+	ulint	index)		/*!< in: array index to get
 				buffer pool instance from */
 {
-	return buf_pool_ptr[index];
+	ut_ad(index < MAX_BUFFER_POOLS);
+	ut_ad(index < srv_buf_pool_instances);
+	return(&buf_pool_ptr[index]);
 }
 
 /******************************************************************//**

Attachment: [text/bzr-bundle] bzr/marko.makela@oracle.com-20101027065957-lx0nlsth2l750d1o.bundle
Thread
bzr push into mysql-trunk-innodb branch (marko.makela:3289 to 3290) marko.makela27 Oct