Hi,
I am running NextCloud 15.0.14.1 (we are in the process of upgrading to 22) with a MariaDB backend. Running the occ script db:convert-filecache-bigint, it fails after roughly 5 minutes:
$ sudo -u apache php occ db:convert-filecache-bigint
Following columns will be updated:
- filecache.mtime
- filecache.storage_mtime
- mounts.storage_id
- mounts.root_id
- mounts.mount_id
This can take up to hours, depending on the number of files in your instance!
Continue with the conversion (y/n)? [n] y
In AbstractMySQLDriver.php line 115:
An exception occurred while executing âALTER TABLE oc_filecache CHANGE mtime
mtime BIGINT DEFAULT 0 NOT NULL, CHANGE storage_mtime
storage_mtime BIGINT DEFAULT 0 NOT NULLâ:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In PDOConnection.php line 106:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
In PDOConnection.php line 104:
SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
db:convert-filecache-bigint
According to the output, the script is failing during the ALTER operation on filecache table and then doesnât do the ALTER on table mounts. However when I check the table structure of table filecache, my columns mtime and storage_mtime have the correct type BIGINT even though I canât guarantee that my table is in a stable state.
Searching for this error message âMySQL server has gone awayâ, I found a troubleshooting suggestion with increasing some MariaDB settings like âwait_timeoutâ or âmax_allowed_packetâ. wait_timeout is already set to 8 hours but I increased max_allowed_packet to max value (1G) but this doesnât work better:
https://docs.nextcloud.com/server/latest/admin_manual/configuration_database/linux_database_configuration.html#db-troubleshooting-label
Has anyone had the same issue, especially with a significant number of rows in filecache table (I have ~11 million rows)?
Is there any way to get a more verbose error message from occ apart from the generic âMySQL server has gone awayâ? All I get from the logs are those 2 entries:
{âreqIdâ:âxKzMxQryuOjnG5H5LcDOâ,âlevelâ:3,âtimeâ:â2021-10-28T04:18:46+00:00â,âremoteAddrâ:"",âuserâ:"â",âappâ:âPHPâ,âmethodâ:"",âurlâ:"â",âmessageâ:âPDO::query(): MySQL server has gone away at /opt/nextcloud/www/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php#104â,âuserAgentâ:"â",âversionâ:â15.0.14.1â}
{âreqIdâ:âxKzMxQryuOjnG5H5LcDOâ,âlevelâ:3,âtimeâ:â2021-10-28T04:18:46+00:00â,âremoteAddrâ:"",âuserâ:"â",âappâ:âPHPâ,âmethodâ:"",âurlâ:"â",âmessageâ:âPDO::query(): Error reading result setâs header at /opt/nextcloud/www/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php#104â,âuserAgentâ:"â",âversionâ:â15.0.14.1â}