MySQL 5.x版本在时间跨度之长,仅次于Linux kernel 2.x的发布了,中间经历了两次收购,并没有影响让他它的发展势头。这个有着20多年历史的数据库产品,正重焕新生,变得越来越强大,越来越现代,依然稳坐最流行的开源数据库的宝座。MySQL 8.0 GA的脚步已经离我们越来越近。
MySQL 版本号一下子从5.x系列跳到了8.0,有人可能会疑惑 6.0和7.0 去哪了。现实情况是6.x没正式发布,它一部分特性合并进了5.6 5.7,而MySQL 7.x是MySQL cluster一直沿用的版本号,所以这次主版本号直接跳到了8.0。
MySQL 8.0重要改进
1. MySQL Document Store 2. Default to utf8mb4 3. JSON enhancements 4. CTEs 5. Window Functions 6. Descending Indexes 7. Better Optimizer Cost Model 8. MySQL Server Components 9. Improvement in GIS 10. InnoDB NO WAIT & SKIP LOCKED 11. Temporary Tables Improvements 12. Persistent global variables 13. No more MyISAM System Tables 14. Reclaim UNDO space from large transactions 15. UTF8 performance 16. Removing Query Cache 17. Atomic DDLs 18. Faster & More Complete Performance Schema (Histograms, Indexes, …) and Information Schema 19. ROLES 20. REDO & UNDO logs encrypted if tablespace is encrypted
C++11
8.0更多的使用C++11标准库数据结构和函数改进代码质量和效率。
* std::atomic — fixed lots of bugs for us over the old use of volatile, replaced home-grown compiler-specific atomic * thread_local — gave us nice speedups over our old code * Initializers in structs/classes — simplified construction/destruction * std::snprintf — replaced the old my_snprintf * std::unordered_map/std::unordered_set — much faster than the old HASH * std::call_once — replaced our home-grown my_thread_once * std::unique_ptr — makes cleanup significantly safer (RAII pattern) * constexpr functions — enabled some speedups in InnoDB
编译选项优化
利用现代编译器的特性提高代码质量,增加 warning-free编译选项,使用 AddressSanitizer和 UndefinedBehaviorSanitizer减少代码bug风险。
* C: -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Wwrite-strings -Werror * CC+: -Wall -Wextra -Wformat-security -Wvla -Wundef -Wmissing-format-attribute -Woverloaded-virtual -Wno-missing-field-initializers -Wimplicit-fallthrough=2 -Wlogical-op -Werror
Google C++编码风格
8.0中抛弃了MySQL Server和InnoDB原有的代码风格,采用Google C++编码风格,更便于阅读和贡献代码。
源码文档管理
从8.0开始使用Doxygen管理源码文档,这样能保证代码更新和文档保持同步。
MySQL Source Code Documentation(https://dev.mysql.com/doc/dev/mysql-server/latest)
MySQL 代码历史悠久,官方愿意花这么大力气的重构代码,为MySQL注入新的活力,也预示着MySQL未来会越来越好。
不知道小伙伴们是否留意之前GA的版本号和发布间隔,MySQL 5.6.9(GA),MySQL 5.7.10(GA),MySQL 8.0.11,下个月也将迎来GA。
引用
https://mysqlserverteam.com/mysql-8-0-source-code-improvements/
http://lefred.be/content/top-10-mysql-8-0-features-for-developers/
http://lefred.be/content/top-10-mysql-8-0-features-for-dbas-ops/
上一篇: binlog rotate引发的MySQL阻塞事件
下一篇: MySQL 8.0新特性之原子DDL