From f5c5d23a209c0e193c369220dade6261bb71a561 Mon Sep 17 00:00:00 2001
From: Jimmy Yang <jimmy.yang@oracle.com>
Date: Wed, 10 Nov 2010 21:27:10 -0800
Subject: [PATCH] Port fix for Bug #48026 to 5.1 built-in and plugin: Log start
 and end of InnoDB buffer pool initialization to the error log

---
 storage/innobase/srv/srv0start.c      | 22 ++++++++++++++++++++++
 storage/innodb_plugin/ChangeLog       |  6 ++++++
 storage/innodb_plugin/srv/srv0start.c | 20 ++++++++++++++++++++
 3 files changed, 48 insertions(+)

diff --git a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
index 9d057110d1..4c4360f819 100644
--- a/storage/innobase/srv/srv0start.c
+++ b/storage/innobase/srv/srv0start.c
@@ -1247,6 +1247,23 @@ innobase_start_or_create_for_mysql(void)
 
 	fil_init(srv_max_n_open_files);
 
+	/* Print time to initialize the buffer pool */
+	ut_print_timestamp(stderr);
+	fprintf(stderr,
+		"  InnoDB: Initializing buffer pool, size =");
+
+	if (srv_pool_size * UNIV_PAGE_SIZE >= 1024 * 1024 * 1024) {
+		fprintf(stderr,
+			" %.1fG\n",
+			((double) (srv_pool_size * UNIV_PAGE_SIZE))
+				 / (1024 * 1024 * 1024));
+	} else {
+		fprintf(stderr,
+			" %.1fM\n",
+			((double) (srv_pool_size * UNIV_PAGE_SIZE))
+				 / (1024 * 1024));
+	}
+
 	if (srv_use_awe) {
 		fprintf(stderr,
 			"InnoDB: Using AWE: Memory window is %lu MB"
@@ -1267,6 +1284,8 @@ innobase_start_or_create_for_mysql(void)
 				    srv_pool_size);
 	}
 
+	ut_print_timestamp(stderr);
+
 	if (ret == NULL) {
 		fprintf(stderr,
 			"InnoDB: Fatal error: cannot allocate the memory"
@@ -1275,6 +1294,9 @@ innobase_start_or_create_for_mysql(void)
 		return(DB_ERROR);
 	}
 
+	fprintf(stderr,
+		"  InnoDB: Completed initialization of buffer pool\n");
+
 	fsp_init();
 	log_init();
 
diff --git a/storage/innodb_plugin/ChangeLog b/storage/innodb_plugin/ChangeLog
index f99c49d63f..eaf16a923d 100644
--- a/storage/innodb_plugin/ChangeLog
+++ b/storage/innodb_plugin/ChangeLog
@@ -1,3 +1,9 @@
+2010-11-10	The InnoDB Team
+
+	* srv/srv0start.c:
+	Fix Bug #48026 Log start and end of InnoDB buffer pool
+	initialization to the error log
+
 2010-11-03	The InnoDB Team
 
 	* include/btr0btr.h, include/btr0btr.ic, dict/dict0crea.c:
diff --git a/storage/innodb_plugin/srv/srv0start.c b/storage/innodb_plugin/srv/srv0start.c
index f823b72fbc..73f8f31970 100644
--- a/storage/innodb_plugin/srv/srv0start.c
+++ b/storage/innodb_plugin/srv/srv0start.c
@@ -1286,8 +1286,25 @@ innobase_start_or_create_for_mysql(void)
 	fil_init(srv_file_per_table ? 50000 : 5000,
 		 srv_max_n_open_files);
 
+	/* Print time to initialize the buffer pool */
+	ut_print_timestamp(stderr);
+	fprintf(stderr,
+		"  InnoDB: Initializing buffer pool, size =");
+
+	if (srv_buf_pool_size >= 1024 * 1024 * 1024) {
+		fprintf(stderr,
+			" %.1fG\n",
+			((double) srv_buf_pool_size) / (1024 * 1024 * 1024));
+	} else {
+		fprintf(stderr,
+			" %.1fM\n",
+			((double) srv_buf_pool_size) / (1024 * 1024));
+	}
+
 	ret = buf_pool_init();
 
+	ut_print_timestamp(stderr);
+
 	if (ret == NULL) {
 		fprintf(stderr,
 			"InnoDB: Fatal error: cannot allocate the memory"
@@ -1296,6 +1313,9 @@ innobase_start_or_create_for_mysql(void)
 		return(DB_ERROR);
 	}
 
+	fprintf(stderr,
+		"  InnoDB: Completed initialization of buffer pool\n");
+
 #ifdef UNIV_DEBUG
 	/* We have observed deadlocks with a 5MB buffer pool but
 	the actual lower limit could very well be a little higher. */
-- 
2.30.9