無法使用 ROW_FORMAT=COMPRESSED 創建表
我正在嘗試在 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:
最後可以添加有關我的系統的更多資訊,這裡是:
首先,我的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
這將導致包含以下行的啟動:
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
由於我必須更改創建表 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'
請注意,這只是
PAGE_COMPRESSED
一個有效的選項,ROW_FORMAT=COMPRESSED
無論如何該選項都會失敗。
SHOW GLOBAL STATUS
命令:https : //pastebin.com/LzjsAvAX和
SHOW VARIABLES
命令:https ://pastebin.com/64zpmh2Z我執行的系統有 8 GB 的 RAM,其中 MariaDB 使用了大約 170 MB。
如果其他人(像我一樣)偶然發現這個執行緒正在尋找解決方案
4047 InnoDB refuses to write tables with ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE
或來自 nextcloud 的 mariadb 的類似錯誤,每當 nextcloud 嘗試寫入數據庫時就會發生:對我來說重要的線索是,此錯誤可能與 utf8 編碼問題有關。有關 nextcloud 文件,請參見此處:
https://docs.nextcloud.com/server/21/admin_manual/configuration_database/mysql_4byte_support.html
TL; 博士:
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"
其次是
php occ maintenance:repair --include-expensive
這將修復所有表,以便再次寫入它們。
多虧了反手評論,我深入研究了innodb_page_size的文件,其中簡要提到了:
當 innodb_page_size 設置為 32KB 或 64KB 時,不支持 ROW_FORMAT=COMPRESSED。
由於我調整了 InnoDB 頁面大小以匹配儲存介質(即 64 Kb),這意味著它
ROW_FORMAT=COMPRESSED
被自動(並且永久)禁用,並且系統內沒有解釋來解釋這一點。因此,長話短說,如果您打算做任何事情,您必須抓取文件的每一微米,並且您可能嘗試的任何優化都會立即將您帶入“不支持離開”領域。否則,就會出現模糊和無意義的錯誤。
那好吧。