Thread:Project:Support desk/database is suffering from InnoDB corruption, specifically in the mw objectcache table.

I've been having some MySQL issues, and it appears to be stemming from the mediawiki db. Below the message I received from my server support, thoughts? The mediawiki db is patjk_wikidb.

I've checked for CREATE DATABASE statements for each of the affected databases:

root@host [~/support/462326]# zcat databases_with_innodb.sql.gz | grep 'CREATE DATABASE' CREATE DATABASE /*!32312 IF NOT EXISTS*/ `horde` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `patjk_gallery2` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `patjk_magen` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `patjk_vbdb` /*!40100 DEFAULT CHARACTER SET latin1 */; CREATE DATABASE /*!32312 IF NOT EXISTS*/ `patjk_wikidb` /*!40100 DEFAULT CHARACTER SET latin1 */;

Unfortunately, it looks like the roundcube database is not present, and the patjk_wikidb is likely to be truncated. Here are the errors that occurred:

root@host [~/support/462326]# cat mysqldump_error.log Warning: option 'max_allowed_packet': unsigned value 1331691520000 adjusted to 2147483648 mysqldump: Error 2013: Lost connection to MySQL server during query when dumping table `mw_objectcache` at row: 1697279

According to MySQL's internal uptime clock the database was started roughly 48 minutes ago, which was just before I noticed that the dump was no longer running:


 * Uptime | 2915 |

Here are the MySQL error log messages that coincided with the apparent failure:

2014-07-27 05:30:43 29972 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.6.16' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL) 2014-07-27 06:46:57 76670b90 InnoDB: Assertion failure in thread 1986464656 in file btr0pcur.cc line 432 InnoDB: Failing assertion: btr_page_get_prev(next_page, mtr) == buf_block_get_page_no(btr_pcur_get_block(cursor)) InnoDB: We intentionally generate a memory trap. InnoDB: Submit a detailed bug report to http://bugs.mysql.com. InnoDB: If you get repeated assertion failures or crashes, even InnoDB: immediately after the mysqld startup, there may be InnoDB: corruption in the InnoDB tablespace. Please refer to InnoDB: http://dev.mysql.com/doc/refman/5.6/en/forcing-innodb-recovery.html InnoDB: about forcing recovery. 10:46:57 UTC - mysqld got signal 6 ; This could be because you hit a bug. It is also possible that this binary or one of the libraries it was linked against is corrupt, improperly built, or misconfigured. This error can also be caused by malfunctioning hardware. We will try our best to scrape up some info that will hopefully help diagnose the problem, but since we have already crashed, something is definitely wrong and this may fail.

key_buffer_size=134217728 read_buffer_size=10485760 max_used_connections=151 max_threads=150 thread_count=151 connection_count=150 It is possible that mysqld could use up to key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 1975685 K bytes of memory Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x77452f00 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 76670358 thread_stack 0x30000 /usr/sbin/mysqld(my_print_stacktrace+0x33)[0x856d843] /usr/sbin/mysqld(handle_fatal_signal+0x43e)[0x82897ee] /lib/libpthread.so.0[0xb7f740f8] /lib/ld-linux.so.2[0xb7f8b7f2] /lib/libc.so.6(gsignal+0x50)[0xb7cd0e30] /lib/libc.so.6(abort+0x101)[0xb7cd2741] /usr/sbin/mysqld[0x8709605] /usr/sbin/mysqld[0x869ee49] /usr/sbin/mysqld[0x85dfa87] /usr/sbin/mysqld[0x85dfd31] /usr/sbin/mysqld(_ZN7handler11ha_rnd_nextEPh+0x75)[0x81987f5] /usr/sbin/mysqld(_Z13rr_sequentialP11READ_RECORD+0x49)[0x84860c9] /usr/sbin/mysqld(_Z10sub_selectP4JOINP13st_join_tableb+0x16a)[0x82f190a] /usr/sbin/mysqld(_ZN4JOIN4execEv+0x3c6)[0x82ef5d6] /usr/sbin/mysqld[0x833d58d] /usr/sbin/mysqld(_Z12mysql_selectP3THDP10TABLE_LISTjR4ListI4ItemEPS4_P10SQL_I_ListI8st_orderESB_S7_yP13select_resultP18st_select_lex_unitP13st_select_lex+0xed)[0x833d92d] /usr/sbin/mysqld(_Z13handle_selectP3THDP13select_resultm+0x19d)[0x833db8d] /usr/sbin/mysqld[0x8312a7b] /usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x4cf5)[0x83189f5] /usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x32d)[0x831da7d] /usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x191c)[0x831fd8c] /usr/sbin/mysqld(_Z10do_commandP3THD+0xee)[0x832182e] /usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0x135)[0x82e33c5] /usr/sbin/mysqld(handle_one_connection+0x4d)[0x82e34ad] /usr/sbin/mysqld(pfs_spawn_thread+0x179)[0x85b8dc9] /lib/libpthread.so.0[0xb7f6b912] /lib/libc.so.6(clone+0x5e)[0xb7d7d7ce]

Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (b7fed08): SELECT /*!40001 SQL_NO_CACHE */ * FROM `mw_objectcache` Connection ID (thread ID): 3089 Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash. 140727 06:46:58 mysqld_safe Number of processes running now: 0 140727 06:46:58 mysqld_safe mysqld restarted 2014-07-27 06:47:00 0 [Warning] Using unique option prefix key_buffer instead of key_buffer_size is deprecated and will be removed in a future release. Please use the full name instead. 2014-07-27 06:47:00 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details). 2014-07-27 06:47:00 30625 [Note] Plugin 'FEDERATED' is disabled. 2014-07-27 06:47:00 30625 [Note] InnoDB: Using mutexes to ref count buffer pool pages 2014-07-27 06:47:00 30625 [Note] InnoDB: The InnoDB memory heap is disabled 2014-07-27 06:47:00 30625 [Note] InnoDB: Mutexes and rw_locks use InnoDB's own implementation 2014-07-27 06:47:00 30625 [Note] InnoDB: Compressed tables use zlib 1.2.3 2014-07-27 06:47:00 30625 [Note] InnoDB: Using Linux native AIO 2014-07-27 06:47:00 30625 [Note] InnoDB: Not using CPU crc32 instructions 2014-07-27 06:47:00 30625 [Note] InnoDB: Initializing buffer pool, size = 128.0M 2014-07-27 06:47:00 30625 [Note] InnoDB: Completed initialization of buffer pool 2014-07-27 06:47:00 30625 [Note] InnoDB: Highest supported file format is Barracuda. 2014-07-27 06:47:00 30625 [Note] InnoDB: The log sequence numbers 133808751880 and 133808751880 in ibdata files do not match the log sequence number 133810301875 in the ib_logfiles! 2014-07-27 06:47:00 30625 [Note] InnoDB: Database was not shutdown normally! 2014-07-27 06:47:00 30625 [Note] InnoDB: Starting crash recovery. 2014-07-27 06:47:00 30625 [Note] InnoDB: Reading tablespace information from the .ibd files... 2014-07-27 06:47:06 30625 [Note] InnoDB: Restoring possible half-written data pages 2014-07-27 06:47:06 30625 [Note] InnoDB: from the doublewrite buffer... InnoDB: Last MySQL binlog file position 0 344931686, file name ./mysql-bin.000030 2014-07-27 06:47:09 30625 [Note] InnoDB: 128 rollback segment(s) are active. 2014-07-27 06:47:09 30625 [Note] InnoDB: Waiting for purge to start 2014-07-27 06:47:09 30625 [Note] InnoDB: 5.6.16 started; log sequence number 133810301875 2014-07-27 06:47:09 30625 [Note] Server hostname (bind-address): '*'; port: 3306 2014-07-27 06:47:09 30625 [Note] IPv6 is available. 2014-07-27 06:47:09 30625 [Note] - '::' resolves to '::'; 2014-07-27 06:47:09 30625 [Note] Server socket created on IP: '::'. 2014-07-27 06:47:10 30625 [Note] Event Scheduler: Loaded 0 events 2014-07-27 06:47:10 30625 [Note] /usr/sbin/mysqld: ready for connections. Version: '5.6.16' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)

Based on these symptoms and messages, I believe your patjk_wikidb database is suffering from InnoDB corruption, specifically in the mw_objectcache table.

If this were a MyISAM able, we could probably recover it with mysqlcheck or myisamrepsair. However, mysqlcheck can only repair InnoDB tables by dumping and rebuilding them, which is the same procedure we just attempted, so this is certain to fail as well.

We could attempt to recover the database with the innodb_force_recovery option. However, this is risky. It can cause even worse damage. Additionally, your VPS does not have enough free space to make an up-to-date raw copy of the InnoDB tablespaces before attempting this.

I'm not familiar with the wiki software you are using, so I'm not sure how vital the mw_objectcache table is to its operation, or if it can be replaced or regenerated easily. Discarding this table might be a more viable option if a repair using the gentlest settings of innodb_force_recovery do not succeed.

Another option which you might consider is consulting a developer or DBA with experience recovering InnoDB tables.

I wish I had better news for you. I'm afraid there is not going to be a good way to get rid of this overly large InnoDB tablespace without losing at least some of your patjk_wikidb data. Again, we can attempt innodb_force_recovery if you request it, but this poses the risk of more data loss.