6

I am working with version 10.0.19-MariaDB-1~trusty-log and I'm only able to restart mysqld with innodb_force_recovery=6 and I don't know why.

The output of the /usr/sbin/mysqld is the following:

root@birdwatch:~> /usr/sbin/mysqld                                                             
151112 12:49:53 [Note] /usr/sbin/mysqld (mysqld 10.0.19-MariaDB-1~trusty) starting as process 4603 ...
151112 12:49:53 [Note] InnoDB: Using mutexes to ref count buffer pool pagesfile=hey_prova --log-output=FILE
151112 12:49:53 [Note] InnoDB: The InnoDB memory heap is disabled
151112 12:49:53 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
151112 12:49:53 [Note] InnoDB: Memory barrier is not used
151112 12:49:53 [Note] InnoDB: Compressed tables use zlib 1.2.8
151112 12:49:53 [Note] InnoDB: Using Linux native AIO
151112 12:49:53 [Note] InnoDB: Using CPU crc32 instructions
151112 12:49:53 [Note] InnoDB: Initializing buffer pool, size = 256.0M
151112 12:49:53 [Note] InnoDB: Completed initialization of buffer pool
151112 12:49:53 [Note] InnoDB: Highest supported file format is Barracuda.
151112 12:49:53 [Note] InnoDB: Log scan progressed past the checkpoint lsn 3384148
151112 12:49:53 [Note] InnoDB: Database was not shutdown normally!
151112 12:49:53 [Note] InnoDB: Starting crash recovery.
151112 12:49:53 [Note] InnoDB: Reading tablespace information from the .ibd files...
151112 12:49:53 [Note] InnoDB: Restoring possible half-written data pages 
151112 12:49:53 [Note] InnoDB: from the doublewrite buffer...
InnoDB: Doing recovery: scanned up to log sequence number 3391696
151112 12:49:53 [Note] InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percent: 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 2015-11-12 12:49:53 7f3df3bfd700  InnoDB: Assertion failure in thread 139904059168512 in file page0cur.cc line 931
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.
151112 12:49:53 [ERROR] 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.

To report this bug, see http://kb.askmonty.org/en/reporting-bugs

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.

Server version: 10.0.19-MariaDB-1~trusty
key_buffer_size=134217728
read_buffer_size=2097152
max_used_connections=0
max_threads=102
thread_count=0
It is possible that mysqld could use up to 
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 759757 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x0x0
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 = 0x0 thread_stack 0x48000
/usr/sbin/mysqld(my_print_stacktrace+0x2e)[0x7f3e2004562e]
/usr/sbin/mysqld(handle_fatal_signal+0x457)[0x7f3e1fb845e7]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x10340)[0x7f3e1eb8c340]
/lib/x86_64-linux-gnu/libc.so.6(gsignal+0x39)[0x7f3e1d9a5cc9]
/lib/x86_64-linux-gnu/libc.so.6(abort+0x148)[0x7f3e1d9a90d8]
/usr/sbin/mysqld(+0x84287f)[0x7f3e1fe5587f]
/usr/sbin/mysqld(+0x827b1c)[0x7f3e1fe3ab1c]
/usr/sbin/mysqld(+0x82994f)[0x7f3e1fe3c94f]
/usr/sbin/mysqld(+0x914b0c)[0x7f3e1ff27b0c]
/usr/sbin/mysqld(+0x9614b0)[0x7f3e1ff744b0]
/usr/sbin/mysqld(+0x8aa29a)[0x7f3e1febd29a]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x8182)[0x7f3e1eb84182]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7f3e1da6947d]
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.

Two days ago I read a lot of posts and none tell how to restart the daemon after a similar situation.

According to this post: How to Recover InnoDB Corruption for MySQL

If you attempt to use anything beyond a magnitude of 4, you run an extreme risk of further corruption, meaning that your time and effort would be for nothing.

Is this true??

My main question is:

How can I recover all the data and restart de daemon with any problem? I want to automatize this process to prevent it in the future.

5

Non-zero innodb_force_recovery is a dangerous zone and you should be careful increasing its value. Yes, 6 may corrupt your data permanently, but what other options do you have if MySQL doesn't start with lower values? Besides, if you need to start MySQL with innodb_force_recovery the database is already and permanently corrupt and needs to be rebuilt. Except probably rare cases like corruption in secondary indexes.

Anyway, if MySQL started with innodb_force_recovery=6 go ahead and dump the databases with --order-by-primary and possibly with --skip-lock-tables. Then stop MySQL, move datadir to a safe place and re-create the databases from scratch.

If mysqldump crashes then corruption is too severe for innodb_force_recovery.

(A hint - dump all tables one by one, so you can find out what tables cause MySQL crash).

Then I'd invite you to out data recovery portal, where you can upload the database and download back repaired SQL dump. Of if you prefer DIY approach the same toolkit on GitHub. See instructions in one of posts on our blog.

DISCLAIMER: I'm author of both tools.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.