0

Data file(.ibd) for one of my mysql table is missing in data directory. As read in some articles i want to resolve the issue by discarding tablespace first ,import the tablespace (cfg file of said table available from another server), dump the table, drop the table and then import it back. But when i am trying to discard the tablespace mysql server getting restarted and i am getting 'Mysql server has gone away' error on mysql client. Any idea about this? And how to move forward on this?

I am using mysql 5.5.40 version. Below is the error log contents regarding the error.

150618 14:05:16  InnoDB: error: space object of table 'a/b',  
InnoDB: space id 4043 did not exist in memory. Retrying an open.  
150618 14:05:16  InnoDB: Operating system error number 2 in a file operation.   
InnoDB: The error means the system cannot find the path specified.  
150618 14:05:16  InnoDB: Error: trying to open a table, but could not  
InnoDB: open the tablespace file './a/b.ibd'!  
InnoDB: Have you moved InnoDB .ibd files around without using the  
InnoDB: commands DISCARD TABLESPACE and IMPORT TABLESPACE?  
InnoDB: It is also possible that this is a temporary table #sql...,  
InnoDB: and MySQL removed the .ibd file for this.  
InnoDB: Please refer to  
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting-  datadict.html  
InnoDB: for how to resolve the issue.  
150618 14:05:16  InnoDB: cannot calculate statistics for table a/b  
InnoDB: because the .ibd file is missing.  For help, please refer to  
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html  
150618 14:05:16 [ERROR] MySQL is trying to open a table handle but the .ibd   file for table a/b does not exist.  
Have you deleted the .ibd file from the database directory under  
the MySQL datadir, or have you used DISCARD TABLESPACE?  
See http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html  
how you can resolve the problem.  
150618 14:05:30  InnoDB: cannot calculate statistics for table a/b  
InnoDB: because the .ibd file is missing.  For help, please refer to  
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting.html  
150618 14:05:30  InnoDB: Error: trying to access tablespace 4043 page no. 3,  
InnoDB: but the tablespace does not exist or is just being dropped.  

(repeated 100 times)  

InnoDB: Error: Unable to read tablespace 4043 page no 3 into the buffer pool       after 100 attempts  
InnoDB: The most probable cause of this error may be that the table has been  corrupted.  
InnoDB: You can try to fix this problem by using innodb_force_recovery.  
InnoDB: Please see reference manual for more details.  
InnoDB: Aborting...  
150618 14:05:30  InnoDB: Assertion failure in thread 47945742711104 in file      buf0buf.c line 2347  
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.5/en/forcing-innodb-recovery.html  
InnoDB: about forcing recovery.  
13:05:30 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=2097152  
max_used_connections=1  
max_threads=4000  
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 =       49329259 K  bytes of memory  
Hope that's ok; if not, decrease some variables in the equation.  

Thread pointer: 0xa7812a0  
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 = 2b9b3cf670e0 thread_stack 0x40000  
/usr/sbin/mysqld(my_print_stacktrace+0x35)[0x7de845]  
/usr/sbin/mysqld(handle_fatal_signal+0x3e1)[0x6956c1]  
/lib64/libpthread.so.0[0x2b9a9e8faca0]  
/lib64/libc.so.6(gsignal+0x35)[0x2b9a9f602fc5]  
/lib64/libc.so.6(abort+0x110)[0x2b9a9f604a70]  
/usr/sbin/mysqld[0x867544]  
/usr/sbin/mysqld[0x859583]  
/usr/sbin/mysqld[0x80f2a3]  
/usr/sbin/mysqld[0x7f688a]  
/usr/sbin/mysqld[0x7f7485]  
/usr/sbin/mysqld(_ZN7handler7ha_openEP5TABLEPKcii+0x3e)[0x6970ee]  
/usr/sbin/mysqld(_Z21open_table_from_shareP3THDP11TABLE_SHAREPKcjjjP5TABLEb+0x59 1)[0x5fb371]             
/usr/sbin/mysqld(_Z10open_tableP3THDP10TABLE_LISTP11st_mem_rootP18Open_table_context+0xaae)[0x5447ae]  
/usr/sbin/mysqld(_Z11open_ltableP3THDP10TABLE_LIST13thr_lock_typej+0x86)[0x546d86]  
/usr/sbin/mysqld[0x5d9718]  
/usr/sbin/mysqld(_Z17mysql_alter_tableP3THDPcS1_P24st_ha_create_informationP10TABLE_LISTP10Alter_infojP8st_orderb+0x1da)[0x5e1e3a]  
/usr/sbin/mysqld(_ZN21Alter_table_statement7executeEP3THD+0x48d)[0x7c115d]  
/usr/sbin/mysqld(_Z21mysql_execute_commandP3THD+0x3d39)[0x5800c9]  
/usr/sbin/mysqld(_Z11mysql_parseP3THDPcjP12Parser_state+0x10b)[0x58278b]  
/usr/sbin/mysqld(_Z16dispatch_command19enum_server_commandP3THDPcj+0x1dcc)  [0x584dfc]
/usr/sbin/mysqld(_Z10do_commandP3THD+0xc4)[0x5854f4]  
/usr/sbin/mysqld(_Z24do_handle_one_connectionP3THD+0xef)[0x6225af]  
/usr/sbin/mysqld(handle_one_connection+0x54)[0x6226a4]  
/lib64/libpthread.so.0[0x2b9a9e8f283d]  
/lib64/libc.so.6(clone+0x6d)[0x2b9a9f6a7fcd]  
Trying to get some variables.  
Some pointers may be invalid and cause the dump to abort.  
Query (a7bf9b0): alter table b discard tablespace  
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.  
150618 14:05:30 mysqld_safe Number of processes running now: 0  
150618 14:05:30 mysqld_safe mysqld restarted  
150618 14:05:30 [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.  
150618 14:05:30 [Warning] 'THREAD_CONCURRENCY' is deprecated and will be removed in a future release.  
150618 14:05:30 [Warning] You need to use --log-bin to make --log-slave-updates   work.  
150618 14:05:30 [Note] Plugin 'FEDERATED' is disabled.  
150618 14:05:30 InnoDB: The InnoDB memory heap is disabled  
150618 14:05:30 InnoDB: Mutexes and rw_locks use GCC atomic builtins  
150618 14:05:30 InnoDB: Compressed tables use zlib 1.2.3  
150618 14:05:30 InnoDB: Using Linux native AIO  
150618 14:05:30 InnoDB: Initializing buffer pool, size = 2.0G  
150618 14:05:30 InnoDB: Completed initialization of buffer pool  
150618 14:05:30 InnoDB: highest supported file format is Barracuda.  
InnoDB: The log sequence number in ibdata files does not match  
InnoDB: the log sequence number in the ib_logfiles!  
150618 14:05:30  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: Last MySQL binlog file position 0 37818229, file name ./x.000069  
150618 14:05:32  InnoDB: Error: table 'a/b'  
InnoDB: in InnoDB data dictionary has tablespace id 4043,  
InnoDB: but tablespace with that id or name does not exist. Have  
InnoDB: you deleted or moved .ibd files?  
InnoDB: This may also be a table created with CREATE TEMPORARY TABLE  
InnoDB: whose .ibd and .frm files MySQL automatically removed, but the  
InnoDB: table still exists in the InnoDB internal data dictionary.  
InnoDB: Please refer to  
InnoDB: http://dev.mysql.com/doc/refman/5.5/en/innodb-troubleshooting-datadict.html  
InnoDB: for how to resolve the issue.  
150618 14:05:32  InnoDB: Waiting for the background threads to start  
150618 14:05:33 InnoDB: 5.5.40 started; log sequence number 5221732123581  
150618 14:05:33 [Note] Server hostname (bind-address): '0.0.0.0'; port: 3309  
150618 14:05:33 [Note]   - '0.0.0.0' resolves to '0.0.0.0';  
150618 14:05:33 [Note] Server socket created on IP: '0.0.0.0'.  
150618 14:05:33 [Warning] Neither --relay-log nor --relay-log-index were used;   so replication may break when this MySQL server acts as a slave and has his hostname changed!! Please use '--relay-log=mysqld-relay-bin' to avoid this problem.  
150618 14:05:33 [Note] Event Scheduler: Loaded 0 events  
150618 14:05:33 [Note] /usr/sbin/mysqld: ready for connections.  
Version: '5.5.40-log'  socket: '/tmp/mysql.sock'  port: 3309  MySQL Community Server (GPL)  
  • You need to check mysqld log for exact error. Usual place is /var/log[/mysql]/mysqld.log but it may depend on your distribution/configuration. – jkavalik Jun 19 '15 at 10:19
0

If you have cfg and ibd file follow the below approach,

  • Drop the table from the mysql server
  • Create a table with similar structure
  • alter table discard tablespace
  • Move the cfg and ibd files into the data directory(that you have copied from another server)
  • Alter table import tablespace
  • drop table worked successfully. However i cannot get cfg file from another server because i am using mysql 5.5.40 (FLUSH TABLES ... FOR EXPORT is available as of MySQL 5.6.6.) . So i need to take mysqldump and import the backup.. – kasi Jun 22 '15 at 8:14

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.