文档:MySQL 8.0版本日志.note
链接:http://note.youdao.com/noteshare?id=a8b71e5c978fabb4f204773562908f63&sub=45B9DC453C3C4E9EA23522F33D8C4462
参考MySQL :: MySQL 8.0 Release Notes :: Changes in MySQL 8.0.0 (2016-09-12, Development Milestone)
账户管理
- 不兼容的更改:MySQL系统数据库的授权表已由MyISAM表(非事务性)更改为InnoDB(事务性)表。这个改变适用于如下表:user, db, tables_priv, columns_priv,procs_priv, proxies_priv.
授权表存储引擎变化时账户管理语句行为变化的基础。之前,管理多个用户的账户管理语句可能对一些用户生效,对一些用户无效。现在,每个语句都是事务型的,要么对所有用户都生效,要么一旦有任何报错都无效回滚。如果语句执行成功则写入二进制日志,否则不写入日志,回滚而不产生任何影响。上述行为适用于如下语句: ALTER USER, CREATE ROLE, CREATE USER, DROP ROLE, DROP USER, GRANT, RENAME USER, REVOKE.(SET PASSWORD没有被列出,是因为它应用于至多一个用户而且实际上已经是事务性的) 这种行为变化的一个副作用是,当在MySQL 8.0从属服务器上复制时,MySQL 5.7主服务器上部分完成的帐户管理语句会失败。
- MySQL现在支持角色了。角色是命名的权限集合。
- 角色可以被创建和删除。
- 角色可以被授权和回收权限。
- 角色可以授权给用户账户,也可以从用户账户处回收。
- 账户可以从已被授权的角色中选择角色激活,也可以在账户会话中更改。
C API
libmysqlclient 共享库主版本号从 20 (被 MySQL 5.7使用) 增长为 21(被MySQL 8.0使用).
Character Set Support
- utf8mb4 Unicode 字符集新增一个比对方法(collation) utf8mb4_0900_ai_ci.
编译
组件
MySQL服务器现在包含一个基于组件的基础架构来提升服务器的扩展性:
- 组件提供的服务对服务器和其他组件都可用。(就服务使用而言,服务器是一个组件,等同于其他组件。)组件仅通过它们提供的服务相互交互。
- INSTALL COMPONENT 和UNINSTALL COMPONENT 语句为运行时组件操控提供一个SQL接口 。
- 一个加载器服务注册已安装的组件到 mysql.component系统表,并在后续服务器重启的启动队列事件期间安装已注册的组件。
配置
- 不兼容的更改;InnoDB:以前,启用innodb_read_only系统变量可以阻止只为InnoDB存储创建和删除表。从MySQL 8.0开始。启用innodb_read_only可以阻止对所有存储引擎执行这些操作。表创建和删除操作修改mysql系统数据库中的数据字典表,但是这些表使用InnoDB存储引擎,当启用innodb_read_only时不能修改。同样的原则也适用于需要修改数据字典表的其他表操作,以及使用InnoDB存储引擎修改mysql数据库中的其他表的操作,比如grant表和func和plugin表。(错误# 21611899)
- 硬编码内存页大小为8KB的内存映射事务协调器对于ARM64和PowerPC等页面大得多的平台来说太小了。服务器现在调用一个系统调用来获取当前平台的页面大小,而不是使用硬编码的值。--log-tc-size选项的结果是最小值和默认值现在是页面大小的6倍。此外,该值必须是页面大小的倍数。感谢Alexey Kopytov提供的补丁。(Bug #23014086, Bug #80818, Bug #26931470, Bug #87995)
- MySQL现在支持SET语句语法的SET PERSIST变体,用于在运行时进行配置更改,这些更改也可以跨服务器重启进行持久化。与SET GLOBAL一样,SET PERSIST允许用于任何动态的全局系统变量(在运行时可设置)。该语句更改运行时变量值,但也将变量设置写入data目录中名为mysqld-auto.cnf的选项文件。在启动时,服务器在所有其他选项文件之后处理此文件。有关更多信息,请参见Persisted System Variables.
为了提供显示每个系统变量最近的配置信息,Performance Schema现在有一个variables_info表,其中列出了每个系统变量及其值的来源。参见Performance Schema variables_info Table.。
如果从早期版本升级到这个MySQL版本,则必须运行mysql_upgrade(并重新启动服务器),以便将此更改合并到 Performance Schema中。
- 已废弃的mysql_install_db程序已从MySQL发行版中删除。应该使用--initialize或--initialize-insecure选项调用mysqld来执行数据目录初始化。此外,mysql_install_db使用的mysqld的不赞成的--bootstrap选项已经被删除,控制mysql_install_db安装位置的INSTALL_SCRIPTDIR CMake选项也已经被删除。
版本1测试套件代码以前位于MySQL源发行版的mysql-test/lib/v1目录中。这段代码使用了mysql_install_db并已被删除。不再支持MYSQL_INSTALL_DB环境变量和MTR_VERSION环境变量的值1。
数据字典
不兼容的更改
数据字典的主要变更是
1)整合了元数据文件(事务性)和非事务性系统表,利用缓存将其缓存在内存,通过LRU算法维护
2)INFORMATION_SCHEMA不再是表,而是基于底层数据字典表的视图
3)底层数据字典缓存到内存而不是临时表空间,且其上的索引可以利用优化器高效查询计划提高查询效率。
MySQL服务器现在合并了一个全局数据字典,其中包含事务表中关于数据库对象的信息。在以前的MySQL版本中,字典数据存储在元数据文件和非事务性系统表中。
下面的列表简要描述了此更改的主要影响:
- .frm元数据文件以前与基表和视图相关联的表和视图已不复存在。以前存储在.frm文件中的元数据现在存储在数据字典表中。
类似地,以前存储在. trg和. trn文件中的触发器元数据存储在数据字典表中,这些文件不再存在。
- 删除.frm文件后,.frm文件结构所施加的64KB表定义大小限制就消失了
- 删除.frm文件后,INFORMATION_SCHEMA.TABLES VERSION字段现在报告一个硬编码的值10,这是MySQL 5.7中使用的最后一个.frm文件版本。
- 一个新的dictionary对象缓存,它服务于MySQL数据字典,将以前访问过的数据字典对象存储在内存中,以支持对象重用和最小化磁盘I/O。基于逻辑单元的回收策略用于从内存中回收最近最少使用的对象。缓存由多个存储不同对象类型的分区组成。有关更多信息,请参见字典对象缓存。
新的内部数据字典api使服务器、内部存储引擎和插件能够访问和存储MySQL数据字典中的数据。引入内 部数据字典api来处理模式、表空间、表空间文件、表、分区表、表分区数据、触发器、存储例程、事件、表对 象、视图、字符集和排序。
通过此更改,用于CREATE TRIGGER 和 DROP TRIGGER 操作的数据字典更新和二进制日志写入将组合到单个原子事务中。
- 数据字典表是不可见的,但在大多数情况下,可以查询相应的INFORMATION_SCHEMA表。这允许在服务器开发过程中更改底层数据字典表,同时维护一个稳定的INFORMATION_SCHEMA接口供应用程序使用。
一些INFORMATION_SCHEMA表被完全重新实现为数据字典表的视图:
CHARACTER_SETS COLLATIONS COLLATION_CHARACTER_SET_APPLICABILITY COLUMNS KEY_COLUMN_USAGE SCHEMATA STATISTICS TABLES TABLE_CONSTRAINTS VIEWS
这些表上的查询现在更有效,因为它们从数据字典表获得信息,而不是通过其他更慢的方法。特别是,对于每个作为数据字典表视图的INFORMATION_SCHEMA表:
- 服务器不再必须为INFORMATION_SCHEMA表的每个查询创建临时表。
- 当底层数据字典表存储以前通过目录扫描获得的值(例如,枚举数据库名或数据库中的表名)或文件打开操作(例如,从.frm文件中读取信息)时,对这些值的INFORMATION_SCHEMA查询现在使用表查找。(此外,即使对于非视图INFORMATION_SCHEMA表,也可以通过从数据字典中查找来检索数据库和表名等值,不需要目录或文件扫描。)
- 底层数据字典表上的索引允许优化器构造高效的查询执行计划,而以前使用每个查询一个临时表处理INFORMATION_SCHEMA表的实现则不允许这样做。
前面的改进还适用于显示相应的作为数据字典表上的视图的INFORMATION_SCHEMA表信息的SHOW语句。例如,SHOW DATABASES显示与SCHEMATA表相同的信息。
对于检索表统计信息的INFORMATION_SCHEMA查询,服务器现在可以使用INFORMATION_SCHEMA表中缓存的统计信息,或者直接从存储引擎获取最新的统计信息。information_schema_stats系统变量控制服务器使用的统计信息源。
- 当information_schema_stats是CACHED(缺省值)时,服务器使用存储在统计信息和表中的高速缓存统计信息。
- 当information_schema_stats是LATEST时,服务器直接从存储引擎获取统计信息。因此,服务器将对统计信息和表的查询视为对存储在STATISTICS_DYNAMIC和TABLES_DYNAMIC表中的最新统计信息的查询。
受影响的INFORMATION_SCHEMA表统计列包括:
STATISTICS.CARDINALITY TABLES.AUTO_INCREMENT TABLES.AVG_ROW_LENGTH TABLES.CHECKSUM TABLES.CHECK_TIME TABLES.CREATE_TIME TABLES.DATA_FREE TABLES.DATA_LENGTH TABLES.INDEX_LENGTH TABLES.MAX_DATA_LENGTH TABLES.TABLE_ROWS TABLES.UPDATE_TIME
有关更多信息,请参见Optimizing INFORMATION_SCHEMA Queries.
foreign_keys和foreign_key_column_usage现在存储外键信息。获取外键信息的标准SQL方法是使用REFERENTIAL_CONSTRAINTS 和KEY_COLUMN_USAGE表;这些表现在通过作为foreign_keys、foreign_key_column_usage和其他数据字典表的视图实现。
对于某些外键错误,服务器现在会生成更合适、更有用的错误消息。
注意:
不兼容性:以前,MySQL支持长度超过64个字符的外键名。按照SQL标准,存储在foreign_keys和foreign_key_column_usage表中的外键名最多为64个字符,因此不再允许使用更长的外键名。
- 因为数据字典提供了关于数据库对象的信息,所以服务器不再检查data目录中的目录名来查找数据库。因此,--ignore-db-dir选项和ignore_db_dirs系统变量是无关的,并且已经被删除。相应地更新系统配置和应用程序。
- 以前,可以使用CREATE TEMPORARY TABLE通过用不存在的数据库的名称限定表名在不存在的数据库中创建表。今后不再被允许。
- 系统表的变化:
- 许多系统表已经从MyISAM(非事务性)表转换为InnoDB(事务性)表。例如,正如在这些发布说明的其他地方 所讨论的,grant表现在是InnoDB表。其他的例子如下。
- 在mysql系统数据库中存储用户定义函数信息的func表现在是一个InnoDB(事务)表。以前,它是一个MyISAM(非事务性)表。
- 由于这种变化,CREATE FUNCTION和DROP FUNCTION语句会导致隐式提交,即使在用于用户定义的函数时也是如此(参见Statements That Cause an Implicit Commit))。在以前,它们在用于存储函数而不是用户定义函数时导致隐式提交。
- 以前,stored routines和events信息存储在mysql系统数据库的proc和event表中。那些表不再使用了。相反,关于stored routines和events信息存储在mysql系统数据库中的 routines, events, 和parameters数据字典表中。旧表使用MyISAM(非事务性)存储引擎。新表使用InnoDB(事务)引擎。
以前,创建包含非法字符的stored routines会产生警告,现在是一个错误。
- 为了将对系统表(例如,时区或日志表)的访问与对非系统表的访问区分开来,服务器使用Locking system tables和 Opening system tables的线程状态,而不是System lock 和Opening tables 的线程状态。参见 General Thread States.
- InnoDB更改:
- 永久InnoDB表空间现在包括 Serialized Dictionary Information (SDI)事务性存储,它是序列化形式的字典对象数据。随着前面提到的.frm和触发器元数据文件的消失,您可能会注意到. sdi文件的出现。这些是序列化的字典信息文件。SDI事务存储是为尚未完全实现的正在开发的特性保留的。
- 一个新的命令行实用程序ibd2sdi用于从持久的InnoDB表空间中提取序列化的字典信息(SDI)。在这个版本中,SDI数据没有出现在持久的InnoDB表空间中。ibd2sdi实用程序保留供将来使用。
- 对InnoDB启动代码进行重构,以支持对MySQL数据进行初始化更改。
- 升级和降级影响:
- 要从MySQL 5.7升级到MySQL 8.0,必须执行在 Upgrading MySQL中描述的升级过程。
- 只支持使用逻辑降级方法(mysqldump降级)从MySQL 8.0降级到MySQL 5.7。不支持就地降级。
(Bug #80481, Bug #22811659)
Data Type Notes
位函数支持大于64位的参数和返回值。
- Bit functions and operators comprise BIT_COUNT(), BIT_AND(), BIT_OR(), BIT_XOR(), &, |, ^, ~, <<, and >>. Prior to MySQL 8.0, bit functions and operators required BIGINT (64-bit integer) arguments and returned BIGINT values, so they had a maximum range of 64 bits. Non-BIGINT arguments were converted to BIGINT prior to performing the operation and truncation could occur. Now bit functions and operators permit binary string type arguments (BINARY, VARBINARY, and the BLOB types) and return a value of like type, which enables them to take arguments and produce return values larger than 64 bits. Nonbinary string arguments are converted to BIGINT and processed as such, as before.
Permitting binary string arguments for bit functions and operators makes it easier not only to manipulate larger values, but to perform bit operations not easily done previously on certain types of data, such as UUID and IPv6 values. For examples, see Bit Functions and Operators.
An implication of this change in behavior is that bit operations on binary string arguments might produce a different result in MySQL 8.0 than in 5.7. For information about how to prepare in MySQL 5.7 for potential incompatibilities between MySQL 5.7 and 8.0, see Bit Functions and Operators, in MySQL 5.7 Reference Manual.
Doxygen Notes
源码的内部文档已经更新位采用Doxygen归档。
- The MySQL source code has been updated to use Doxygen for the internal documentation. This is a work in progress. As new MySQL versions are distributed, the Doxygen documentation will be updated, with the latest version always available at MySQL :: Other MySQL Documentation.
It is also possible to generate the Doxygen content locally from a MySQL source distribution using the instructions atGenerating MySQL Doxygen Documentation Content.
Optimizer Notes
- 使用可变大小的记录缓存来替换旧的固定大小的记录缓存。
- 支持表级别MERGE和NO_MERGE注释。
- 支持不可见索引。不可见索引不会被优化器使用,目的是用来测试创建某个非聚集索引带来的影响。
- mysql库引入一个column_stats 表用来存储列值统计信息。
- InnoDB: The storage engine interface now enables the optimizer to provide information about the size of the record buffer to be used for scans that the optimizer estimates will read multiple rows. The buffer size can vary based on the size of the estimate. InnoDB uses this variable-size buffering capability to take advantage of row prefetching, and to reduce the overhead of latching and B-tree navigation. Previously, InnoDB used a small, fixed-size buffer.
- The optimizer now supports table-level MERGE and NO_MERGE hints for specifying whether derived tables or views should be merged into the outer query block or materialized using an internal temporary table. Examples:
SELECT /*+ MERGE(dt) */ * FROM (SELECT * FROM t1) AS dt; SELECT /*+ NO_MERGE(dt) */ * FROM (SELECT * FROM t1) AS dt;
For more information, see Optimizer Hints. (Bug #79554, Bug #22328100)
- MySQL now supports invisible indexes. An invisible index is not used by the optimizer at all, but is otherwise maintained normally. Indexes are visible by default. Invisible indexes make it possible to test the effect of removing an index on query performance, without making a destructive change that must be undone should the index turn out to be required. This feature applies to InnoDB tables, for indexes other than primary keys.
To control whether an index is invisible explicitly for a new index, use a VISIBLE or INVISIBLE keyword as part of the index definition for CREATE TABLE, CREATE INDEX, or ALTER TABLE. To alter the invisibility of an existing index, use aVISIBLE or INVISIBLE keyword with the ALTER TABLE ... ALTER INDEX operation. For more information, see Invisible Indexes.
- The mysql system database now contains a column_stats table designed to store statistics about column values. For more information, see Optimizer Statistics.
Packaging Notes(略)
Parser Notes
- The parser rules for SELECT and UNION were refactored to be more consistent (the same SELECT syntax applies uniformly in each such context) and reduce duplication. Several user-visible effects resulted from this work:
-
- NATURAL JOIN permits an optional INNER keyword (NATURAL INNER JOIN), in compliance with standard SQL.
- Right-deep joins without parentheses are permitted (for example, ... JOIN ... JOIN ... ON ... ON), in compliance with standard SQL.
- STRAIGHT_JOIN now permits a USING clause, similar to other inner joins.
- The parser accepts parentheses around query expressions. For example, (SELECT ... UNION SELECT ...) is permitted.
- The parser better conforms to the documented permitted placement of the SQL_CACHE and SQL_NO_CACHE query modifiers.
- Left-hand nesting of unions, previously permitted only in subqueries, is now permitted in top-level statements. For example, this statement is now accepted as valid:
(SELECT 1 UNION SELECT 1) UNION SELECT 1;
(Bug #11746363, Bug #25734)
- The parser rules for CREATE TABLE were refactored to be context independent and improve maintainability and extensibility. Several user-visible effects resulted from this work:
-
- For generated columns, including NOT NULL NULL resulted in a column that included the NOT NULL attribute, which differed from nongenerated columns. Such definitions now use the final attribute NULL, resulting in a nullable column (consistent with nongenerated columns).
- CREATE TEMPORARY TABLE no longer permits multiple instances of TEMPORARY.
- Previously, PARSE_GCOL_EXPR was a keyword and could not be used as a label in stored programs. It is no longer a keyword and can be used as a label.
- Messages for some syntax errors are more precise with respect to the location of the error within the statement.
Performance Schema Notes
- Incompatible Change: The Performance Schema now instruments server errors (and warnings), and exposes statistical information about them through a set of summary tables:
-
- The error instrument controls whether error information is collected (enabled by default).
- Several tables contain error information, summarized in various ways: events_errors_summary_global_by_error,events_errors_summary_by_account_by_error, events_errors_summary_by_host_by_error,events_errors_summary_by_thread_by_error, events_errors_summary_by_user_by_error.
- The performance_schema_error_size system variable controls the number of instrumented errors.
For more information, see Error Summary Tables
In consequence of the preceding changes, two server error symbols were renamed:ER_CANT_SET_ENFORCE_GTID_CONSISTENCY_ON_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS is nowER_CANT_ENFORCE_GTID_CONSISTENCY_WITH_ONGOING_GTID_VIOLATING_TX andER_SET_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TRANSACTIONS is nowER_ENFORCE_GTID_CONSISTENCY_WARN_WITH_ONGOING_GTID_VIOLATING_TX.
- Previously, the DIGEST and DIGEST_TEXT columns in the Performance Schema events_statements_current table were populated only after statement execution ended. Now, the columns are populated just after parsing and before statement execution begins. This enables monitoring applications to access statement digest information during statement execution. (Bug #23336542)
- Previously, Performance Schema optimizations focused on reducing the overhead involved in collecting monitoring data. Complementing that earlier work, overhead now is also reduced for Performance Schema queries that retrieve that data. This is achieved by the addition of indexes to most Performance Schema tables, which gives the optimizer access to execution plans other than full table scans. These indexes also improve performance for related objects, such as sysschema views that use those tables. For more information, see Optimizing Performance Schema Queries.
- The size of the ROLE column of the setup_actors Performance Schema table was increased from 16 to 32 characters.
Security Notes
- The validate_password_check_user_name system variable is now enabled by default rather than disabled. This means that when the validate_password plugin is enabled, by default it now rejects passwords that match the current session user name.
- The client-side --ssl and --ssl-verify-server-cert options have been removed. Use --ssl-mode=REQUIRED instead of --ssl=1 or --enable-ssl. Use --ssl-mode=DISABLED instead of --ssl=0, --skip-ssl, or --disable-ssl. Use --ssl-mode=VERIFY_IDENTITY instead of --ssl-verify-server-cert options. (The server-side --ssl option remains unchanged.)
For the C API, MYSQL_OPT_SSL_ENFORCE and MYSQL_OPT_SSL_VERIFY_SERVER_CERT options for mysql_options()correspond to the client-side --ssl and --ssl-verify-server-cert options and have been removed. Use MYSQL_OPT_SSL_MODE with an option value of SSL_MODE_REQUIRED or SSL_MODE_VERIFY_IDENTITY instead.
Spatial Data Support(略)
Test Suite Notes(略)
X Plugin Notes(略)
Functionality Added or Changed
- Incompatible Change; Partitioning: The generic partitioning handler has been removed from the MySQL server. As part of this change, mysqld no longer supports the --partition and --skip-partition options, and the server can no longer be built using -DWITH_PARTITION_STORAGE_ENGINE. partition is also no longer displayed in the output of SHOW PLUGINS, or shown in the INFORMATION_SCHEMA.PLUGINS table.
In order to support partitioning of a given table, the storage engine used for the table must now provide its own (“native”) partitioning handler. InnoDB is the only storage engine supported in MySQL 8.0 which includes a native partitioning handler. An attempt to create partitioned tables in MySQL 8.0 using any other storage engine fails. (The NDB storage engine used by MySQL NDB Cluster also provides its own partitioning handler, but is currently not supported by MySQL 8.0.)
Effects on upgrades. The direct upgrade of a partitioned table using a storage engine other than InnoDB (such asMyISAM) from MySQL 5.7 (or earlier) to MySQL 8.0 is not supported. There are two options for upgrading such a table to be compatible with MySQL 8.0, listed here:
-
- Remove the table's partitioning; you can do this without any data loss by executing an ALTER TABLE ... REMOVE PARTITIONING statement.
- Change the storage engine used for the table to InnoDB, using ALTER TABLE ... ENGINE=INNODB; this leaves the table's partitioning in place. At least one of these operations must be performed for any partitioned non-InnoDBtable, prior to upgrading the server to MySQL 8.0. Otherwise, such a table cannot be used following the upgrade.
For information about converting MyISAM tables to InnoDB, see Converting Tables from MyISAM to InnoDB.
An analogous situation is met when importing databases from a dump file that was created in MySQL 5.7 or earlier usingmysqldump into a MySQL 8.0 server, due to the fact that table creation statements that would result in a partitioned table using a storage engine without such support fail with an error in MySQL 8.0. For this reason you must ensure that any statements in the dump file creating partitioned tables do not also specify an unsupported storage engine. You can do this either by removing any references to partitioning from CREATE TABLE statements that use a value for the STORAGE ENGINE option other than InnoDB, or by specifying the storage engine as InnoDB (or allowing InnoDB to be used by default).
For more information, see Partitioning Limitations Relating to Storage Engines.
- Important Change; InnoDB: The following InnoDB file format configuration options were deprecated in MySQL 5.7.7 and are now removed:
-
- innodb_file_format
- innodb_file_format_check
- innodb_file_format_max
- innodb_large_prefix
File format configuration options were necessary for creating tables compatible with earlier versions of InnoDB in MySQL 5.1. Now that MySQL 5.1 has reached the end of its product lifecycle, these options are no longer required.
The FILE_FORMAT column was removed from the INNODB_SYS_TABLES and INNODB_SYS_TABLESPACES Information Schema tables.
- InnoDB: The innodb_buffer_pool_debug option permits multiple buffer pool instances when the buffer pool is less than 1GB in size, ignoring the 1GB minimum buffer pool size constraint imposed on innodb_buffer_pool_instances. (Bug #24287290)
- InnoDB: A new dynamic configuration option, innodb_deadlock_detect, may be used to disable deadlock detection. On high concurrency systems, deadlock detection can cause a slowdown when numerous threads wait for the same lock. At times, it may be more efficient to disable deadlock detection and rely on the innodb_lock_wait_timeout setting for transaction rollback when a deadlock occurs. (Bug #23477773)
- InnoDB: The libinnodb_zipdecompress.a library allows external tools to use the page_zip_decompress_low() function to decompress InnoDB pages. (Bug #21405300, Bug #77664)
- InnoDB: To address contention that could occur under some workloads, the buffer pool mutex was removed and replaced by several list and hash protecting mutexes. Also, several buffer pool related variables no longer require buffer pool mutex protection. Thanks to Yasufumi Kinoshita and Laurynas Biveinis for the patch. (Bug #20381905, Bug #75534)
- InnoDB: InnoDB now avoids intermediate commits that would occur every 10000 rows during ALTER TABLE ALGORITHM=COPY operations. The purpose of intermediate commits was to speed up recovery in the case of an abortedALTER TABLE ALGORITHM=COPY operation. If an ALTER TABLE ALGORITHM=COPY operation is aborted, the new, uncommitted table is now dropped during DDL log recovery before the undo log is rolled back, thereby avoiding time-consuming data rollback for the uncommitted table. Undo logging is now suppressed for ALTER TABLE ALGORITHM=COPYoperations unless there is an IGNORE clause or something else that requires rollback capability.
If there is full-text index on the table being altered, full-text data is inserted into full-text auxiliary tables as the ALTER TABLE ALGORITHM=COPY operation inserts rows into the new, uncommitted table. Previously, full-text data was only processed on transaction commit. (Bug #17479594)
- InnoDB: To reduce read-write lock contention that can result from multiple purge threads purging rows from the same table, undo records are now grouped and assigned to different purge threads by table ID.
- InnoDB: InnoDB code now uses the C++ std::thread library for thread management.
- InnoDB: BLOB code was refactored to provide an internal C++ interface for operations on compressed and uncompressed BLOB data.
- InnoDB: The InnoDB memcached plugin now supports multiple get operations (fetching multiple key/value pairs in a single memcached query) and range queries. See InnoDB memcached Multiple get and Range Query Support.
- InnoDB: The innodb_stats_sample_pages system variable was removed. innodb_stats_sample_pages was deprecated in MySQL 5.6.3 and replaced by innodb_stats_transient_sample_pages.
- InnoDB: When encountering index tree corruption, InnoDB writes a corruption flag to the redo log, which makes the corruption flag crash safe. InnoDB also writes in-memory corruption flag data to an engine-private system table on each checkpoint. During recovery, InnoDB reads corruption flags from both locations and merges results before marking in-memory table and index objects as corrupt.
- InnoDB: The innodb_locks_unsafe_for_binlog system variable was removed. innodb_locks_unsafe_for_binlog was deprecated in MySQL 5.6.3. The READ COMMITTED isolation level provides similar functionality.
- InnoDB: InnoDB no longer creates .isl files (InnoDB Symbolic Link files) when creating tablespace data files outside of the MySQL data directory.
With this change, moving a remote tablespace while the server is offline by manually modifying an .isl file is not supported.
- InnoDB: InnoDB no longer supports compressed temporary tables. When innodb_strict_mode is enabled (the default),CREATE TEMPORARY TABLE returns an error if ROW_FORMAT=COMPRESSED or KEY_BLOCK_SIZE is specified. Ifinnodb_strict_mode is disabled, warnings are issued and the temporary table is created using a non-compressed row format.
With this change, all temporary tables are created in the shared temporary tablespace, ibtmp1.
The PER_TABLE_TABLESPACE and IS_COMPRESSED columns were removed from theINFORMATION_SCHEMA.INNODB_TEMP_TABLE_INFO.
- InnoDB: The new INFORMATION_SCHEMA.INNODB_CACHED_INDEXES table reports the number of index pages cached in theInnoDB buffer pool for each index.
- InnoDB: The innodb_checksums system variable was removed. innodb_checksums was replaced byinnodb_checksum_algorithm in MySQL 5.6.3.
- InnoDB: InnoDB startup code was refactored.
- InnoDB: The innodb_flush_method default value is no longer NULL. On Unix-like systems, the default value is fsync. On Windows systems, the default value is unbuffered.
On Windows, the innodb_flush_method setting no longer affects the innodb_use_native_aio setting. There are now two possible settings for innodb_flush_method on Windows, unbuffered (unbuffered I/O) and normal (buffered I/O). With this change, you can enable asynchronous I/O with buffered I/O, which is a new combination (innodb_use_native_aio=ONand innodb_flush_method=normal). The async_unbuffered setting was removed.
You can now set innodb_flush_method and innodb_change_buffering configuration options using numeric values.
- InnoDB: The innodb_support_xa system variable, which enables support for two-phase commit in XA transactions, was removed. As of MySQL 5.7.10, InnoDB support for two-phase commit in XA transactions is always enabled.
- InnoDB: InnoDB no longer creates an .isl file (InnoDB Symbolic Link files) when creating a file-per-table tablespace data file outside of the MySQL data directory. InnoDB now uses the redo log to locate remote tablespace data files.
Offline relocation of a file-per-table tablespace data file created outside of the MySQL data directory by modifying the.isl file is no longer supported.
- InnoDB: The current maximum auto-increment counter value is now written to the redo log each time the value changes, and saved to an engine-private system table on each checkpoint. These changes make the current maximum auto-increment counter value persistent across server restarts. Additionally:
-
- A server restart no longer cancels the effect of the AUTO_INCREMENT = N table option. If you initialize the auto-increment counter to a specific value, or if you alter the auto-increment counter value to a larger value, the new value is persisted across server restarts.
- A server restart immediately following a ROLLBACK operation no longer results in the reuse of auto-increment values that were allocated to the rolled-back transaction.
- If you modify an AUTO_INCREMENT column value to a value larger than the current maximum auto-increment value (in an UPDATE operation, for example), the new value is persisted, and subsequent INSERT operations allocate auto-increment values starting from the new, larger value.
For more information, see AUTO_INCREMENT Handling in InnoDB, and InnoDB AUTO_INCREMENT Counter Initialization. (Bug #199, Bug #13726455)
- Replication: There are two improvements to how a CHANGE MASTER TO statement is written into the error log (mysqld.log):
-
- Before, no commas were put between the option specifications (for example MASTER_USER = and MASTER_PASSWORD =), so users who wanted to use the statement by copy and paste had to insert the commas manually. Commas are now inserted when the statement is written to the error log.
- When the literal “<secret>” is inserted as a placeholder for the MASTER_PASSWORD value, no quotes are used now, so users who forget to replace the literal with the real password before a copy and paste gets a syntax error immediately, instead of running into other issues.
(Bug #18194384)
- Replication: It is now possible to restore a backup of a GTID-based replication server because you can add GTIDs togtid_purged, regardless of whether gtid_executed is empty or not. This enables you to restore backups from GTID-based replication servers without losing existing GTID information and binary logs. The GTIDs to add are those which existed in gtid_executed at the time of taking the backup. The syntax for SET GTID_PURGED has been extended so that SET GTID_PURGED ="+gtid_set" adds gtid_set to the existing gtid_purged GTID set.
- Replication: New Performance Schema stages have been added to show the progress of row-based replication. You can use these stages to check the progress of slow operations in row-based replication. Additionally you can find out which database the changes are being applied to. This assists in troubleshooting row-based replication issues and provides more information for performance tuning. For more information see Monitoring Row-based Replication
- JSON: This release adds an unquoting extraction operator ->>, sometimes also referred to as an inline path operator, for use with JSON documents stored in MySQL. The new operator is similar to the -> operator, but performs JSON unquoting of the value as well. For a JSON column mycol and JSON path expression mypath, the following three expressions are equivalent:
-
- JSON_UNQUOTE( JSON_EXTRACT(mycol, "$.mypath") )
- JSON_UNQUOTE(mycol->"$.mypath")
- mycol->>"$.mypath"
The ->> operator can be used in SQL statements wherever JSON_UNQUOTE(JSON_EXTRACT()) would be allowed. This includes (but is not limited to) SELECT lists, WHERE and HAVING clauses, and ORDER BY and GROUP BY clauses.
For more information, see Functions That Search JSON Values, and JSON Path Syntax. (Bug #78736, Bug #21980346)
- To produce more accurate estimates, the MEMORY storage engine now calculates index statistics (records per key estimates) using floating-point rather than integer arithmetic. (Bug #23024059)
- A new CMake option, INSTALL_STATIC_LIBRARIES, enables control over whether to install static libraries. The default isON. If set to OFF, these libraries are not installed: libmysqlclient.a, libmysqld.a, libmysqlservices.a. (Bug #22891432)
- The internal mysql_prepare_create_table() server function has been refactored for improved code maintainability and clarity. This code revision results in the following minor changes of behavior for CREATE TABLE and ALTER TABLE:
-
- Attempts to create a second primary key based on a NULL column now produce an ER_MULTIPLE_PRI_KEY error rather than ER_PRIMARY_CANT_HAVE_NULL.
- Attempts to create a second primary key based on a generated column now produce an ER_MULTIPLE_PRI_KEY error rather than ER_UNSUPPORTED_ACTION_ON_GENERATED_COLUMN.
- Attempts to create a full-text key on a JSON column now produce an ER_JSON_USED_AS_KEY error rather thanER_BAD_FT_COLUMN.
- Attempts to create a key in a storage engine that does not support keys (for example, EXAMPLE) now produce anER_TOO_MANY_KEYS error rather than ER_TOO_MANY_KEY_PARTS.
(Bug #22884886)
- Previously, the Performance Schema was not built for libmysqld, the embedded server. This prevented use of the SHOW STATUS and SHOW VARIABLES statements with show_compatibility_56=OFF because, with that setting, those statements take their results from Performance Schema tables. Now for libmysqld, the required Performance Schema tables are built (with no instrumentation collected), so that those SHOW statements can be supported withshow_compatibility_56=OFF. (Bug #22809694)
- Several internal functions used by JSON_CONTAINS(), JSON_SEARCH(), and other MySQL JSON functions created excessive numbers of local copies of keys, values, or both, when performing inspections of JSON objects. Such copying has been eliminated or reduced in many cases. In addition, the lifetimes of temporary objects used by some of these functions have been reduced. These changes should make these and related JSON functions perform more efficiently than previously, and with fewer resources required. (Bug #22602142)
- If the system lz4 and openssl zlib commands are available, the lz4_decompress and zlib_decompress utilities are unneeded. Two changes enable those utilities not to be built: If the new WITH_LZ4 CMake option is set to system,lz4_decompress is not built or installed. If the WITH_ZLIB CMake option is set to system, zlib_decompress is not built or installed. (Bug #22329851)
- Source files for the MySQL strings library have been converted from C (.c suffix) to C++ (.cc suffix). This enables stricter compilation checks and use of C++ features in the library code. (Bug #22124719)
- Source code for the mysys library now uses C++ rather than C to take advantage of stricter compilation checks and permit use of C++ features. (Bug #21881278)
- For improved performance and better compatibility with other platforms, my_sync() on OS X now uses fsync() rather than fcntl() with the F_FULLSYNC flag. (Bug #20742269)
- A new CMake option, WITH_TSAN, permits enabling ThreadSanitizer for compilers that support it. (Bug #80409, Bug #23171902)
- The global list of connections, previously protected by a single mutex, has been partitioned into eight parts, each protected by its own instance of the mutex. The result is a reduction of overhead and improved performance for connection processing. An implication of this change for monitoring purposes is that the Performance Schema now exposes eight different instances each of the LOCK_thd_list mutex, LOCK_thd_remove mutex, and COND_thd_listcondition variable.
- MySQL now provides functions to manipulate UUID values and make them easier to work with:
-
- UUID_TO_BIN() and BIN_TO_UUID() convert between UUID values in string and binary formats (represented as hexadecimal characters and VARBINARY(16), respectively). This permits conversion of string UUID values to binary values that take less storage space. UUID values converted to binary can be represented in a way that permits improved indexing efficiency.
- IS_UUID() returns 1 or 0 to indicate whether its argument is a valid string-format UUID value.
For more information about these functions, see Miscellaneous Functions
- The mysql_plugin utility has been removed. Alternatives include loading plugins at server startup using the --plugin-load or --plugin-load-add option, or at runtime using the INSTALL PLUGIN statement.
- The server now relies on storage engines to clean up temporary tables left from previous server runs. InnoDB does this by discarding the temporary tablespace on restart. MyISAM and other similar storage engines still rely on scanning the temporary directory to detect leftover tables, by looking for files belonging to these engines with a certain name pattern.
- The deprecated mysql_shutdown() C API function and corresponding COM_SHUTDOWN client/server protocol command have been removed. Instead, use mysql_query() to execute a SHUTDOWN statement.
- The server no longer performs conversion of pre-MySQL 5.1 database names containing special characters to 5.1 format with the addition of a #mysql50# prefix. Because these conversions are no longer performed, the --fix-db-names and --fix-table-names options for mysqlcheck, the UPGRADE DATA DIRECTORY NAME clause for the ALTER DATABASE statement, and the Com_alter_db_upgrade status variable have been removed.
Upgrades are supported only from one major version to another (for example, 5.0 to 5.1, or 5.1 to 5.5), so there should be little remaining need for conversion of older 5.0 database names to current versions of MySQL. As a workaround, upgrade a MySQL 5.0 installation to MySQL 5.1 before upgrading to a more recent release.
Bugs Fixed(略)