Cannot drop (or do any other operation on) InnoDB table

346 Views Asked by At

I want to ask you for help. My mysql service is constantly crashing during (any kind of) access to one particular table.

I have a mysql installation on a quite old ubuntu version 10.04. The problem started after some unfortunate shutdown.

I have digged through /var/log/mysql/error.log but nothing really helpful was there (log after drop table below).

150615 22:53:01  InnoDB: Completed initialization of buffer pool
InnoDB: Log scan progressed past the checkpoint lsn 20 3390045602
150615 22:53:01  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 20 3390156127
150615 22:53:01  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 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
InnoDB: Apply batch completed
150615 22:53:02  InnoDB: Started; log sequence number 20 3390156127
InnoDB: !!! innodb_force_recovery is set to 3 !!!
150615 22:53:02 [Note] Event Scheduler: Loaded 0 events
150615 22:53:02 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.73-0ubuntu0.10.04.1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)
150615 22:57:03  InnoDB: Assertion failure in thread 140699839366912 in file ../../../storage/innobase/fsp/fsp0fsp.c line 3171
InnoDB: Failing assertion: xdes_get_state(descr, mtr) == XDES_FSEG
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.1/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
20:57:03 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=16777216
read_buffer_size=131072
max_used_connections=1
max_threads=151
thread_count=1
connection_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 346534 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x7ff73e7b11c0
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 = 7ff73bf1fe58 thread_stack 0x30000
/usr/sbin/mysqld(my_print_stacktrace+0x29) [0x7ff73c5daba9]
/usr/sbin/mysqld(handle_fatal_signal+0x483) [0x7ff73c3ed1c3]
/lib/libpthread.so.0(+0xf8f0) [0x7ff73bb338f0]
/lib/libc.so.6(gsignal+0x35) [0x7ff73a5a9b65]
/lib/libc.so.6(abort+0x180) [0x7ff73a5ad6b0]
/usr/sbin/mysqld(+0x5762c0) [0x7ff73c4d92c0]
/usr/sbin/mysqld(fseg_free_step+0x1d3) [0x7ff73c4df3a3]
/usr/sbin/mysqld(btr_free_but_not_root+0xb6) [0x7ff73c55f556]
/usr/sbin/mysqld(dict_drop_index_tree+0xcb) [0x7ff73c5695fb]
/usr/sbin/mysqld(+0x5d50e1) [0x7ff73c5380e1]
/usr/sbin/mysqld(row_upd_step+0x4ca) [0x7ff73c5389ba]
/usr/sbin/mysqld(que_run_threads+0x398) [0x7ff73c516e68]
/usr/sbin/mysqld(que_eval_sql+0x166) [0x7ff73c5176c6]
/usr/sbin/mysqld(row_drop_table_for_mysql+0x3cd) [0x7ff73c52561d]
/usr/sbin/mysqld(ha_innobase::delete_table(char const*)+0x100) [0x7ff73c4999a0]
/usr/sbin/mysqld(ha_delete_table(THD*, handlerton*, char const*, char const*, char const*, bool)+0x15e) [0x7ff73c3e125e]
/usr/sbin/mysqld(+0x499671) [0x7ff73c3fc671]
/usr/sbin/mysqld(mysql_rm_table(THD*, TABLE_LIST*, char, char)+0x78) [0x7ff73c3fc9d8]
/usr/sbin/mysqld(mysql_execute_command(THD*)+0xdb1) [0x7ff73c2eeca1]
/usr/sbin/mysqld(mysql_parse(THD*, char*, unsigned int, char const**)+0x3fb) [0x7ff73c2f3aab]
/usr/sbin/mysqld(dispatch_command(enum_server_command, THD*, char*, unsigned int)+0x944) [0x7ff73c2f4404]
/usr/sbin/mysqld(do_command(THD*)+0xea) [0x7ff73c2f558a]
/usr/sbin/mysqld(handle_one_connection+0x23e) [0x7ff73c2e6e7e]
/lib/libpthread.so.0(+0x69ca) [0x7ff73bb2a9ca]
/lib/libc.so.6(clone+0x6d) [0x7ff73a6601cd]

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (7ff73e80ac80): drop table db1.cache_pages
Connection ID (thread ID): 1
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.
150615 22:57:03 [Note] Plugin 'FEDERATED' is disabled.
150615 22:57:03  InnoDB: Initializing buffer pool, size = 8.0M
150615 22:57:03  InnoDB: Completed initialization of buffer pool
InnoDB: Log scan progressed past the checkpoint lsn 20 3390045602
150615 22:57:03  InnoDB: Database was not shut down normally!
InnoDB: Starting crash recovery.
InnoDB: Reading tablespace information from the .ibd files...
InnoDB: Restoring possible half-written data pages from the doublewrite
InnoDB: buffer...
InnoDB: Doing recovery: scanned up to log sequence number 20 3390156127
150615 22:57:04  InnoDB: Starting an apply batch of log records to the database...
InnoDB: Progress in percents: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 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
InnoDB: Apply batch completed
150615 22:57:04  InnoDB: Started; log sequence number 20 3390156127
InnoDB: !!! innodb_force_recovery is set to 3 !!!
150615 22:57:04 [Note] Event Scheduler: Loaded 0 events
150615 22:57:04 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.1.73-0ubuntu0.10.04.1-log'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  (Ubuntu)

As you can see from the log I'm at innodb_force_recovery = 3 already and I'm a little big afraid to go further (... yes, old backups). This particular table has no important data, but I would really prefer not to remove the whole db.

The crash happens on any kind of operation on table (SELECT, DROP, SHOW COLUMNS...) any also during USE db1.

Small UPDATE: Altering table and it's database also crashes the engine.

My question is how to remove that particular table? Can I just physically remove the table file from server and everything will be ok? DB will behave properly?

Any help would be great.

1

There are 1 best solutions below

1
On

I have 3 general suggestions for you;

  1. When the manual talks about taking backups before using a higher level of innodb_force_recovery, making a binary backup of the current 'broken' data directory is fine -- the risk is that it might break your data directory further, but as long as you can go back to the initial broken state that is fine.

  2. Your best option is to dump all of the server data with mysqldump, then re-load it into a new data directory. This may or may not crash the server. Hopefully you can at least dump every other table, and with any luck you can dump the data in this table too even though you can't remove it. If you have trouble with mysqldump, try use a newer mysql version to do the dump. Make sure you backed up per step (1) first.

  3. In some cases even if select * from table fails, it may succeed if you try and use the primary index to select specific rows. e.g. SELECT * FROM table WHERE id=1.. in that case you can try dump values of the primary key in batches to try and get most of the table data out.