- GreatSQL社區原創內容未經授權不得隨意使用,轉載請聯系小編并注明來源,
- GreatSQL是MySQL的國產分支版本,使用上與MySQL一致,
- 作者: 葉金榮
- 文章來源:GreatSQL社區原創
MySQL 8.0版本計劃
MySQL 8.0開始采用快速迭代開發模式,基本上是每隔3個月就發布一個新的小版本,去年1月18日(2022.1.18)發布MySQL 8.0.28,今年1月17日發布MySQL 8.0.32,再看看其他幾個版本的時間,還真是賊守時啊,
| 版本 | 發布時間 | 上一年版本 | 上一年發布時間 |
|---|---|---|---|
| 8.0.32 | 2023.1.17 | 8.0.28 | 2022.1.18 |
| 8.0.31 | 2022.10.11 | 8.0.27 | 2021.10.10 |
| 8.0.30 | 2022.7.26 | 8.0.26 | 2021.7.20 |
| 8.0.29 | 2022.4.26 | 8.0.25 8.0.24 | 2021.5.11 2022.4.20 |
在這中間,出了點小意外,MySQL 8.0.29因為存在嚴重安全問題,剛上架沒多久就被下架了,可以看下這篇文章的解讀:MySQL8.0.29出現重大bug,現已下架,
MySQL 8.0.32的一些變化
總的來說,8.0.32版本基本上屬于修修補補狀態,乏善可陳,
在這里,主要羅列我個人認為需要關注的幾個要點或bug fix,想看詳細變化的可以查看 MySQL 8.0.32 Release Notes, https://dev.mysql.com/doc/relnotes/mysql/8.0/en/news-8-0-32.html,
- 當資料表名用 "$" 開頭的話,參考時必須用反引號 "`",否則會有一個WARN,例如:
mysql> create table $t1(id int primary key);
Query OK, 0 rows affected, 1 warning (0.02 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------------------------------------------------------+
| Warning | 1681 | '$ as the first character of an unquoted identifier' is deprecated and will be removed in a future release. |
+---------+------+-------------------------------------------------------------------------------------------------------------+
mysql> table $t1;
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set, 1 warning (0.00 sec)
mysql> show warnings;
+---------+------+-------------------------------------------------------------------------------------------------------------+
| Level | Code | Message |
+---------+------+-------------------------------------------------------------------------------------------------------------+
| Warning | 1681 | '$ as the first character of an unquoted identifier' is deprecated and will be removed in a future release. |
+---------+------+-------------------------------------------------------------------------------------------------------------+
mysql> table `$t1`; -- 加上反引號 "`" 就不再報告WARN
+----+
| id |
+----+
| 1 |
| 2 |
+----+
2 rows in set (0.00 sec)
- 部分客戶端程式采用新的壓縮引數(--compression-algorithms=zstd|zlib|uncompressed)替換舊引數(--compress),新引數中可以指定不同壓縮演算法或不壓縮,影響的客戶端程式有:mysqlpump, mysqlcheck, mysql, mysqladmin, mysqlbinlog, mysqldump, mysqlimport, mysqlshow, mysqlslap, mysql_upgrade, mysqltest,而企業版備份工具mysqlbackup暫時不受影響,還采用 --compress 引數,例如:
$ /usr/local/mysql-8.0.32-linux-glibc2.17-x86_64-minimal/bin/mysqldump --set-gtid-purged=OFF -S./mysql.sock --compress test > test.sql
WARNING: --compress is deprecated and will be removed in a future version. Use --compression-algorithms instead.
$ /usr/local/mysql-8.0.32-linux-glibc2.17-x86_64-minimal/bin/mysql --compress -S./mysql.sock
WARNING: --compress is deprecated and will be removed in a future version. Use --compression-algorithms instead.
- 新增選項
explain_format用于設定 EXPLAIN 查看執行計劃時的默認輸出格式,支持 JSON, TREE, TRADITIONAL(或者寫成 DEFAULT 也可以);當設定為 JSON 格式時,執行EXPLAIN ANALYZE則會報錯:
mysql> set @@explain_format = json;
Query OK, 0 rows affected (0.00 sec)
mysql> explain analyze select * from t1;
ERROR 1235 (42000): This version of MySQL doesn't yet support 'EXPLAIN ANALYZE with JSON format'
原來的 EXPLAIN FORMAT=? 語法仍然支持,但不支持設定為 DEFAULT,只能寫成 TRADITIONAL:
mysql> explain format=tree select * from t1;
...
mysql> explain format=json select * from t1;
...
mysql> explain format=traditional select * from t1;
...
mysql> explain format=default select * from t1;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'default select * from t1' at line 1
-
在MGR中設定
group_replication_consistency = AFTER,當某個Secondary節點因為網路不穩定時,可能會觸發報錯Transaction 'GTID' does not exist on Group Replication consistency manager while receiving remote transaction prepare.,這是因為事務event在View_change_log_event后寫入導致,在8.0.32中,修復了這個問題,將事務event先于View_change_log_event寫入,就可以避免該問題,不過要再次強調,MGR中強烈建議不要設定為 AFTER模式,具體可以參考這篇文章:為什么MGR一致性模式不推薦AFTER, -
當從MySQL 5.7升級到8.0時,如果某個庫中有大量的表,記憶體可能會消耗過多記憶體,這是因為在升級時,一次性讀取所有表并執行
CHECK TABLE .. FOR UPGRADE,在8.0.32中,調整為逐個表檢查是否可升級,就可以避免這個問題了,
有些bug fix的描述資訊比較少,或者指向內部bug id無法看到細節,這里就不再羅列了,
延伸閱讀
- MySQL 8.0.32 GA
- Changes in MySQL 8.0.32
- Server System Variables - explain_format
- EXPLAIN Statement
Enjoy GreatSQL ??
關于 GreatSQL
GreatSQL是由萬里資料庫維護的MySQL分支,專注于提升MGR可靠性及性能,支持InnoDB并行查詢特性,是適用于金融級應用的MySQL分支版本,
相關鏈接: GreatSQL社區 Gitee GitHub Bilibili
GreatSQL社區:
社區博客有獎征稿詳情:https://greatsql.cn/thread-100-1-1.html

技術交流群:
微信:掃碼添加
GreatSQL社區助手微信好友,發送驗證資訊加群,

轉載請註明出處,本文鏈接:https://www.uj5u.com/shujuku/543347.html
標籤:其他
