我有一个损坏的MariaDB数据库。损坏是由于停电。
不输入innodb_force_recovery
就无法启动MariaDB。我已将其设置为3。
这是InnoDB,所以我无法修复它。它应该自己修复。
当我尝试转储表时,出现以下错误:
mysqldump: Error 1034: Index for table 'statistics' is corrupt; try to repair it when dumping table `statistics` at row: 36157
在这一点上,我撞到墙上,因为我不知道如何修复索引。
尝试按照Georg mariadb-check
命令的建议运行,但出现以下错误:
2022-06-03 15:08:15 4 [ERROR] InnoDB: Space id and page no stored in the page, read in are [page id: space=201, page number=30781], should be [page id: space=201, page number=32829]
2022-06-03 15:08:15 4 [ERROR] InnoDB: Space id and page no stored in the page, read in are [page id: space=201, page number=30721], should be [page id: space=201, page number=32769]
2022-06-03 15:08:15 4 [ERROR] [FATAL] InnoDB: Trying to read page number 2188681215 in space 201, space name homeassistant/states, which is outside the tablespace bounds. Byte offset 0, len 16384
220603 15:08:15 [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 https://mariadb.com/kb/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.4.19-MariaDB-1:10.4.19+maria~focal
key_buffer_size=16777216
read_buffer_size=262144
max_used_connections=1
max_threads=66
thread_count=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 68686 K bytes of memory
Hope that's ok; if not, decrease some variables in the equation.
Thread pointer: 0x7f3c000c48
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 = 0x7f843028b8 thread_stack 0x30000
mysqld(my_print_stacktrace+0x30)[0x55886ff4c0]
mysqld(handle_fatal_signal+0x49c)[0x55882085b4]
linux-vdso.so.1(__kernel_rt_sigreturn+0x0)[0x7f87a4378c]
/lib/aarch64-linux-gnu/libc.so.6(gsignal+0xe0)[0x7f870fa138]
/lib/aarch64-linux-gnu/libc.so.6(abort+0x110)[0x7f870e6d68]
mysqld(+0xb241a0)[0x55884d41a0]
mysqld(+0x5a1724)[0x5587f51724]
mysqld(+0xbc3728)[0x5588573728]
mysqld(+0xb81184)[0x5588531184]
mysqld(+0xb5e44c)[0x558850e44c]
mysqld(+0xb39644)[0x55884e9644]
mysqld(+0x59d0d8)[0x5587f4d0d8]
mysqld(+0xb9fa84)[0x558854fa84]
mysqld(+0xba0008)[0x5588550008]
mysqld(+0xb913e8)[0x55885413e8]
mysqld(+0x9ffcb4)[0x55883afcb4]
mysqld(_ZN7handler7ha_openEP5TABLEPKcijP11st_mem_rootP4ListI6StringE+0x58)[0x558820e0b8]
mysqld(_Z21open_table_from_shareP3THDP11TABLE_SHAREPK25st_mysql_const_lex_stringjjjP5TABLEbP4ListI6StringE+0x628)[0x55880d5f30]
mysqld(_Z10open_tableP3THDP10TABLE_LISTP18Open_table_context+0x6dc)[0x5587fcb1f4]
mysqld(_Z11open_tablesP3THDRK14DDL_options_stPP10TABLE_LISTPjjP19Prelocking_strategy+0x9f8)[0x5587fce378]
mysqld(_Z20open_and_lock_tablesP3THDRK14DDL_options_stP10TABLE_LISTbjP19Prelocking_strategy+0x38)[0x5587fceb30]
mysqld(+0x758608)[0x5588108608]
mysqld(+0x7595dc)[0x55881095dc]
mysqld(_ZN19Sql_cmd_check_table7executeEP3THD+0x8c)[0x558810b24c]
mysqld(_Z21mysql_execute_commandP3THD+0xd80)[0x5588024370]
mysqld(_Z11mysql_parseP3THDPcjP12Parser_statebb+0x1f8)[0x558802a200]
mysqld(_Z16dispatch_command19enum_server_commandP3THDPcjbb+0xfb0)[0x558802c008]
mysqld(_Z10do_commandP3THD+0xfc)[0x558802de34]
mysqld(_Z24do_handle_one_connectionP7CONNECT+0x290)[0x55880feaf8]
mysqld(handle_one_connection+0x44)[0x55880fec1c]
/lib/aarch64-linux-gnu/libpthread.so.0(+0x84fc)[0x7f874e24fc]
/lib/aarch64-linux-gnu/libc.so.6(+0xd467c)[0x7f8719767c]
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x7f3c0118f0): CHECK TABLE `events`
Connection ID (thread ID): 4
Status: NOT_KILLED
Optimizer switch: index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,engine_condition_pushdown=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=on,loosescan=on,materialization=on,in_to_exists=on,semijoin=on,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=off,mrr_cost_based=off,mrr_sort_keys=off,outer_join_with_cache=on,semijoin_with_cache=on,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on,extended_keys=on,exists_to_in=on,orderby_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on
The manual page at https://mariadb.com/kb/en/how-to-produce-a-full-stack-trace-for-mysqld/ contains
information that should help you find out what is causing the crash.
Writing a core file...
Working directory at /var/lib/mysql
Resource Limits:
Limit Soft Limit Hard Limit Units
Max cpu time unlimited unlimited seconds
Max file size unlimited unlimited bytes
Max data size unlimited unlimited bytes
Max stack size 8388608 unlimited bytes
Max core file size unlimited unlimited bytes
Max resident set unlimited unlimited bytes
Max processes unlimited unlimited processes
Max open files 1048576 1048576 files
Max locked memory 65536 65536 bytes
Max address space unlimited unlimited bytes
Max file locks unlimited unlimited locks
Max pending signals 29948 29948 signals
Max msgqueue size 819200 819200 bytes
Max nice priority 0 0
Max realtime priority 0 0
Max realtime timeout unlimited unlimited us
Core pattern: |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h
2条答案
按热度按时间ujv3wf0j1#
正在尝试读取空间201中的页码2188681215,空间名称为homessistant/states,该空间超出了表空间界限。字节偏移量0,长度16384
这里,
homeassistant/states
表的主索引中的一个页面存储了不正确的值,因此InnoDB在访问该页面时崩溃。如果InnoDB以任何
innodb_force_recovery
〉0启动,但在mysqldump操作期间崩溃,您可以尝试跳过损坏的页面:附言
我想知道它是否真的是主索引。如果它真的是辅助索引,你可以删除它,重新加载表,然后重新创建辅助索引。
[1][https://github.com/twindb/undrop-for-innodb/blob/develop/fetch_data.sh](https://github.com/twindb/undrop-for-innodb/blob/develop/fetch_data.sh)
drnojrws2#
1.制作备份
1.检查哪些表的索引可能已损坏:
mariadb-check -c database
1.使用
OPTIMIZE TABLE corrupted_table
强制重建