|
- GreatSQL社区原创内容未经授权不得随意使用,转载请联系小编并注明来源。
- GreatSQL是MySQL的国产分支版本,使用上与MySQL一致。
- 作者: 叶金荣
- 文章来源:GreatSQL社区原创
<hr/>MySQL 8.0版本计划
MySQL 8.0开始采用快速迭代开发模式,基本上是每隔3个月就发布一个新的小版本。去年1月18日(2022.1.18)发布MySQL 8.0.28,今年1月17日发布MySQL 8.0.32,再看看其他几个版本的时间,还真是贼守时啊。
在这中间,出了点小意外,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。
- 当数据表名用 &#34;$&#34; 开头的话,引用时必须用反引号 &#34;`&#34;,否则会有一个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 | &#39;$ as the first character of an unquoted identifier&#39; 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 | &#39;$ as the first character of an unquoted identifier&#39; is deprecated and will be removed in a future release. |
+---------+------+-------------------------------------------------------------------------------------------------------------+
mysql> table `$t1`; -- 加上反引号 &#34;`&#34; 就不再报告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&#39;t yet support &#39;EXPLAIN ANALYZE with JSON format&#39;原来的 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 &#39;default select * from t1&#39; at line 1
- 在MGR中设置 group_replication_consistency = AFTER,当某个Secondary节点因为网络不稳定时,可能会触发报错 Transaction &#39;GTID&#39; 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
<hr/>Enjoy GreatSQL :)
关于 GreatSQL
GreatSQL是由万里数据库维护的MySQL分支,专注于提升MGR可靠性及性能,支持InnoDB并行查询特性,是适用于金融级应用的MySQL分支版本。
相关链接: GreatSQL社区 Gitee GitHub Bilibili
GreatSQL社区:

社区有奖建议反馈:https://greatsql.cn/thread-54-1-1.html
社区博客有奖征稿详情:https://greatsql.cn/thread-100-1-1.html
社区2022年度勋章获奖名单:https://greatsql.cn/thread-184-1-1.html
(对文章有疑问或者有独到见解都可以去社区官网提出或分享哦~)
技术交流群:
微信&QQ群:
QQ群:533341697
微信群:添加GreatSQL社区助手(微信号:wanlidbc )好友,待社区助手拉您进群。 |
|