@nopld

Как починить InnoDB таблицу?

Есть таблица, в которую вставлялось много данных. Всё работало, пока в один момент mysql упал и отказался подниматься.

Судя по логам, сначала случилось:
2017-07-10T09:15:43.210390Z 381102 [ERROR] /usr/sbin/mysqld: The table 'documents' is full


Потом mysql упал:
2017-07-10 12:18:55 0x9b172450  InnoDB: Assertion failure in thread 2601985104 in file os0file.cc line 1697
InnoDB: Failing assertion: offset > 0
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.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
09:18:55 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.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

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

Thread pointer: 0x98c127e8
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 = 9b171df0 thread_stack 0x30000

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (98c86d68): Can't read from address 98c86d68
Connection ID (thread ID): 381102
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.
2017-07-10T09:18:56.308889Z 0 [Warning] Changed limits: max_open_files: 1024 (requested 5000)
2017-07-10T09:18:56.309168Z 0 [Warning] Changed limits: table_open_cache: 431 (requested 2000)
2017-07-10T09:18:56.473648Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-07-10T09:18:56.475765Z 0 [Warning] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release.
2017-07-10T09:18:56.496118Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.18-0ubuntu0.16.04.1) starting as process 17800 ...


А потом решил рестартовать и восстанавливаться:
2017-07-10T09:18:58.101572Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12005386752
2017-07-10T09:18:58.981408Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12009002417
2017-07-10T09:18:59.360917Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12001716736
2017-07-10T09:19:00.760206Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12006959616
2017-07-10T09:19:01.280326Z 0 [Note] InnoDB: Doing recovery: scanned up to log sequence number 12009002417
2017-07-10T09:19:01.282555Z 0 [Note] InnoDB: Database was not shutdown normally!
2017-07-10T09:19:01.282655Z 0 [Note] InnoDB: Starting crash recovery.
2017-07-10T09:19:01.286151Z 0 [Warning] InnoDB: Page 7 in the doublewrite buffer is not within space bounds: page [page id: space=123, page number=12714]
2017-07-10T09:19:01.286270Z 0 [Warning] InnoDB: Page 8 in the doublewrite buffer is not within space bounds: page [page id: space=123, page number=112881]
2017-07-10T09:19:01.288855Z 0 [Warning] InnoDB: Page 16 in the doublewrite buffer is not within space bounds: page [page id: space=123, page number=65624]


Пока я это обнаружил, прошло штук двадцать таких циклов.

Насколько я понимаю, мне надо увеличить MAX_ROWS: ALTER TABLE table_name MAX_ROWS=1000000000 AVG_ROW_LENGTH=nnn;

Но, чтобы выполнить этот запрос, нужно запустить MySQL, который из-за битой таблицы (?) не запускается. Добавленный в конфиг innodb_force_recovery=[1-6] запуститься ему помог.

Что делать?

Вариант, при котором нужно снести таблицу вместе с данными, подойдёт: хоть бэкапа и нет, но данные восстановить достаточно легко.
  • Вопрос задан
  • 2087 просмотров
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы