13.1.6 ALTER LOGFILE GROUP Statement语句

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

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

Note注意

All NDB Cluster Disk Data objects share the same namespace. 所有NDB群集磁盘数据对象共享相同的命名空间。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.例如,不能有同名的表空间和撤消日志文件,也不能有同名的撤消日志文件和数据文件。

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). 可选的INITIAL_SIZE参数以字节为单位设置UNDO文件的初始大小;如果未指定,则初始大小默认为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. 您可以选择在size后面加一个单字母的缩写,表示一个数量级,类似于my.cnf中使用的缩写。Generally, this is one of the letters M (megabytes) or G (gigabytes). 通常,这是字母M(兆字节)或G(千兆字节)中的一个。(Bug #13116514, Bug #16104705, Bug #62858)

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

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

Note注意

WAIT is parsed but otherwise ignored. WAIT被解析,但在其他方面被忽略。This keyword currently has no effect, and is intended for future expansion.此关键字目前无效,用于将来扩展。

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

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

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

When ALTER LOGFILE GROUP is used with ENGINE = NDBCLUSTER (alternatively, ENGINE = NDB), an UNDO log file is created on each NDB Cluster data node. ALTER LOGFILE GROUPENGINE=NDBCLUSTER(或者ENGINE = NDB)一起使用时,将在每个NDB群集数据节点上创建一个撤消日志文件。You can verify that the UNDO files were created and obtain information about them by querying the INFORMATION_SCHEMA.FILES table. 您可以通过查询INFORMATION_SCHEMA.FILES表来验证是否创建了UNDO文件,并获取有关这些文件的信息。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)

(See Section 26.3.15, “The INFORMATION_SCHEMA FILES Table”.)(请参阅第26.3.15节,“信息模式文件表”。)

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. 用于UNDO_BUFFER_SIZE的内存来自全局池,其大小由SharedGlobalMemory数据节点配置参数的值决定。This includes any default value implied for this option by the setting of the InitialLogFileGroup data node configuration parameter.这包括通过设置InitialLogFileGroup数据节点配置参数为该选项暗示的任何默认值。

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