文档首页
MySQL 8.4 参考手册
8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 15 条 SQL 语句 / 15.1 数据定义语句 / 15.1.6 ALTER LOGFILE GROUP 语句
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 100%

15.1.6 ALTER LOGFILE GROUP 语句15.1.6 ALTER LOGFILE GROUP Statement

ALTER LOGFILE GROUP logfile_group
    ADD UNDOFILE 'file_name'
    [INITIAL_SIZE [=] size]
    [WAIT]
    ENGINE [=] engine_name

此语句向现有的日志文件组 logfile_group 添加一个名为 'file_name' 的 UNDO 文件。一个 ALTER LOGFILE GROUP 语句只允许有一个 ADD UNDOFILE 子句。目前不支持 DROP UNDOFILE 子句。This statement adds an UNDO file named 'file_name' to an existing log file group logfile_group. An ALTER LOGFILE GROUP statement has one and only one ADD UNDOFILE clause. No DROP UNDOFILE clause is currently supported.

Note

所有 NDB 集群磁盘数据对象共享相同的命名空间。这意味着 每个磁盘数据对象 必须具有唯一名称(不仅仅是每种类型的磁盘数据对象)。例如,你不能让表空间和撤销日志文件同名,也不能让撤销日志文件和数据文件同名。All NDB Cluster Disk Data objects share the same namespace. This means that each Disk Data object must be uniquely named (and not merely each Disk Data object of a given type). For example, you cannot have a tablespace and an undo log file with the same name, or an undo log file and a data file with the same name.

可选的 INITIAL_SIZE 参数用于设置 UNDO 文件的初始大小(字节);如果未指定,初始大小默认为 134217728(128 MB)。您可以选择在 size 后跟一个表示数量级的单字母缩写,类似于 my.cnf 中使用的缩写。通常,这个字母是 M(兆字节)或 G(吉字节)之一。(Bug #13116514, Bug #16104705, Bug #62858)The optional INITIAL_SIZE parameter sets the UNDO file's initial size in bytes; if not specified, the initial size defaults to 134217728 (128 MB). You may optionally follow size with a one-letter abbreviation for an order of magnitude, similar to those used in my.cnf. Generally, this is one of the letters M (megabytes) or G (gigabytes). (Bug #13116514, Bug #16104705, Bug #62858)

在 32 位系统上,INITIAL_SIZE 支持的最大值为 4294967296(4 GB)。(Bug #29186)On 32-bit systems, the maximum supported value for INITIAL_SIZE is 4294967296 (4 GB). (Bug #29186)

INITIAL_SIZE 允许的最小值为 1048576(1 MB)。(Bug #29574)The minimum allowed value for INITIAL_SIZE is 1048576 (1 MB). (Bug #29574)

Note

WAIT 会被解析,但除此之外会被忽略。这个关键字目前没有任何作用,旨在为将来的扩展预留。WAIT is parsed but otherwise ignored. This keyword currently has no effect, and is intended for future expansion.

ENGINE 子句(必需)决定该日志文件组使用的存储引擎,其中 engine_name 是存储引擎的名称。目前,engine_name 唯一被接受的值是 “NDBCLUSTER” 和 “NDB”。这两个值是等价的。The ENGINE clause (required) determines the storage engine which is used by this log file group, with engine_name being the name of the storage engine. Currently, the only accepted values for engine_name are “NDBCLUSTER” and “NDB”. The two values are equivalent.

这是一个示例,假设日志文件组 lg_3 已经使用 CREATE LOGFILE GROUP 创建(参见 第 15.1.16 节,“CREATE LOGFILE GROUP 语句”):Here is an example, which assumes that the log file group lg_3 has already been created using CREATE LOGFILE GROUP (see Section 15.1.16, “CREATE LOGFILE GROUP Statement”):

ALTER LOGFILE GROUP lg_3
    ADD UNDOFILE 'undo_10.dat'
    INITIAL_SIZE=32M
    ENGINE=NDBCLUSTER;

当使用 ALTER LOGFILE GROUP 并指定 ENGINE = NDBCLUSTER(或者 ENGINE = NDB)时,会在每个 NDB Cluster 数据节点上创建一个撤消日志文件。您可以通过查询信息模式中的 FILES 表来验证撤消文件是否已创建,并获取相关信息。例如:When ALTER LOGFILE GROUP is used with ENGINE = NDBCLUSTER (alternatively, ENGINE = NDB), an undo log file is created on each NDB Cluster data node. You can verify that the undo files were created and obtain information about them by querying the Information Schema FILES table. For example:

mysql> SELECT FILE_NAME, LOGFILE_GROUP_NUMBER, EXTRA
    -> FROM INFORMATION_SCHEMA.FILES
    -> WHERE LOGFILE_GROUP_NAME = 'lg_3';
+-------------+----------------------+----------------+
| FILE_NAME   | LOGFILE_GROUP_NUMBER | EXTRA          |
+-------------+----------------------+----------------+
| newdata.dat |                    0 | CLUSTER_NODE=3 |
| newdata.dat |                    0 | CLUSTER_NODE=4 |
| undo_10.dat |                   11 | CLUSTER_NODE=3 |
| undo_10.dat |                   11 | CLUSTER_NODE=4 |
+-------------+----------------------+----------------+
4 rows in set (0.01 sec)

(参见 第 28.3.15 节,“INFORMATION_SCHEMA FILES 表”。)(See Section 28.3.15, “The INFORMATION_SCHEMA FILES Table”.)

用于 UNDO_BUFFER_SIZE 的内存来自全局池,该池的大小由 SharedGlobalMemory 数据节点配置参数的值决定。这包括由 InitialLogFileGroup 数据节点配置参数设置所暗示的此选项的任何默认值。Memory used for UNDO_BUFFER_SIZE comes from the global pool whose size is determined by the value of the SharedGlobalMemory data node configuration parameter. This includes any default value implied for this option by the setting of the InitialLogFileGroup data node configuration parameter.

ALTER LOGFILE GROUP 仅对 NDB Cluster 的磁盘数据存储有用。有关更多信息,请参见 第 25.6.11 节,“NDB Cluster 磁盘表”。ALTER LOGFILE GROUP is useful only with Disk Data storage for NDB Cluster. For more information, see Section 25.6.11, “NDB Cluster Disk Data Tables”.