Table `oc_filecache_extended` corrupt?

Nextcloud version: 20.0.11.1
Operating system and version: FreeBSD 13.0-STABLE (1300509)
Apache version: 2.4.48
PHP version: v7.4.22
MariaDB version: mariadb Ver 15.1 Distrib 10.5.12-MariaDB, for FreeBSD13.0 (amd64) using EditLine wrapper

Report

It would seem that my oc_filecache_extended table has corrupted itself after a power outage. I’m only able to start mariadb with innodb_force_recovery = 2, and even then accessing this table causes the database to crash with signal 10.

Is it possible to rebuild/repair this table? I don’t know that I have a recent backup.

Is this the first time you’ve seen this error?: Y

Steps to replicate it:

  1. Lose power
  2. Turn things back on
  3. It broke
        "Exception": "Doctrine\\DBAL\\Exception\\DriverException",
        "Message": "An exception occurred while executing 'SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum`, `metadata_etag`, `creation_time`, `upload_time` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` WHERE (`storage` = ?) AND (`path_hash` = ?)' with params [1, \"61c91a1da13a8ac1cdcc06c2e7c82585\"]:\n\nSQLSTATE[HY000]: General error: 2006 MySQL server has gone away",

Full error because it’s too big to post here: https://gist.github.com/agrajag9/1f21d858cd22722d9acd1f41c751ed54

210905 19:51:48 [ERROR] mysqld got signal 10 ;
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.5.12-MariaDB
key_buffer_size=16384
read_buffer_size=262144
max_used_connections=2
max_threads=153
thread_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 52768 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x8588063d8
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 = 0x7fffdd75cf38 thread_stack 0x3c000
0x12fcbfc <my_print_stacktrace+0x3c> at /usr/local/libexec/mariadbd
0xc6330f <handle_fatal_signal+0x28f> at /usr/local/libexec/mariadbd
0x8018f7de0 <pthread_sigmask+0x530> at /lib/libthr.so.3

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x85884dcb0): SELECT `filecache`.`fileid`, `storage`, `path`, `path_hash`, `filecache`.`parent`, `name`, `mimetype`, `mimepart`, `size`, `mtime`, `storage_mtime`, `encrypted`, `etag`, `permissions`, `checksum`, `metadata_etag`, `creation_time`, `upload_time` FROM `oc_filecache` `filecache` LEFT JOIN `oc_filecache_extended` `fe` ON `filecache`.`fileid` = `fe`.`fileid` WHERE (`storage` = 1) AND (`path_hash` = '61c91a1da13a8ac1cdcc06c2e7c82585')

Connection ID (thread ID): 17
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,not_null_range_scan=off

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.
Core pattern: %N.core

Some more things I’ve tried:

root@hulk:~ # mysqldump -uroot -p nextcloud
Enter password:
-- MariaDB dump 10.19  Distrib 10.5.12-MariaDB, for FreeBSD13.0 (amd64)
--
-- Host: localhost    Database: nextcloud
-- ------------------------------------------------------
-- Server version       10.5.12-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `oc_accounts`
--

DROP TABLE IF EXISTS `oc_accounts`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oc_accounts` (
  `uid` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `data` longtext COLLATE utf8mb4_bin NOT NULL,
  PRIMARY KEY (`uid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;
mysqldump: Couldn't execute 'show fields from `oc_accounts`': Lost connection to MySQL server during query (2013)

Full error:

210905 21:26:48 [ERROR] mysqld got signal 11 ;
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.5.12-MariaDB
key_buffer_size=16384
read_buffer_size=262144
max_used_connections=1
max_threads=153
thread_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 52768 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x859406bd8
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 = 0x7fffdd159f38 thread_stack 0x3c000
0x12fcbfc <my_print_stacktrace+0x3c> at /usr/local/libexec/mariadbd
0xc6330f <handle_fatal_signal+0x28f> at /usr/local/libexec/mariadbd
0x8018f7de0 <pthread_sigmask+0x530> at /lib/libthr.so.3

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x85944d470): show fields from `oc_accounts`

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,parti
al_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,orderb
y_uses_equalities=on,condition_pushdown_for_derived=on,split_materialized=on,condition_pushdown_for_subquery=on,rowid_filter=on,condition_pushdown_from_having=on,not_null_range_scan=off

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.                                                                                                                                                                                                                                                         Core pattern: %N.core

========================================

root@hulk:~ # mysqlcheck -uroot -p nextcloud
Enter password:
nextcloud.oc_accounts                              OK
nextcloud.oc_activity                              OK
nextcloud.oc_activity_mq                           OK
nextcloud.oc_addressbookchanges                    OK
nextcloud.oc_addressbooks                          OK
nextcloud.oc_appconfig                             OK
nextcloud.oc_authtoken                             OK
nextcloud.oc_bruteforce_attempts                   OK
nextcloud.oc_calendar_invitations                  OK
nextcloud.oc_calendar_reminders                    OK
nextcloud.oc_calendar_resources                    OK
nextcloud.oc_calendar_resources_md                 OK
nextcloud.oc_calendar_rooms                        OK
nextcloud.oc_calendar_rooms_md                     OK
nextcloud.oc_calendarchanges                       OK
nextcloud.oc_calendarobjects                       OK
nextcloud.oc_calendarobjects_props                 OK
nextcloud.oc_calendars                             OK
nextcloud.oc_calendarsubscriptions                 OK
nextcloud.oc_cards                                 OK
nextcloud.oc_cards_properties                      OK
nextcloud.oc_collres_accesscache                   OK
nextcloud.oc_collres_collections                   OK
nextcloud.oc_collres_resources                     OK
nextcloud.oc_comments                              OK
nextcloud.oc_comments_read_markers                 OK
nextcloud.oc_dav_cal_proxy                         OK
nextcloud.oc_dav_shares                            OK
nextcloud.oc_deck_assigned_labels                  OK
nextcloud.oc_deck_assigned_users                   OK
nextcloud.oc_deck_attachment                       OK
nextcloud.oc_deck_board_acl                        OK
nextcloud.oc_deck_boards                           OK
nextcloud.oc_deck_cards                            OK
nextcloud.oc_deck_labels                           OK
nextcloud.oc_deck_stacks                           OK
nextcloud.oc_direct_edit                           OK
nextcloud.oc_directlink                            OK
nextcloud.oc_federated_reshares                    OK
nextcloud.oc_file_locks                            OK
nextcloud.oc_filecache                             OK
mysqlcheck: Got error: 2013: Lost connection to MySQL server during query when executing 'CHECK TABLE ... '

Full error:

210905 21:27:42 [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.5.12-MariaDB
key_buffer_size=16384
read_buffer_size=262144
max_used_connections=2
max_threads=153
thread_count=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 52768 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x8584063d8
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 = 0x7fffdd95df38 thread_stack 0x3c000
0x12fcbfc <my_print_stacktrace+0x3c> at /usr/local/libexec/mariadbd
0xc6330f <handle_fatal_signal+0x28f> at /usr/local/libexec/mariadbd
0x8018f7de0 <pthread_sigmask+0x530> at /lib/libthr.so.3

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x85842ecb0): CHECK TABLE `oc_filecache_extended`

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,not_null_range_scan=off

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.
Core pattern: %N.core

my.cnf:

[client-server]
port    = 3306
socket  = /var/run/mysql/mysql.sock
!includedir /usr/local/etc/mysql/conf.d/
[server-mariadb]
[mysqld]
user                            = mysql
bind-address                    = 127.0.0.1
basedir                         = /usr/local
datadir                         = /var/db/mysql
net_retry_count                 = 16384
log_error                       = /var/log/mysql/mysqld.err
skip-external-locking
key_buffer_size = 16K
max_allowed_packet = 256M
table_open_cache = 4
sort_buffer_size = 64K
read_buffer_size = 256K
read_rnd_buffer_size = 256K
net_buffer_length = 2K
thread_stack = 240K
innodb_file_per_table = 1
innodb_buffer_pool_size = 1G
innodb_io_capacity = 4000
skip-networking
server-id = 1
innodb_force_recovery = 2
[mariadb-safe]
[mariabackup]
[mariadb-upgrade]
[sst]
[mariadb-binlog]
[mariadb-admin]

I’ve confirmed that I’m able to SELECT * FROM every table except oc_filecache_extended, but show fields on any table seems to crash on all tables:

root@hulk:~ # mysqldump -uroot -p nextcloud --tables oc_cards
Enter password:
-- MariaDB dump 10.19  Distrib 10.5.12-MariaDB, for FreeBSD13.0 (amd64)
--
-- Host: localhost    Database: nextcloud
-- ------------------------------------------------------
-- Server version       10.5.12-MariaDB

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `oc_cards`
--

DROP TABLE IF EXISTS `oc_cards`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oc_cards` (
  `id` bigint(20) unsigned NOT NULL AUTO_INCREMENT,
  `addressbookid` bigint(20) NOT NULL DEFAULT 0,
  `carddata` longblob DEFAULT NULL,
  `uri` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  `lastmodified` bigint(20) unsigned DEFAULT NULL,
  `etag` varchar(32) COLLATE utf8mb4_bin DEFAULT NULL,
  `size` bigint(20) unsigned NOT NULL,
  `uid` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `cards_abid` (`addressbookid`),
  KEY `cards_abiduri` (`addressbookid`,`uri`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED;
/*!40101 SET character_set_client = @saved_cs_client */;
mysqldump: Couldn't execute 'show fields from `oc_cards`': Lost connection to MySQL server during query (2013)
2021-09-07 19:37:07 0 [Note] InnoDB: Buffer pool(s) load completed at 210907 19:37:07
210907 19:37:40 [ERROR] mysqld got signal 11 ;
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.5.12-MariaDB
key_buffer_size=16384
read_buffer_size=262144
max_used_connections=1
max_threads=153
thread_count=1
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_threads = 52768 K  bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

Thread pointer: 0x8548068d8
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 = 0x7fffdf76cf38 thread_stack 0x3c000
0x12fcbfc <my_print_stacktrace+0x3c> at /usr/local/libexec/mariadbd
0xc6330f <handle_fatal_signal+0x28f> at /usr/local/libexec/mariadbd
0x8018f7de0 <pthread_sigmask+0x530> at /lib/libthr.so.3

Trying to get some variables.
Some pointers may be invalid and cause the dump to abort.
Query (0x85484dab0): show fields from `oc_cards`

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,not_null_range_scan=off

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.
Core pattern: %N.core
2021-09-07 19:37:40 0 [Note] InnoDB: !!! innodb_force_recovery is set to 2 !!!
2021-09-07 19:37:40 0 [Note] InnoDB: Uses event mutexes
2021-09-07 19:37:40 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-09-07 19:37:40 0 [Note] InnoDB: Number of pools: 1
2021-09-07 19:37:40 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-09-07 19:37:40 0 [Note] InnoDB: Initializing buffer pool, total size = 1073741824, chunk size = 134217728
2021-09-07 19:37:40 0 [Note] InnoDB: Completed initialization of buffer pool
2021-09-07 19:37:40 0 [Note] InnoDB: 128 rollback segments are active.
2021-09-07 19:37:40 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2021-09-07 19:37:40 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-09-07 19:37:40 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-09-07 19:37:40 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-09-07 19:37:40 0 [Note] InnoDB: 10.5.12 started; log sequence number 10258371727; transaction id 257374115
2021-09-07 19:37:40 0 [Note] InnoDB: Loading buffer pool(s) from /var/db/mysql/ib_buffer_pool
2021-09-07 19:37:40 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-09-07 19:37:40 0 [Note] Reading of all Master_info entries succeeded
2021-09-07 19:37:40 0 [Note] Added new Master_info '' to hash table
2021-09-07 19:37:40 0 [Note] /usr/local/libexec/mariadbd: ready for connections.
Version: '10.5.12-MariaDB'  socket: '/var/run/mysql/mysql.sock'  port: 0  FreeBSD Ports
2021-09-07 19:37:40 0 [Note] InnoDB: Buffer pool(s) load completed at 210907 19:37:40