Mariadb – Unable to create tables with ROW_FORMAT=COMPRESSED

compressionmariadbmariadb-10.4

I'm attempting to install Nextcloud on MariaDB 10.4.11-MariaDB-1:10.4.11+maria~bionic in a docker container (mariadb:latest sha256:2f11cf2ec18988aec8346a5cf528d69ac3f0f4fc02af79ba28f4fd47b7778d6f).

First thing the installer does is attempt to create a table with ROW_FORMAT=COMPRESSED in the DDL, which produces an error 140 "Wrong create options".

If I omit the row_format parameter, the table gets created, but with the DYNAMIC row_format.

What's going on here? Did ROW_FORMAT=COMPRESSED get deleted at some point, or is the version of MariaDB docker is pulling not compiled with it in?

Short of modifying Nextcloud's SQL DDLs, what can I do here?

Edit:

Finally in a position to add more info about my system, here goes:

First, my 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

This results in a startup that contains lines:

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

Since I had to alter the create table DDL to even run, this is an example of one such table that actually got created:

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' 

Note that only PAGE_COMPRESSED was a valid option, the ROW_FORMAT=COMPRESSED option just fails regardless.

The SHOW GLOBAL STATUS command: https://pastebin.com/LzjsAvAX

And the SHOW VARIABLES command: https://pastebin.com/64zpmh2Z

The system I'm running on has 8 GB of RAM, of which MariaDB is using approx 170 MB.

Best Answer

If someone else stumbles across this thread (like me) looking for a solution to a

4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE

or similar error from the mariadb for nextcloud, occurring whenever nextcloud tries to write to the DB: the important clue for me was, that this error might be related to an utf8 encoding issue. See here for the nextcloud documentation:

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

TL;DR:

The solution from https://help.nextcloud.com/t/update-to-next-cloud-21-0-2-has-get-an-error/117028/7 for me was :

php occ config:system:set mysql.utf8mb4 --type boolean --value="false"

followed by

php occ maintenance:repair --include-expensive

which will fix all tables so that writing to them becomes possible again.