关于数据库:MySQL-8032如期而至

3次阅读

共计 4108 个字符,预计需要花费 11 分钟才能阅读完成。

  • 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/rel…。

  • 当数据表名用 “$” 结尾的话,援用时必须用反引号 “`”,否则会有一个 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-10…

技术交换群:

微信:扫码增加 GreatSQL 社区助手 微信好友,发送验证信息 加群

正文完
 0