CREATE LOGFILE GROUPlogfile_group
ADD UNDOFILE 'undo_file
' [INITIAL_SIZE [=]initial_size
] [UNDO_BUFFER_SIZE [=]undo_buffer_size
] [REDO_BUFFER_SIZE [=]redo_buffer_size
] [NODEGROUP [=]nodegroup_id
] [WAIT] [COMMENT [=] 'string
'] ENGINE [=]engine_name
This statement creates a new log file group named 此语句创建一个名为logfile_group
having a single UNDO
file named 'undo_file
'. logfile_group
的新日志文件组,该组有一个名为'
的撤销文件。undo_file
'A CREATE LOGFILE GROUP
statement has one and only one ADD UNDOFILE
clause. CREATE LOGFILE GROUP
语句只有一个ADD UNDOFILE
子句。For rules covering the naming of log file groups, see Section 9.2, “Schema Object Names”.有关日志文件组命名的规则,请参阅第9.2节,“架构对象名称”。
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 a log file group with the same name, or a tablespace and a data file with the same name.例如,不能有同名的表空间和日志文件组,也不能有同名的表空间和数据文件。
There can be only one log file group per NDB Cluster instance at any given time.在任何给定时间,每个NDB群集实例只能有一个日志文件组。
The optional 可选的INITIAL_SIZE
parameter sets the UNDO
file's initial size; if not specified, it defaults to 128M
(128 megabytes). INITIAL_SIZE
参数设置UNDO
文件的初始大小;如果未指定,则默认为128M
(128兆字节)。The optional 可选的UNDO_BUFFER_SIZE
parameter sets the size used by the UNDO
buffer for the log file group; The default value for UNDO_BUFFER_SIZE
is 8M
(eight megabytes); this value cannot exceed the amount of system memory available. UNDO_BUFFER_SIZE
参数设置日志文件组的UNDO
缓冲区使用的大小;UNDO_BUFFER_SIZE
的默认值为8M(8MB);此值不能超过可用的系统内存量。Both of these parameters are specified in bytes. 这两个参数都以字节为单位指定。You may optionally follow either or both of these with a one-letter abbreviation for an order of magnitude, similar to those used in 您可以选择在其中一个或两个后面加上一个字母的缩写,表示一个数量级,类似于my.cnf
. my.cnf
中使用的缩写。Generally, this is one of the letters 一般来说,这是M
(for megabytes) or G
(for gigabytes).M
(兆字节)或G
(千兆字节)中的一个字母。
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
数据节点配置参数为该选项暗示的任何默认值。
The maximum permitted for UNDO_BUFFER_SIZE
is 629145600 (600 MB).UNDO_BUFFER_SIZE
(撤消缓冲区大小)允许的最大值为629145600(600 MB)。
On 32-bit systems, the maximum supported value for 在32位系统上,INITIAL_SIZE
is 4294967296 (4 GB). INITIAL_SIZE
(初始大小)的最大支持值为4294967296(4 GB)。(Bug #29186)
The minimum allowed value for INITIAL_SIZE
is 1048576 (1 MB).INITIAL_SIZE
的最小允许值为1048576(1 MB)。
The ENGINE
option determines the storage engine to be used by this log file group, with engine_name
being the name of the storage engine. ENGINE
选项确定此日志文件组要使用的存储引擎,
是存储引擎的名称。engine_name
In MySQL 8.0, this must be 在MySQL 8.0中,这必须是NDB
(or NDBCLUSTER
). NDB
(或NDBCLUSTER
)。If 如果未设置ENGINE
is not set, MySQL tries to use the engine specified by the default_storage_engine
server system variable (formerly storage_engine
). ENGINE
,MySQL将尝试使用服务器系统变量default_storage_engine
(以前称为storage_engine
)指定的引擎。In any case, if the engine is not specified as 在任何情况下,如果引擎未指定为NDB
or NDBCLUSTER
, the CREATE LOGFILE GROUP
statement appears to succeed but actually fails to create the log file group, as shown here:NDB
或NDBCLUSTER
,则CREATE LOGFILE GROUP
语句似乎成功,但实际上无法创建日志文件组,如下所示:
mysql>CREATE LOGFILE GROUP lg1
->ADD UNDOFILE 'undo.dat' INITIAL_SIZE = 10M;
Query OK, 0 rows affected, 1 warning (0.00 sec) mysql>SHOW WARNINGS;
+-------+------+------------------------------------------------------------------------------------------------+ | Level | Code | Message | +-------+------+------------------------------------------------------------------------------------------------+ | Error | 1478 | Table storage engine 'InnoDB' does not support the create option 'TABLESPACE or LOGFILE GROUP' | +-------+------+------------------------------------------------------------------------------------------------+ 1 row in set (0.00 sec) mysql>DROP LOGFILE GROUP lg1 ENGINE = NDB;
ERROR 1529 (HY000): Failed to drop LOGFILE GROUP mysql>CREATE LOGFILE GROUP lg1
->ADD UNDOFILE 'undo.dat' INITIAL_SIZE = 10M
->ENGINE = NDB;
Query OK, 0 rows affected (2.97 sec)
The fact that the 当命名非CREATE LOGFILE GROUP
statement does not actually return an error when a non-NDB
storage engine is named, but rather appears to succeed, is a known issue which we hope to address in a future release of NDB Cluster.NDB
存储引擎时,CREATE LOGFILE GROUP
语句实际上不会返回错误,而是似乎成功,这是一个已知的问题,我们希望在NDB群集的未来版本中解决这个问题。
REDO_BUFFER_SIZE
, NODEGROUP
, WAIT
, and COMMENT
are parsed but ignored, and so have no effect in MySQL 8.0. REDO_BUFFER_SIZE
、NODEGROUP
、WAIT
和COMMENT
被解析但被忽略,因此在MySQL 8.0中没有任何效果。These options are intended for future expansion.这些选项用于将来的扩展。
When used with 与ENGINE [=] NDB
, a log file group and associated UNDO
log file are created on each Cluster data node. ENGINE [=] NDB
一起使用时,会在每个群集数据节点上创建日志文件组和关联的UNDO
日志文件。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 LOGFILE_GROUP_NAME, LOGFILE_GROUP_NUMBER, EXTRA
->FROM INFORMATION_SCHEMA.FILES
->WHERE FILE_NAME = 'undo_10.dat';
+--------------------+----------------------+----------------+ | LOGFILE_GROUP_NAME | LOGFILE_GROUP_NUMBER | EXTRA | +--------------------+----------------------+----------------+ | lg_3 | 11 | CLUSTER_NODE=3 | | lg_3 | 11 | CLUSTER_NODE=4 | +--------------------+----------------------+----------------+ 2 rows in set (0.06 sec)
CREATE LOGFILE GROUP
is useful only with Disk Data storage for NDB Cluster. 仅适用于NDB群集的磁盘数据存储。See Section 23.5.10, “NDB Cluster Disk Data Tables”.请参阅第23.5.10节,“NDB群集磁盘数据表”。