Archive for the ‘InnoDB’ Category

MariaDB 5.5 is now GA

Апрель 17th, 2012

Well, as you or may not have heard, MariaDB 5.5 (5.5.23) was declared GA last week!

It was only about 6-ish weeks ago that MariaDB 5.5 had been released as alpha, so the fact it’s already GA is excellent news for all MariaDB users (and MySQL 5.5 users looking to migrate).

Some of the 5.5 enhancements include:

  • Significantly more efficient thread pool, comparable in functionality to the closed source feature in MySQL Enterprise.
  • Non-blocking client API Library (MWL#192)
  • @@skip_replication option (MWL#234)
  • SphinxSE updated to version 2.0.4.
  • “extended keys” support for XtraDB and InnoDB
  • New INSTALL SONAME statement
  • New LIMIT ROWS EXAMINED optimization.
  • mysql_real_connect() Changes
    In MySQL, and in MariaDB versions before 5.5.21, mysql_real_connect() removes from the MYSQL object any options set with mysql_option() when it fails. Beginning with MariaDB 5.5.21, options are preserved by a failing mysql_real_connect(); use mysql_close(), as normal, to clear them.
    This only has effect if the MYSQL object is reused after a mysql_real_connect() failure (which is unusual). No real-life incompatibilities are expected from this change (it is unlikely that an application would rely on options being automatically removed between connection attempts).

  • The variables replicate_do_*, replicate_ignore_*, and replicate_wild_* have been made dynamic, so they can be changed without requiring a server restart. See Dynamic Replication Variables for more information.
  • Updates to performance schema tables are not stored in binary log and thus not replicated to slaves. This is to ensure that monitoring of the master will not cause a slower performance on all slaves. This also fixes a crash on the slaves.

Here is the official “What is MariaDB 5.5″ page:

http://kb.askmonty.org/en/what-is-mariadb-55

Also of interest:

Release Notes
Changelog
General Info

And as always, if you’d like full support for MariaDB, just contact us at SkySQL.

Hope this helps.

 


PlanetMySQL Voting: Vote UP / Vote DOWN

Percona Live MySQL Conference 2012 – Day 0 Review

Апрель 17th, 2012
Day 0 of the MySQL Conference is a day unlike any other day, it is in fact tutorial day. While regular days of the Percona Live MySQL Conference feature 50 minute sessions, usually split into 40 minute talk and a 5-10 minute question period, tutorials are 3 hour long sessions (with a generous 10 minute break in the [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

Percona Live MySQL Conference 2012 – Day 0 Review

Апрель 17th, 2012
Day 0 of the MySQL Conference is a day unlike any other day, it is in fact tutorial day. While regular days of the Percona Live MySQL Conference feature 50 minute sessions, usually split into 40 minute talk and a 5-10 minute question period, tutorials are 3 hour long sessions (with a generous 10 minute break in the [...]
PlanetMySQL Voting: Vote UP / Vote DOWN

A brief update on NUMA and MySQL

Апрель 17th, 2012

Some time ago, I wrote a rather popular post The MySQL “swap insanity” problem and the effects of the NUMA architecture (if you haven’t read it, stop now and do that!), which described using numactl --interleave=all to balance memory allocation across nodes in a NUMA system.

I should’ve titled it differently

In reality, the problem posed by uneven allocation across nodes under NUMA is not entirely a swapping problem. I titled the previous post as it was and explained it in the way it was explained largely to address a specific problem seen in the MySQL community. However, the problem described actually has very little to do with swap itself. The problem is really related to Linux’s behavior under memory pressure, and specifically the pressure imposed by running a single NUMA node (and especially node 0) completely out of memory.

When swap is disabled completely, problems are still encountered, usually in the form of extremely slow performance and failed memory allocations.

A more thorough solution

The original post also only addressed only one part of the solution: using interleaved allocation. A complete and reliable solution actually requires three things, as we found when implementing this change for production systems at Twitter:

  1. Forcing interleaved allocation with numactl --interleave=all. This is exactly as described previously, and works well.
  2. Flushing Linux’s buffer caches just before mysqld startup with sysctl -q -w vm.drop_caches=3. This helps to ensure allocation fairness, even if the daemon is restarted while significant amounts of data are in the operating system buffer cache.
  3. Forcing the OS to allocate InnoDB’s buffer pool immediately upon startup, using MAP_POPULATE where supported (Linux 2.6.23+), and falling back to memset otherwise. This forces the NUMA node allocation decisions to be made immediately, while the buffer cache is still clean from the above flush.

These changes are implemented in Twitter MySQL 5.5 as the mysqld_safe options numa-interleave and flush-caches, and mysqld option innodb_buffer_pool_populate, respectively.

The results

On a production machine with 144GB of RAM and a 120GB InnoDB buffer pool, all used memory has been allocated within 152 pages (0.00045%) of perfectly balanced across both NUMA nodes:

N0        :     16870335 ( 64.36 GB)
N1        :     16870183 ( 64.35 GB)
active    :           81 (  0.00 GB)
anon      :     33739094 (128.70 GB)
dirty     :     33739094 (128.70 GB)
mapmax    :          221 (  0.00 GB)
mapped    :         1467 (  0.01 GB)

The buffer pool itself was allocated within 4 pages of balanced (line-wrapped for clarity):

2aaaab2db000 interleave=0-1 anon=33358486 dirty=33358486
  N0=16679245 N1=16679241

Much more importantly, these systems have been extremely stable and have not experienced the “random” stalls under heavy load that we had seen before.



PlanetMySQL Voting: Vote UP / Vote DOWN

SkySQL’s Updated Training Schedule

Апрель 11th, 2012

This is just an update to let you know that the new SkySQL Training Schedule is now available online.

The schedule extends as far as September 2012.

There are courses in the Belgium, Germany, France, the United Kingdom, Ireland, the Netherlands, Sweden, and and the United States.

And some of the course titles include:

  • Administering a MySQL® Database
  • Developing Applications with the MySQL® Database
  • Performance Tuning for the MySQL® Database
  • High Availability for the MySQL® Database
  • Administering MySQL® Cluster

You can read the full schedule here:

http://www.skysql.com/services/training/schedule?vdt=training_course_list|page_3

 


PlanetMySQL Voting: Vote UP / Vote DOWN

What is the proper size of InnoDB logs?

Апрель 10th, 2012

In one of my previous posts, “How to resize InnoDB logs?”, I gave the advice on how to safely change the size of transaction logs. This time, I will explain why doing it may become necessary.

A brief introduction to InnoDB transaction logs

The transaction logs handle REDO logging, which means they keep the record of all recent modifications performed by queries in any InnoDB table. But they are a lot more than just an archive of transactions. The logs play important part in the process of handling writes. When a transaction commits, InnoDB synchronously makes a note of any changes into the log, while updating the actual table files happens asynchronously and may take place much later. Each log entry is assigned a Log Sequence Number – an incremental value that always uniquely identifies a change.

InnoDB writes changes to the log as a transaction commits, while updating data in the table file happens asynchronously and may take place much later

 

Such design serves database in two ways.

First, it optimizes MySQL performance. It enables InnoDB to use light sequential I/O to store the modifications on disk as transactions commit and delay expensive random I/O required for data and index updates for when it is more convenient. Buffered updates may be then rearranged or merged in order to further optimize disk access.

And second, after a crash InnoDB can use the logs contents to perform recovery. As updates to the data files are done asynchronously, in the event of an unclean shut down, any modifications that existed only in the buffer pool would be lost. The ability to replay changes from the log deals with the problem.

InnoDB logs are circular, which means that they create a loop. When database reaches the end of the last file (commonly there are two files), it begins writing into the first one again.

When database reaches the end of the last file (commonly there are two files), it begins writing into the first one again.

They are also fixed size, so in order to prevent them from filling, InnoDB implements a background mechanism called checkpointing, which manages the process of synchronizing modified pages to disk (step (3) in the first illustration). As it runs, it marks exactly one log record as checkpoint, which states that all modifications carrying a younger LSN value were already safely stored in data files. This means the log contents prior to that LSN is no longer needed for recovery or any other purpose. As the checkpoint progresses, continuously chasing the most recent LSN, it keeps freeing the log space behind it, which can then be re-used by future writes.

The challenges

What are the main challenges of choosing the right size for InnoDB logs?

Making them small enough to avoid unnecessarily long distance between checkpoint LSN and the most recent LSN to avoid needlessly long recovery times.

With newer MySQL versions this should not be a significant factor anymore as the recovery process has been greatly optimized in MySQL 5.1.46 and in 5.5.

In older versions, however, the process used to be slow and would often needed hours to replay transactions from even medium-sized logs such as 512MB or 1GB, so it is a risk that needs to be evaluated.

Making them large enough to fit writes over sufficiently long period of time, so that InnoDB has some room to maneuver in deciding when to flush some of the buffer pool contents.

When the transaction logs are set too small for given workload, MySQL performance may suffer. During busier periods incoming writes may start pushing LSN faster than checkpoint can progress and the log space will start filling up. After a threshold is exceeded, checkpointing becomes very intense as InnoDB spots the upcoming problem that it may be short of free log space soon. When this doesn’t help, the engine may need to start blocking queries as it is flushing the buffer pool contents and advancing the checkpoint.

When the transaction logs are set too small for given workload, MySQL performance may suffer.

What size works?

When installing a new database, the transaction logs often need to be configured without too much knowledge about future workload. One can simply try choosing a reasonable size such as 64M for a pretty average database. There is no reason to go below this value. Of course, the more writes this new database is expected to take, the larger they may need to be. In any case it is extremely important to always change the default size, which is just two files of 5MB. Such configuration is not sufficient for any serious purpose, so do not ever never allow it even on a development server.

With database already running in testing or in production, the necessary size can be calculated based on the rate at which data is written into the transaction logs as this information is available from MySQL. A good rule says that the logs should be able to hold at least one hour worth of changes. In order to come up with a number, simply check how quickly Log Sequence Number progresses. Be sure not to check this during quiet periods as this has to be tuned for the peak usage.

Calculating the size

The information can be found in InnoDB status output, which you can obtain with SHOW ENGINE INNODB STATUS:

mysql> \P grep 'Log sequence number'
PAGER set to 'grep 'Log sequence number''
mysql> SHOW ENGINE INNODB STATUS\G
Log sequence number 21060750647056
1 row in set (0.06 sec)

Using the command line pager helped limiting the output to only the relevant information.

In reality, LSN value represents an offset from byte zero of the transaction log, so since the database has been initialized. Seeing how it changes essentially means seeing how much data was written into it over a period of time. So to figure out the amount of changes happening to a database:

  • check the most recent LSN using the method shown above
  • wait some time
  • check the LSN again
  • subtract the two values

Here is how to do it in practice:

mysql> \P grep 'Log sequence number'
PAGER set to 'grep 'Log sequence number''
mysql> SHOW ENGINE INNODB STATUS\G SELECT SLEEP(60); SHOW ENGINE INNODB STATUS\G
21057170602213
1 row in set (0.06 sec)

1 row in set (1 min 0.00 sec)

21057190468976
1 row in set (0.05 sec)

The two LSN values are 21057170602213 and 21057190468976. Let’s calculate the difference:

mysql> select ROUND((21057190468976 - 21057170602213)/ 1024 / 1024) as MB;
+------+
| MB   |
+------+
|   19 |
+------+
1 row in set (0.00 sec)

19 megabytes were written into the log file in one minute. Using this information, how large the logs should be to keep at least one hour worth of writes? 19MB * 60 minutes / 2 files = 570MB. The division by two comes from the fact that InnoDB uses two log files by default, while we need to set size for each individual file. Therefore we calculated that this database needs innodb_log_file_size set to at least 512MB.

In MySQL 5.1 or newer, a query against INFORMATION_SCHEMA.GLOBAL_STATUS can be used instead of looking at the InnoDB status output.

SELECT @a1 := variable_value AS a1
FROM information_schema.global_status
WHERE variable_name = 'innodb_os_log_written'
UNION ALL
SELECT Sleep(60)
UNION ALL
SELECT @a2 := variable_value AS a2
FROM information_schema.global_status
WHERE variable_name = 'innodb_os_log_written';

SELECT ROUND((@a2-@a1) * 60 / 1024 / 1024 / @@innodb_log_files_in_group) as MB;

PlanetMySQL Voting: Vote UP / Vote DOWN

How important a primary key can be for MySQL performance?

Апрель 5th, 2012

How important a primary key design can be for MySQL performance? The answer is: Extremely! If tables use InnoDB storage engine, that is.

It all begins with the specific way InnoDB organizes data internally. There are two major pieces of information that anyone should know:

  1. It physically stores rows together with and in the order of primary key values. It means that a primary key does not only uniquely identify a row, it is also part of it. Or perhaps rather, a physical row is part of table’s primary key.
  2. A secondary index entry does not point to the actual row position, which is how it works in MyISAM. Instead, every single index entry is concatenated with a value of the corresponding primary key. When a query reads a row through a secondary index, this added value is used in additional implicit lookup by the primary key, to locate the actual row.

What could be a “rule of the thumb” for InnoDB primary key design, is that it should be as short as possible. Needlessly long values use a lot of space inside the secondary indexes and may degrade performance.

It is also good when primary key is also incremental, i.e. each new row has a value there that is larger than in any other existing row. This does not necessarily imply AUTO_INCREMENT column, which is just one of the possibilities. Because rows are kept in the order of the key, using values that constantly grow means InnoDB may simply “append” rows to a table. It benefits insert performance and prevents fragmentation as data does not have to be moved around to make room for an insert that needs to add a row in the middle of table.

However in some cases it turns out that choosing a simple, short and incremental column for primary key is not the best option when thinking about database scalability. With certain access patterns, especially when reads by range are prevalent, it turns out that longer and more complex design can produce better results in the longer term.

When AUTO_INCREMENT column becomes primary key, rows are placed one after another in the order of insertion. If two rows were added at the interval of 1 hour to a table receiving a constant stream of inserts, there would likely be some physical distance between both of them. I.e. they would be in two different places on disk as many other rows would be added in between these two.

For the sake of example let’s assume two rows were added for a user whose user_id is 50 and they have been assigned with id=10000000 and id=10001000, where id is the primary key in this table. What sort of work the following query has to perform in order to return results?

SELECT * FROM messages WHERE user_id = 50

It finds index entires where user_id is 50. With the primary key values from the secondary index, it can then locate the physical rows. So InnoDB first seeks a row where id is 10000000. But since it does not operate on individual rows at this point, but rather on the blocks of records called pages, it locates the proper page on disk and caches it in the buffer pool. Only then it can extract the actual row, return it, and move on to the next one where id is 10001000. Since the distance between the two records is significant, it turns out that it is not on the same page that was just pulled into the cache and which holds the first row. InnoDB has to go back to disk to fetch another page, cache it, extract the row and return it.

In the above example at least two I/Os were issued. In a pessimistic case for a few hundred matching rows, when a user has that many messages, that could result in a few hundred I/O operations. Random I/O. Assuming as little as a few milliseconds for each operation, the query may need as much as one second to execute. It would use index properly, it would only pull a few hundred rows, but would still perform poorly. With the exception for flash technology any typical storage is rather slow, and also very difficult to scale, so such scenario should be avoided.

Another negative effect, which could be further affecting MySQL performance, is buffer pool pollution. If application asks for a hundred rows and each of them resides on a different page, InnoDB will need to load one hundred pages that may be irrelevant to all other queries. When the buffer is full, loading anything new into it means dropping some of the existing information. That way InnoDB cache may fill with a lot of data that isn’t actually needed.

What if the primary key was different?

For example a composite key on pair of columns (user_id, id). In such case every row sharing common value in user_id would be stored next to each other. In other words, all messages belonging to a single user would be kept together on one or maybe just a few pages. How would the example query execute now?

SELECT * FROM messages WHERE user_id = 50

Execution begins the same way, however after finding the first matching row, it turns out the other row that the query is looking for, is actually on the same page that was loaded into the buffer pool just a moment earlier. So instead of two I/O operations, one was enough. What if there were a few hundred rows to read? One or maybe a few reads instead of hundreds. That is a significant gain.

Additional gain is that the query no longer needs to do the extra lookup through the secondary index and with the lower overhead it can execute even faster. Querying InnoDB tables by primary key values is faster, which is different from MyISAM where it does not matter for performance whether access is by primary or secondary keys.

More? Improved data locality not only improves this query performance. It also allows more efficient use of memory, which results in caching more relevant information and thus improves overall MySQL performance.

Why (user_id, id)? Using user_id alone would not be possible, because primary key enforces uniqueness, while each user may have many rows. With id being a unique incremental column also some inserts may still see improved performance. For example if application inserted ten rows all for the same user, they would possibly be stored on a single page.

When designing an InnoDB table you have to think ahead. None of this matters when database is small, but it can make a tremendous difference once data grows sufficiently. Unfortunately many solutions, which developers use to build applications, completely miss this. Out of many frameworks I know, very few even support composite primary keys through their CRUD modules. On the other hand, thanks to this performance consultants have so much work ;-)


PlanetMySQL Voting: Vote UP / Vote DOWN

List MySQL Indexes With INFORMATION_SCHEMA

Апрель 4th, 2012

Have you ever wanted to get a list of indexes and their columns for all tables in a MySQL database without having to iterate over SHOW INDEXES FROM ‘[table]‘? Here are a couple ways…

The following query using the INFORMATION_SCHEMA STATISTICS table will work prior to MySQL GA 5.6 and Percona Server 5.5.

SELECT table_name AS `Table`,
       index_name AS `Index`,
       GROUP_CONCAT(column_name ORDER BY seq_in_index) AS `Columns`
FROM information_schema.statistics
WHERE table_schema = 'sakila'
GROUP BY 1,2
ORDER BY 1,2;

This query uses the INNODB_SYS_TABLES, INNODB_SYS_INDEXES, and INNODB_SYS_FIELDS tables from INFORMATION_SCHEMA and is only available in MySQL 5.6 or Percona Server 5.5. However, it is much much faster than querying the STATISTICS table. It also only shows InnoDB tables.

SELECT t.name AS `Table`,
       i.name AS `Index`,
       GROUP_CONCAT(f.name ORDER BY f.pos) AS `Columns`
FROM information_schema.innodb_sys_tables t
JOIN information_schema.innodb_sys_indexes i USING (table_id)
JOIN information_schema.innodb_sys_fields f USING (index_id)
WHERE t.schema = 'sakila'
GROUP BY 1,2
ORDER BY 1,2;

Assuming that all your tables are InnoDB, both queries will produce identical results. If you have some MyISAM tables in there, only the first query will provide complete results.

+---------------+-----------------------------+--------------------------------------+
| Table         | Index                       | Columns                              |
+---------------+-----------------------------+--------------------------------------+
| actor         | idx_actor_last_name         | last_name                            |
| actor         | PRIMARY                     | actor_id                             |
| address       | idx_fk_city_id              | city_id                              |
| address       | PRIMARY                     | address_id                           |
| category      | PRIMARY                     | category_id                          |
| city          | idx_fk_country_id           | country_id                           |
...
| rental        | rental_date                 | rental_date,inventory_id,customer_id |
| staff         | idx_fk_address_id           | address_id                           |
| staff         | idx_fk_store_id             | store_id                             |
| staff         | PRIMARY                     | staff_id                             |
| store         | idx_fk_address_id           | address_id                           |
| store         | idx_unique_manager          | manager_staff_id                     |
| store         | PRIMARY                     | store_id                             |
+---------------+-----------------------------+--------------------------------------+
42 rows in set (0.04 sec)

PlanetMySQL Voting: Vote UP / Vote DOWN

List MySQL Indexes With INFORMATION_SCHEMA

Апрель 4th, 2012

Have you ever wanted to get a list of indexes and their columns for all tables in a MySQL database without having to iterate over SHOW INDEXES FROM ‘[table]‘? Here are a couple ways…

The following query using the INFORMATION_SCHEMA STATISTICS table will work prior to MySQL GA 5.6 and Percona Server 5.5.

SELECT table_name AS `Table`,
       index_name AS `Index`,
       GROUP_CONCAT(column_name ORDER BY seq_in_index) AS `Columns`
FROM information_schema.statistics
WHERE table_schema = 'sakila'
GROUP BY 1,2
ORDER BY 1,2;

This query uses the INNODB_SYS_TABLES, INNODB_SYS_INDEXES, and INNODB_SYS_FIELDS tables from INFORMATION_SCHEMA and is only available in MySQL 5.6 or Percona Server 5.5. However, it is much much faster than querying the STATISTICS table. It also only shows InnoDB tables.

SELECT t.name AS `Table`,
       i.name AS `Index`,
       GROUP_CONCAT(f.name ORDER BY f.pos) AS `Columns`
FROM information_schema.innodb_sys_tables t
JOIN information_schema.innodb_sys_indexes i USING (table_id)
JOIN information_schema.innodb_sys_fields f USING (index_id)
WHERE t.schema = 'sakila'
GROUP BY 1,2
ORDER BY 1,2;

Assuming that all your tables are InnoDB, both queries will produce identical results. If you have some MyISAM tables in there, only the first query will provide complete results.

+---------------+-----------------------------+--------------------------------------+
| Table         | Index                       | Columns                              |
+---------------+-----------------------------+--------------------------------------+
| actor         | idx_actor_last_name         | last_name                            |
| actor         | PRIMARY                     | actor_id                             |
| address       | idx_fk_city_id              | city_id                              |
| address       | PRIMARY                     | address_id                           |
| category      | PRIMARY                     | category_id                          |
| city          | idx_fk_country_id           | country_id                           |
...
| rental        | rental_date                 | rental_date,inventory_id,customer_id |
| staff         | idx_fk_address_id           | address_id                           |
| staff         | idx_fk_store_id             | store_id                             |
| staff         | PRIMARY                     | staff_id                             |
| store         | idx_fk_address_id           | address_id                           |
| store         | idx_unique_manager          | manager_staff_id                     |
| store         | PRIMARY                     | store_id                             |
+---------------+-----------------------------+--------------------------------------+
42 rows in set (0.04 sec)

PlanetMySQL Voting: Vote UP / Vote DOWN

How to resize InnoDB logs?

Апрель 4th, 2012

If for any reason you need to change the size of InnoDB log files (also known as transaction logs), but not sure how to do it, this post will guide you through the steps.

Step 1: Preflight checks

Something to keep in mind

Database restart is needed as part of this process.

Locate your MySQL configuration file

If you don’t know where the configuration file is, you can follow one of my previous posts on “How to find MySQL configuration file?”.

Find the existing logs and check their size

If database is running, you can simply use a tool called lsof:

db01 ~ # lsof -c mysqld | grep ib_logfile
mysqld    15153 mysql    9uW     REG                8,3 5242880 19350809 /var/lib/mysql/ib_logfile0
mysqld    15153 mysql   10uW     REG                8,3 5242880 19350810 /var/lib/mysql/ib_logfile1

lsof not only shows paths, but also the file sizes (marked in red).

Check InnoDB shutdown mode

Check the value of SHOW GLOBAL VARIABLES LIKE 'innodb_fast_shutdown'. The setting determines how InnoDB performs shutdown. If you are running on MySQL 5.0 or newer, it is a very important step, so do not forget about it.

innodb_fast_shutdown can be configured one of three different values:

  • 0 – InnoDB will clean up old and redundant data and perform insert buffer merge before shutting down.
  • 1 – A fast shutdown which skips the above tasks. It’s also the default one.
  • 2 – Performs a controlled “crash”.

If innodb_fast_shutdown is set either to 0 or 1, you can proceed to the next step. Otherwise change it:

mysql> SET GLOBAL innodb_fast_shutdown=1;
Query OK, 0 rows affected (0.00 sec)

Remember! You must not proceed with innodb_fast_shutdown set to 2!

Now you are ready to go.

Step 2: InnoDB log files resize procedure

Shut down MySQL
db01 ~ # /etc/init.d/mysql stop
 * Stopping mysql ...
 * Stopping mysqld (0)              [ ok ]

Check database error log to ensure that there were no problems with shut down. Specifically you are interested seeing the following sequence:

120403 13:47:04  InnoDB: Starting shutdown...
120403 13:47:06  InnoDB: Shutdown completed; log sequence number 1091449
120403 13:47:06 [Note] /usr/sbin/mysqld: Shutdown complete
Rename the existing transaction logs

For safety reasons you don’t want to remove the existing files at this point. If anything goes wrong, restoring them may be the only way to resurrect your database. So instead you should just rename them:

db01 ~ # find /var/lib/mysql -type f -name "ib_logfile?" -exec mv {} {}_OLD \;

In find specify the path where lsof showed the logs were. Verify that they were indeed renamed:

db01 ~ # ls -la /var/lib/mysql/ib_logfile*
-rw-rw---- 1 mysql mysql 5242880 Apr  3 01:24 /var/lib/mysql/ib_logfile0_OLD
-rw-rw---- 1 mysql mysql 5242880 Jan 31  2010 /var/lib/mysql/ib_logfile1_OLD
Reconfigure MySQL

Use your favorite editor to update the MySQL configuration file. Either add or set innodb_log_file_size parameter to the desired value. If you do not know what value to use, 64M is often a good default. Here is how it looks in my configuration file:

db01 ~ # grep innodb_log_file_size /etc/my.cnf
innodb_log_file_size = 64M
Restart MySQL instance

During start InnoDB will create new set of logs.

db01 ~ # /etc/init.d/mysql start
 * Starting mysql ...
 * Starting mysql (/etc/mysql/my.cnf)             [ ok ]

As usual, please monitor database error log. You should see output similar to this one:

[..]
120403  1:34:18  InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 64 MB
InnoDB: Database physically writes the file full: wait...
120403  1:34:19  InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 64 MB
InnoDB: Database physically writes the file full: wait...
[..]

Step 3: Done!

Your database should now be running on a new set of InnoDB logs.


PlanetMySQL Voting: Vote UP / Vote DOWN