10bet网址
MySQL 8.0 Reference Manual
Related Documentation Download this Manual
PDF (US Ltr)- 41.6Mb
PDF (A4)- 41.7Mb
Man Pages (TGZ)- 262.2Kb
手册页(邮政编码)- 372.3Kb
Info (Gzip)- 4.0Mb
Info (Zip)- 4.0Mb
Excerpts from this Manual

13.1.16 CREATE LOGFILE GROUP Statement

CREATE LOGFILE GROUPlogfile_groupADD 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 namedlogfile_grouphaving a singleUNDOfile named 'undo_file'. ACREATE LOGFILE GROUPstatement has one and only oneADD UNDOFILEclause. For rules covering the naming of log file groups, seeSection 9.2, “Schema Object Names”.

Note

All NDB Cluster Disk Data objects share the same namespace. This means thateach Disk Data object必须惟一命名(而不只是每个磁盘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.

The optionalINITIAL_SIZEparameter sets theUNDOfile's initial size; if not specified, it defaults to128M(128 megabytes). The optionalUNDO_BUFFER_SIZEparameter sets the size used by theUNDObuffer for the log file group; The default value forUNDO_BUFFER_SIZEis8M(eight megabytes); this value cannot exceed the amount of system memory available. 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 inmy.cnf. Generally, this is one of the lettersM(for megabytes) orG(for gigabytes).

Memory used forUNDO_BUFFER_SIZEcomes from the global pool whose size is determined by the value of theSharedGlobalMemorydata node configuration parameter. This includes any default value implied for this option by the setting of theInitialLogFileGroupdata node configuration parameter.

The maximum permitted forUNDO_BUFFER_SIZEis 629145600 (600 MB).

On 32-bit systems, the maximum supported value forINITIAL_SIZEis 4294967296 (4 GB). (Bug #29186)

The minimum allowed value forINITIAL_SIZEis 1048576 (1 MB).

TheENGINEoption determines the storage engine to be used by this log file group, withengine_namebeing the name of the storage engine. In MySQL 8.0, this must beNDB(orNDBCLUSTER). IfENGINEis not set, MySQL tries to use the engine specified by thedefault_storage_engineserver system variable (formerlystorage_engine). In any case, if the engine is not specified asNDBorNDBCLUSTER,CREATE LOGFILE GROUPstatement appears to succeed but actually fails to create the log file group, as shown here:

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 theCREATE LOGFILE GROUPstatement does not actually return an error when a non-NDBstorage engine is named, but rather appears to succeed, is a known issue which we hope to address in a future release of NDB Cluster.

REDO_BUFFER_SIZE,NODEGROUP,WAIT, andCOMMENTare parsed but ignored, and so have no effect in MySQL 8.0. These options are intended for future expansion.

When used withENGINE [=] NDB, a log file group and associatedUNDOlog file are created on each Cluster data node. You can verify that theUNDOfiles were created and obtain information about them by querying theINFORMATION_SCHEMA.FILEStable. 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 GROUPis useful only with Disk Data storage for NDB Cluster. SeeSection 23.6.10, “NDB Cluster Disk Data Tables”.