无法使用 ROW_FORMAT=COMPRESSED 创建表

Tsa*_*tra 2 mariadb compression mariadb-10.4

我正在尝试在 Docker 容器中的 MariaDB 10.4.11-MariaDB-1:10.4.11+maria~bionic 上安装 Nextcloud (mariadb:latest sha256:2f11cf2ec18988aec8346a5cf528d69ac3f0f4fc02af79ba28f4fd47b7778d6f)。

安装程序所做的第一件事是尝试ROW_FORMAT=COMPRESSED在 DDL 中创建一个表,这会产生错误 140“错误的创建选项”。

如果我省略 row_format 参数,则会创建表,但使用 DYNAMIC row_format。

这里发生了什么?是否ROW_FORMAT=COMPRESSED在某个时候被删除了,或者正在拉取的 MariaDB docker 版本是否未使用它进行编译?

如果不修改 Nextcloud 的 SQL DDL,我能在这里做什么?

Edit:
Run Code Online (Sandbox Code Playgroud)

最后可以添加有关我的系统的更多信息,如下:

首先是我的my.cnf

[mysqld]
innodb_large_prefix=on
innodb_file_per_table=on
innodb_doublewrite=off
innodb_page_size=64k
innodb_file_format=barracuda

innodb_compression_algorithm=lz4
innodb_compression_default=ON
Run Code Online (Sandbox Code Playgroud)

这会导致启动包含以下行:

2020-01-11 07:10:48+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.11+maria~bionic started.
2020-01-11 07:10:57+00:00 [Note] [Entrypoint]: Switching to dedicated user 'mysql'
2020-01-11 07:10:58+00:00 [Note] [Entrypoint]: Entrypoint script for MySQL Server 1:10.4.11+maria~bionic started.
2020-01-11  7:10:58 0 [Note] mysqld (mysqld 10.4.11-MariaDB-1:10.4.11+maria~bionic) starting as process 1 ...
2020-01-11  7:10:58 0 [Warning] The parameter innodb_file_format is deprecated and has no effect. It may be removed in future releases. See https://mariadb.com/kb/en/library/xtradbinnodb-file-format/
2020-01-11  7:10:58 0 [Note] InnoDB: innodb_page_size=65536
2020-01-11  7:10:58 0 [Note] InnoDB: Using Linux native AIO
2020-01-11  7:10:58 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2020-01-11  7:10:58 0 [Note] InnoDB: Uses event mutexes
2020-01-11  7:10:58 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2020-01-11  7:10:58 0 [Note] InnoDB: Number of pools: 1
2020-01-11  7:10:58 0 [Note] InnoDB: Using SSE2 crc32 instructions
2020-01-11  7:10:58 0 [Note] mysqld: O_TMPFILE is not supported on /tmp (disabling future attempts)
2020-01-11  7:10:58 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M
2020-01-11  7:10:58 0 [Note] InnoDB: Completed initialization of buffer pool
2020-01-11  7:10:58 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2020-01-11  7:11:06 0 [Note] InnoDB: 128 out of 128 rollback segments are active.
2020-01-11  7:11:06 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2020-01-11  7:11:06 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2020-01-11  7:11:06 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2020-01-11  7:11:06 0 [Note] InnoDB: Waiting for purge to start
2020-01-11  7:11:06 0 [Note] InnoDB: 10.4.11 started; log sequence number 202590810; transaction id 682452
2020-01-11  7:11:06 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2020-01-11  7:11:06 0 [Note] Plugin 'FEEDBACK' is disabled.
2020-01-11  7:11:07 0 [Note] Server socket created on IP: '::'.
2020-01-11  7:11:08 0 [Note] Reading of all Master_info entries succeeded
2020-01-11  7:11:08 0 [Note] Added new Master_info '' to hash table
2020-01-11  7:11:08 0 [Note] mysqld: ready for connections.
Version: '10.4.11-MariaDB-1:10.4.11+maria~bionic'  socket: '/var/run/mysqld/mysqld.sock'  port: 3306  mariadb.org binary distribution
2020-01-11  7:11:30 0 [Note] InnoDB: Buffer pool(s) load completed at 200111  7:11:30
Run Code Online (Sandbox Code Playgroud)

由于我必须更改创建表 DDL 才能运行,因此这是实际创建的此类表的示例:

CREATE TABLE `oc_users` (
  `uid` varchar(64) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `displayname` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL,
  `password` varchar(255) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `uid_lower` varchar(64) COLLATE utf8mb4_bin DEFAULT '',
  PRIMARY KEY (`uid`),
  KEY `user_uid_lower` (`uid_lower`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin `PAGE_COMPRESSED`='ON' 
Run Code Online (Sandbox Code Playgroud)

请注意,onlyPAGE_COMPRESSED是一个有效的选项,ROW_FORMAT=COMPRESSED无论如何该选项都会失败。

命令SHOW GLOBAL STATUS: https: //pastebin.com/LzjsAvAX

命令SHOW VARIABLES: https: //pastebin.com/64zpmh2Z

我运行的系统有 8 GB RAM,其中 MariaDB 使用了大约 170 MB。

小智 6

如果其他人偶然发现这个线程(像我一样)寻找解决方案

4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE
Run Code Online (Sandbox Code Playgroud)

或者来自 nextcloud 的 mariadb 的类似错误,每当 nextcloud 尝试写入数据库时​​就会发生:对我来说重要的线索是,这个错误可能与 utf8 编码问题有关。请参阅此处获取 nextcloud 文档:

https://docs.nextcloud.com/server/21/admin_manual/configuration_database/mysql_4byte_support.html

长话短说:

https://help.nextcloud.com/t/update-to-next-cloud-21-0-2-has-get-an-error/117028/7对我来说的解决方案 是:

php occ config:system:set mysql.utf8mb4 --type boolean --value="false"
Run Code Online (Sandbox Code Playgroud)

其次是

php occ maintenance:repair --include-expensive
Run Code Online (Sandbox Code Playgroud)

这将修复所有表,以便再次可以写入它们。