List:Commits« Previous MessageNext Message »
From:Annamalai Gurusami Date:December 28 2011 8:38am
Subject:bzr push into mysql-trunk branch (annamalai.gurusami:3691 to 3692)
Bug#13255225
View as plain text  
 3692 Annamalai Gurusami	2011-12-28
      Bug #13255225: THE VALUE OF INNODB_UNDO_LOGS IN MY.CNF IS IGNORED
      
      Introduced a new read only status variable srv_available_undo_logs.  
      During startup, this variable will be set to the total available 
      number of rollback segments.  Users can access this variable to find
      out the available number of rollback segments.  The innodb_undo_logs
      will contain the number of active rollback segments. 
      
      Review Board link:
      http://bur03.no.oracle.com/rb/r/862/

    modified:
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/include/srv0srv.h
      storage/innobase/srv/srv0srv.cc
      storage/innobase/srv/srv0start.cc
 3691 Marko Mäkelä	2011-12-27
      Correct the comment of rw_lock_x_lock_low().

    modified:
      storage/innobase/sync/sync0rw.cc
=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@stripped
+++ b/storage/innobase/handler/ha_innodb.cc	revid:annamalai.gurusami@stripped
@@ -569,6 +569,8 @@ static SHOW_VAR innodb_status_variables[
   (char*) &export_vars.innodb_num_open_files,		  SHOW_LONG},
   {"truncated_status_writes",
   (char*) &export_vars.innodb_truncated_status_writes,	  SHOW_LONG},
+  {"available_undo_logs",
+  (char*) &export_vars.innodb_available_undo_logs,        SHOW_LONG},
   {NullS, NullS, SHOW_LONG}
 };
 
@@ -13315,6 +13317,39 @@ innodb_change_buffer_max_size_update(
 	ibuf_max_size_update(innobase_change_buffer_max_size);
 }
 
+/********************************************************************
+Check if innodb_undo_logs is valid. This function is registered as
+a callback with MySQL.
+@return	0 for valid innodb_undo_logs
+@see mysql_var_check_func */
+static
+int
+innodb_undo_logs_validate(
+/*======================*/
+	THD*				thd,	/*!< in: thread handle */
+	struct st_mysql_sys_var*	var,	/*!< in: ptr to sys var */
+	void*				save,	/*!< out: immediate result
+						for update function */
+	struct st_mysql_value*		value)	/*!< in: incoming string */
+{
+        long long rsegs;
+
+	DBUG_ENTER("innodb_undo_logs_validate");
+
+	DBUG_ASSERT(save != NULL);
+	DBUG_ASSERT(value != NULL);
+	DBUG_ASSERT(srv_available_undo_logs <= TRX_SYS_N_RSEGS);
+
+	value->val_int(value, &rsegs);
+
+        if (rsegs > (long long) srv_available_undo_logs) {
+		rsegs = srv_available_undo_logs;
+	}
+	*reinterpret_cast<ulint*>(save) = static_cast<ulint>(rsegs);
+
+	DBUG_RETURN(0);
+}
+
 /*************************************************************//**
 Find the corresponding ibuf_use_t value that indexes into
 innobase_change_buffering_values[] array for the input
@@ -14664,7 +14699,7 @@ static MYSQL_SYSVAR_ULONG(undo_tablespac
 static MYSQL_SYSVAR_ULONG(undo_logs, srv_undo_logs,
   PLUGIN_VAR_OPCMDARG,
   "Number of undo logs to use.",
-  NULL, NULL,
+  innodb_undo_logs_validate, NULL,
   TRX_SYS_N_RSEGS,	/* Default setting */
   1,			/* Minimum value */
   TRX_SYS_N_RSEGS, 0);	/* Maximum value */
@@ -15181,3 +15216,5 @@ ha_innobase::idx_cond_push(
 	/* We will evaluate the condition entirely */
 	DBUG_RETURN(NULL);
 }
+
+

=== modified file 'storage/innobase/include/srv0srv.h'
--- a/storage/innobase/include/srv0srv.h	revid:marko.makela@stripped53956-ubfj3r4uhb2i59eo
+++ b/storage/innobase/include/srv0srv.h	revid:annamalai.gurusami@stripped-xg77doxtvsura8t9
@@ -289,6 +289,7 @@ extern ibool	srv_priority_boost;
 extern ulint	srv_n_lock_wait_count;
 
 extern ulint	srv_truncated_status_writes;
+extern ulint	srv_available_undo_logs;
 
 extern	ulint	srv_mem_pool_size;
 extern	ulint	srv_lock_table_size;
@@ -791,6 +792,7 @@ struct export_var_struct{
 	ulint innodb_rows_deleted;		/*!< srv_n_rows_deleted */
 	ulint innodb_num_open_files;		/*!< fil_n_file_opened */
 	ulint innodb_truncated_status_writes;	/*!< srv_truncated_status_writes */
+	ulint innodb_available_undo_logs;       /*!< srv_available_undo_logs */
 };
 
 /** Thread slot in the thread table.  */

=== modified file 'storage/innobase/srv/srv0srv.cc'
--- a/storage/innobase/srv/srv0srv.cc	revid:marko.makela@stripped-20111227153956-ubfj3r4uhb2i59eo
+++ b/storage/innobase/srv/srv0srv.cc	revid:annamalai.gurusami@stripped8083708-xg77doxtvsura8t9
@@ -386,6 +386,7 @@ static ulint		srv_n_rows_deleted_old		=
 static ulint		srv_n_rows_read_old		= 0;
 
 UNIV_INTERN ulint	srv_truncated_status_writes	= 0;
+UNIV_INTERN ulint	srv_available_undo_logs         = 0;
 
 /* Set the following to 0 if you want InnoDB to write messages on
 stderr on startup/shutdown. */
@@ -1368,6 +1369,7 @@ srv_export_innodb_status(void)
 	export_vars.innodb_rows_deleted = srv_n_rows_deleted;
 	export_vars.innodb_num_open_files = fil_n_file_opened;
 	export_vars.innodb_truncated_status_writes = srv_truncated_status_writes;
+	export_vars.innodb_available_undo_logs = srv_available_undo_logs;
 
 	mutex_exit(&srv_innodb_monitor_mutex);
 }

=== modified file 'storage/innobase/srv/srv0start.cc'
--- a/storage/innobase/srv/srv0start.cc	revid:marko.makela@stripped
+++ b/storage/innobase/srv/srv0start.cc	revid:annamalai.gurusami@stripped
@@ -2170,12 +2170,11 @@ innobase_start_or_create_for_mysql(void)
 	ut_a(srv_undo_logs > 0);
 	ut_a(srv_undo_logs <= TRX_SYS_N_RSEGS);
 
-	/* Note: We set the config variable here to the number of rollback
-	segments that are actually active. This allows the user to discover
-	the currently configured number of undo segments in an existing
-	instance. */
+	/* The number of rsegs that exist in InnoDB is given by status
+	variable srv_available_undo_logs. The number of rsegs to use can
+	be set using the dynamic global variable srv_undo_logs. */
 
-	srv_undo_logs = trx_sys_create_rsegs(
+	srv_available_undo_logs = trx_sys_create_rsegs(
 		srv_undo_tablespaces, srv_undo_logs);
 
 	/* Create the thread which watches the timeouts for lock waits */

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (annamalai.gurusami:3691 to 3692)Bug#13255225Annamalai Gurusami29 Dec