Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue changing innodb_log_file_size

Tags:

mysql

innodb

I haven't done much tweaking in the past so this might be relatively easy however I am running into issues. This is what I do:

  1. Stop MySQL
  2. Edit my.cnf (changing innodb_log_file_size)
  3. Remove ib_logfile0/1
  4. Start MySQL

Starts fine however all InnoDB tables have the .frm file is invalid error, the status shows InnoDB engine is disabled so I obviously go back, remove the change and everything works again.

I was able to change every other variable I've tried but I can't seem to find out why InnoDB fails to start even after removing the log files. Am I missing something?

Thanks.

Edit: Pasting of the log below - looks like it still seems to find the log file even though they are not there?

Shutdown:

090813 10:00:14  InnoDB: Starting shutdown...
090813 10:00:17  InnoDB: Shutdown completed; log sequence number 0 739268981
090813 10:00:17 [Note] /usr/sbin/mysqld: Shutdown complete

Startup after making the changes:

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!
090813 11:00:18 [Warning] 'user' entry '[email protected]' ignored in --skip-name-resolve mode.
090813 11:00:18 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.0.81-community-log'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Edition (GPL)
090813 11:00:19 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './XXXX/User.frm'
090813 11:00:19 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './XXXX/User.frm'
090813 11:00:19 [ERROR] /usr/sbin/mysqld: Incorrect information in file: './XXXX/User.frm'

Its just a spam of the same error until I correct it

When it did start after it recreated the log files so it must be looking in the same spot I am.

like image 345
savageguy Avatar asked Aug 13 '09 16:08

savageguy


People also ask

Can I change innodb_ log_ file_ size?

Answer. Connect to a Plesk server via SSH. Under the [mysqld] section, change the innodb_log_file_size value according to your needs (the default value is 48M): Note: If the innodb_log_file_size directive does not exist in the file, add it manually under the [mysqld] section.

What is innodb_log_file_size?

innodb_log_file_size is the size of a log file (in bytes). There exist multiple log file for MySQL to write the data to. This particular system-variable tells the file size of one of such log files.

What is Innodb_purge_threads?

innodb_purge_threads. This parameter defines the number of background threads that MySQL uses for the innoDB purge operation. This parameter has a minimum value of 1, so the purge operation is always performed by a background thread and never as a part of the master thread.

What is Innodb_buffer_pool_instances?

If innodb_buffer_pool_size is set to more than 1GB, innodb_buffer_pool_instances divides the InnoDB buffer pool into a specific number of instances. The default was 1 in MariaDB 5.5, but for large systems with buffer pools of many gigabytes, many instances can help reduce contention concurrency.


1 Answers

First, I must point that before any chage in InnoDB data files, one should read 13.2.5. Adding, Removing, or Resizing InnoDB Data and Log Files.

The steps you pointed are almost correct. It´s recommended to backup before this types of changes. Lets see what happened to you:

The error messages

InnoDB: Error: log file ./ib_logfile0 is of different size 0 5242880 bytes
InnoDB: than specified in the .cnf file 0 268435456 bytes!

are caused by changing the size of innodb_log_file_size and dont deleting the old files. Probably you forgot to delete de ib_logfile0/1 the first time you ran mysqld after the changing. The message

090813 11:00:18 [Note] /usr/sbin/mysqld: ready for connections.

shows that you resolved this problem (by removing ib_logfiles). But, on removing them you create the other problem. Data corrupt for XXXX\User.frm or some problem with InnoDB Engine.

To be sure that InnoDB is enabled, run this command on a mysql prompt:

show variables like "%inno%";

In the result list must have "have_innodb = YES". Sometimes when InnoDB can not start (value is NO or DISABLED) the Incorrect information in file message appears.
- If this is the problem, you have changed something else that prevents InnoDB Engine to start properly (datadir´s permissions or tmpdir´s permissions, other innodb variables (you didnt show the complete log.), etc.). Review the changes or put the .cnf files (before and after).
- If the InnoDB Engine is YES then you have to repair the table. (If it´s this case, add a comment and I´ll add the information here. I´m too lazy to do it now.)

like image 167
Leonel Martins Avatar answered Oct 16 '22 07:10

Leonel Martins