← Back to team overview

ourdelta-developers team mailing list archive

[Bug 303124] Re: Feature req: innodb_log_file_size smarter on startup

 

(sorry, mistake in the feedback to the system variables, fixed patch
below)

In a nutshell, this patch allows the default log file size to be changed
(in the compiled-in default, or my.cnf) for new installations, without
breaking existing installations.

It does the following: if the iblogfiles already exist, and size differs
from innodb_log_file_size, issue a warning but not abort; it'll also
update the system variable with the actual log file size.

For an existing installation, the user can simply update the my.cnf with
the actual file size to get rid of the warning, or do the procedure for
changing the log file size.

=== modified file 'storage/xtradb/handler/ha_innodb.cc'
--- storage/xtradb/handler/ha_innodb.cc	2009-09-09 21:06:57 +0000
+++ storage/xtradb/handler/ha_innodb.cc	2009-10-14 03:40:05 +0000
@@ -2405,6 +2405,10 @@
 	/* Get the current high water mark format. */
 	innobase_file_format_check = (char*) trx_sys_file_format_max_get();
 
+	/* Get the current log file size. */
+	innobase_log_file_size = srv_log_file_size;
+	innobase_log_file_size *= UNIV_PAGE_SIZE;
+
 	DBUG_RETURN(FALSE);
 error:
 	DBUG_RETURN(TRUE);

=== modified file 'storage/xtradb/srv/srv0start.c'
--- storage/xtradb/srv/srv0start.c	2009-09-16 17:43:01 +0000
+++ storage/xtradb/srv/srv0start.c	2009-10-14 03:26:54 +0000
@@ -547,6 +547,21 @@
 }
 
 /*************************************************************************
+Calculates the number of database pages which are represented by the
+file size in bytes. */
+static
+ulint
+srv_calc_pages(
+/*============*/
+				/* out: file size in database pages */
+	ulint	size,		/* in: low 32 bits of file size in bytes */
+	ulint	size_high)	/* in: high 32 bits of file size in bytes */
+{
+	return((size >> UNIV_PAGE_SIZE_SHIFT)
+		| (size_high << (32 - UNIV_PAGE_SIZE_SHIFT));
+}
+
+/*************************************************************************
 Creates or opens the log files and closes them. */
 static
 ulint
@@ -623,7 +638,12 @@
 				(ulong) srv_calc_high32(srv_log_file_size),
 				(ulong) srv_calc_low32(srv_log_file_size));
 
-			return(DB_ERROR);
+			if (log_file_has_been_opened) {
+
+				return(DB_ERROR);
+			}
+
+			srv_log_file_size = srv_calc_pages(size, size_high);
 		}
 	} else {
 		*log_file_created = TRUE;

-- 
Feature req: innodb_log_file_size smarter on startup
https://bugs.launchpad.net/bugs/303124
You received this bug notification because you are a member of OurDelta-
developers, which is the registrant for OurDelta.

Status in OurDelta - Builds for MySQL,MariaDB: Fix Committed
Status in Patches for MySQL by Percona: Confirmed

Bug description:
Feature request:
On InnoDB startup, check whether the iblog files exist, and what size they are.
Feed that size back into the innodb_log_file_size, regardless of what it was.
If it was different, you can write a warning to errorlog, but no error/abort.

This little tweak would allow us to increase the default log file size, without breaking existing installations.



References