Author: jstephens
Date: 2006-03-08 05:45:45 +0100 (Wed, 08 Mar 2006)
New Revision: 1525
Log:
WL2859 - Document Cluster/Disk Data (Thank you, Mikael, Stewart, and Jeb!)
refman-common/titles.en.ent:
- Added new section titles
refman-5.1/information-schema.xml:
- Updated FILES table section with additional descriptions and usage examples
refman-5.1/ndbcluster.xml:
- New Disk Data section
refman-5.1/sql-syntax.xml:
- New sections:
ALTER LOGFILE GROUP
ALTER TABLESPACE
CREATE LOGFILE GROUP
CREATE TABLESPACE
DROP LOGFILE GROUP
DROP TABLESPACE
- Updated CREATE TABLE section:
- Added TABLESPACE ... STORAGE DISK option
- Fix for Docs Bug #18001 (missing table option for Partitioning)
Modified:
trunk/refman-5.1/information-schema.xml
trunk/refman-5.1/ndbcluster.xml
trunk/refman-5.1/sql-syntax.xml
trunk/refman-common/titles.en.ent
Modified: trunk/refman-5.1/information-schema.xml
===================================================================
--- trunk/refman-5.1/information-schema.xml 2006-03-08 04:28:31 UTC (rev 1524)
+++ trunk/refman-5.1/information-schema.xml 2006-03-08 04:45:45 UTC (rev 1525)
@@ -4229,6 +4229,303 @@
</para>
<itemizedlist>
+
+ <listitem>
+ <para>
+ <literal>FILE_ID</literal> column values are auto-generated.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>FILE_NAME</literal> is the name of an <literal>UNDO</literal>
+ logfile created by <literal>CREATE LOGFILE GROUP</literal> or ALTER
+ LOGFILE GROUP, or of a datafile created by <literal>CREATE
+ TABLESPACE</literal> or <literal>ALTER TABLESPACE</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>FILE_TYPE</literal> is one of the values
+ <literal>UNDOFILE</literal> or <literal>DATAFILE</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>TABLESPACE_NAME</literal> is the name of the tablespace with
+ which the file is associated.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ In MySQL 5.1, the value of the <literal>TABLESPACE_CATALOG</literal>
+ column is always <literal>NULL</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>TABLE_NAME</literal> is the name of the Disk Data table with
+ which the file is associated, if any.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For an <literal>UNDO</literal> logfile,
+ <literal>LOGFILE_GROUP_NAME</literal> gives the name of the logfile
+ group to which the logfile belongs. For a datafile, this column is
+ empty.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For an <literal>UNDO</literal> logfile, the
+ <literal>LOGFILE_GROUP_NUMBER</literal> contains the auto-generated ID
+ number of the logfile group to which the logfile belongs.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For a MySQL Cluster Disk Data logfile or datafile, the value of the
+ <literal>ENGINE</literal> column is always <literal>NDB</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For a MySQL Cluster Disk Data logfile or datafile, the value of the
+ <literal>FULLTEXT_KEYS</literal> column is always empty.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ The <literal>FREE EXTENTS</literal> column displays the number of
+ extents which have not yet been used by the file. The <literal>TOTAL
+ EXTENTS</literal> column show the total number of extents allocated
+ to the file.
+ </para>
+
+ <para>
+ The difference between these two columns is the number of extents
+ currently in use by the file:
+ </para>
+
+<programlisting>
+SELECT TOTAL_EXTENTS - FREE_EXTENTS AS extents_used
+ FROM INFORMATION_SCHEMA.FILES
+ WHERE FILE-NAME = 'myfile.dat';
+</programlisting>
+
+ <para>
+ You can approximate the amount of disk space in use by the file by
+ multiplying this difference by the value of the
+ <literal>EXTENT_SIZE</literal> column, which gives the size of an
+ extent for the file in bytes:
+ </para>
+
+<programlisting>
+SELECT (TOTAL_EXTENTS - FREE_EXTENTS) * EXTENT_SIZE AS bytes_used
+ FROM INFORMATION_SCHEMA.FILES
+ WHERE FILE_NAME = 'myfile.dat';
+</programlisting>
+
+ <para>
+ Similarly, you can estimate the amount of space that remains available
+ in a given file by multiplying <literal>FREE_EXTENTS</literal> by
+ <literal>EXTENT_SIZE</literal>:
+ </para>
+
+<programlisting>
+SELECT FREE_EXTENTS * EXTENT_SIZE AS bytes_free
+ FROM INFORMATION_SCHEMA.FILES
+ WHERE FILE_NAME = 'myfile.dat';
+</programlisting>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: The byte values produced
+ by the preceding queries are approximations only, and their precision
+ is inversely proportional to the value of
+ <literal>EXTENT_SIZE</literal>. That is, the larger
+ <literal>EXTENT_SIZE</literal> becomes, the less accurate the
+ approximations are.
+ </para>
+
+ <para>
+ The extent size can be set in a <literal>CREATE TABLESPACE</literal>
+ statement. See <xref linkend="create-tablespace"/>, for more
+ information.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ The <literal>INITIAL_SIZE</literal> column shows the size in bytes of
+ the file. This is the same value that was used in the
+ <literal>INITIAL_SIZE</literal> clause of the <literal>CREATE LOGFILE
+ GROUP</literal>, <literal>ALTER LOGFILE GROUP</literal>,
+ <literal>CREATE TABLESPACE</literal>, or <literal>ALTER
+ TABLESPACE</literal> statement used to create the file.
+ </para>
+
+ <para>
+ For MySQL 5.1 Cluster Disk Data files, the value of the
+ <literal>MAXIMUM_SIZE</literal> column is always the same as
+ <literal>INITIAL_SIZE</literal>, and the
+ <literal>AUTOEXTEND_SIZE</literal> column is always empty.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ The <literal>CREATION_TIME</literal> column shows the date and time
+ when the file was created. The <literal>LAST_UPDATE_TIME</literal>
+ column displays the date and time when the file was last modified. The
+ <literal>LAST_ACCESSED</literal> column provides the date and time
+ when the file was last accessed by the server.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For MySQL Cluster Disk Data files, the value of the
+ <literal>RECOVER_TIME</literal> and
+ <literal>TRANSACTION_COUNTER</literal> columns is always
+ <literal>0</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For MySQL 5.1 CLuster Disk Data files, the following columns are
+ always <literal>NULL</literal>:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ <literal>VERSION</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>ROW_FORMAT</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>TABLE_ROWS</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>AVG_ROW_LENGTH</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>DATA_LENGTH</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>MAX_DATA_LENGTH</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>INDEX_LENGTH</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>DATA_FREE</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CREATE_TIME</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>UPDATE_TIME</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CHECK_TIME</literal>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <literal>CHECKSUM</literal>
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ </listitem>
+
+ <listitem>
+ <para>
+ For MySQL Cluster Disk Data files, the value of the
+ <literal>STATUS</literal> column is always <literal>NORMAL</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For MySQL Cluster Disk Data files, the <literal>EXTRA</literal> column
+ shows which data node the file belongs to, as each data node has its
+ own copy of the file. For example, suppose you use this statement on a
+ MySQL Cluster with four data nodes:
+ </para>
+
+<programlisting>
+CREATE LOGFILE GROUP mygroup
+ ADD UNDOFILE 'new_undo.dat'
+ INITIAL_SIZE 2G
+ ENGINE NDB;
+</programlisting>
+
+ <para>
+ After running the <literal>CREATE LOGFILE GROUP</literal> statement
+ successfully, you should see a result similar to the one shown here
+ for this query against the <literal>FILES</literal> table:
+ </para>
+
+<programlisting>
+mysql> <userinput>SELECT LOGFILE_GROUP_NAME, FILE_TYPE, EXTRA</userinput>
+ -> <userinput>FROM INFORMATION_SCHEMA.FILES</userinput>
+ -> <userinput>WHERE FILE_NAME = 'new_undo.dat';</userinput>
++--------------------+-------------+----------------+
+| LOGFILE_GROUP_NAME | FILE_TYPE | EXTRA |
++--------------------+-------------+----------------+
+| mygroup | UNDO FILE | CLUSTER_NODE=3 |
+| mygroup | UNDO FILE | CLUSTER_NODE=4 |
+| mygroup | UNDO FILE | CLUSTER_NODE=5 |
+| mygroup | UNDO FILE | CLUSTER_NODE=6 |
++--------------------+-------------+----------------+
+3 rows in set (0.01 sec)
+</programlisting>
+ </listitem>
<listitem>
<para>
@@ -4236,13 +4533,24 @@
was added in MySQL 5.1.6.
</para>
</listitem>
+
+ <listitem>
+ <para>
+ There are no <literal>SHOW</literal> commands associated with the
+ <literal>FILES</literal> table.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For additional examples using the <literal>FILES</literal> table to
+ obtain information about Cluster Disk Data tables, see
+ <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+ </listitem>
</itemizedlist>
- <remark role="todo">
- Is there some corresponding SHOW statement?
- </remark>
-
</section>
<section id="processlist-table">
Modified: trunk/refman-5.1/ndbcluster.xml
===================================================================
--- trunk/refman-5.1/ndbcluster.xml 2006-03-08 04:28:31 UTC (rev 1524)
+++ trunk/refman-5.1/ndbcluster.xml 2006-03-08 04:45:45 UTC (rev 1525)
@@ -9966,7 +9966,361 @@
</section>
</section>
+
+ <section id="mysql-cluster-disk-data">
+ <title>&title-mysql-cluster-disk-data;</title>
+
+ <remark role="note">
+ Author: Jon Stephens, based on information supplied by Mikael
+ Ronström and Stewart Smith. Additional assistance provided by Jeb
+ Miller.
+ </remark>
+
+ <para>
+ MySQL 5.1.6 introduces the ability to store non-indexed
+ <literal>NDB</literal> table data on disk, rather than in RAM as with
+ previous versions of MySQL Cluster.
+ </para>
+
+ <para>
+ Assuming that you have already set up a MySQL
+ Cluster with all nodes (including management and SQL nodes) running
+ MySQL 5.1.6 or newer, the basic steps for creating a Cluster table
+ on disk are as follows:
+ </para>
+
+ <orderedlist>
+ <listitem>
+ <para>
+ Create a <firstterm>logfile group</firstterm>, and assign one or
+ more <literal>UNDO</literal> logfiles to it.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Create a <firstterm>tablespace</firstterm>, and assign the
+ logfile group to it, as well as one or more datafiles.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Create a Disk Data table that uses this tablespace for data
+ storage.
+ </para>
+ </listitem>
+ </orderedlist>
+
+ <para>
+ Each of these tasks can be accomplished using SQL statements, as
+ shown in the following example.
+ </para>
+
+ <orderedlist>
+ <listitem>
+ <para>
+ We create a logfile group named <literal>lg_1</literal> using
+ <literal>CREATE LOGFILE GROUP</literal>. This logfile group is
+ to be made up of two <literal>UNDO</literal> logfiles, which we
+ name <filename>undo_1.dat</filename> and
+ <filename>undo_2.dat</filename>, whose initial sizes are 16 MB
+ and 12 MB, respectively. (You must specify a logfile's initial
+ size when adding it to a logfile group.) Optionally, you can
+ also specify a size for the logfile group's
+ <literal>UNDO</literal> buffer, or allow it to assume the
+ default value of 8 MB. In this example, we set the UNDO buffer's
+ size at 2 MB. A logfile group must be created with an
+ <literal>UNDO</literal> logfile; so we add
+ <filename>undo_1.dat</filename> to <literal>lg_1</literal> in
+ this <literal>CREATE LOGFILE GROUP</literal> statement:
+ </para>
+
+<programlisting>
+CREATE LOGFILE GROUP lg_1
+ ADD UNDOFILE 'undo_1.dat'
+ INITIAL_SIZE 16M
+ UNDO_BUFFER_SIZE 2M
+ ENGINE NDB;
+</programlisting>
+
+ <para>
+ To add <filename>undo_2.dat</filename> to the logfile group, use
+ the following <literal>ALTER LOGFILE GROUP</literal> statement:
+ </para>
+
+<programlisting>
+ALTER LOGFILE GROUP lg_1
+ ADD UNDOFILE 'undo_2.dat'
+ INITIAL_SIZE 12M
+ ENGINE NDB;
+</programlisting>
+
+ <para>
+ Some items of note:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ The <filename>.dat</filename> file extension used here is
+ not required. We use it merely to make the log and data
+ files easily recognisable.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Every <literal>CREATE LOGFILE GROUP</literal> and
+ <literal>ALTER LOGFILE GROUP</literal> statement must
+ include an <literal>ENGINE</literal> clause. In MySQL 5.1,
+ the permitted values for this clause are
+ <literal>NDB</literal> and <literal>NDBCLUSTER</literal>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ When you add an <literal>UNDO</literal> logfile to a logfile
+ group, a file with that name is created in the
+ <literal>DataDirectory</literal> of each data node in the
+ cluster.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ For more information about the <literal>CREATE LOGFILE
+ GROUP</literal> statement, see
+ <xref linkend="create-logfile-group"/>. For more
+ information about <literal>ALTER LOGFILE GROUP</literal>,
+ see <xref linkend="alter-logfile-group"/>.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ </listitem>
+
+ <listitem>
+ <para>
+ Now we can create a tablespace. A tablespace contains files to
+ be used by MySQL Cluster Disk Data tables for storing their
+ data. A tablespace is also associated with a particular logfile
+ group. When creating a new tablespace, you must specify the
+ logfile group which it is to use for <literal>UNDO</literal>
+ logging; you must also specify a datafile. You can add more
+ datafiles to the tablespace after it the tablespace is created;
+ it is also possible to drop datafiles from a tablespace (an
+ example of dropping datafiles is provided later in this
+ section).
+ </para>
+
+ <para>
+ Assume that we wish to create a tablespace named
+ <literal>ts_1</literal> which uses <literal>lg_1</literal> as
+ its logfile group. This tablespace is to contain two datafiles
+ named <filename>data_1.dat</filename> and
+ <filename>data_2.dat</filename>, whose initial sizes are 32 MB
+ and 48 MB, respectively. We can do this using two SQL
+ statements: <literal>CREATE TABLESPACE</literal>, to create
+ <literal>ts_1</literal> with the datafile
+ <filename>data_1.dat</filename>, and to associate
+ <literal>ts_1</literal> with logfile group
+ <literal>lg_1</literal>; and <literal>ALTER
+ TABLESPACE</literal>, to add the second datafile. We show
+ these statements here:
+ </para>
+<programlisting>
+CREATE TABLESPACE ts_1
+ ADD DATAFILE 'data_1.dat'
+ USE LOGFILE GROUP lg_1
+ INITIAL_SIZE 32M
+ ENGINE NDB;
+
+ALTER TABLESPACE ts_1
+ ADD DATAFILE 'data_2.dat'
+ INITIAL_SIZE 48M
+ ENGINE NDB;
+</programlisting>
+
+ <para>
+ Some items of note:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ As is the case with the filenames used here for
+ <literal>UNDO</literal> logfiles, there is no special significance
+ for the <filename>.dat</filename> file extension; it is used merely
+ for easy recognition.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ All <literal>CREATE TABLESPACE</literal> and <literal>ALTER
+ TABLESPACE</literal> statements must contain an
+ <literal>ENGINE</literal> clause; only tables using the same storage
+ engine as the tablespace can be created in the tablespace. In MySQL
+ 5.1, the only permitted values for this clause are
+ <literal>NDB</literal> and <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ For more information about the <literal>CREATE TABLESPACE</literal>
+ and <literal>ALTER TABLESPACE</literal> statements, see
+ <xref linkend="create-tablespace"/>, and
+ <xref linkend="alter-tablespace"/>.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </listitem>
+
+ <listitem>
+ <para>
+ Now it is possible to create a table whose non-indexed columns are
+ stored on disk in the tablespace <literal>ts_1</literal>:
+ </para>
+
+<programlisting>
+CREATE TABLE dt_1 (
+ member_id INT UNSIGNED NOT NULL AUTO_INCREMENT PRIMARY KEY,
+ last_name VARCHAR(50) NOT NULL,
+ first_name VARCHAR(50) NOT NULL,
+ dob DATE NOT NULL,
+ joined DATE NOT NULL,
+ INDEX(last_name, first_name)
+ )
+ TABLESPACE ts_1 STORAGE DISK
+ ENGINE NDB;
+</programlisting>
+
+ <para>
+ The <literal>TABLESPACE ... STORAGE DISK</literal> clause tells the
+ <literal>NDB Cluster</literal> storage engine to use tablespace
+ <literal>ts_1</literal> for disk data storage.
+ </para>
+
+ <para>
+ Once table <literal>ts_1</literal> has been created as shown, you can
+ perform <literal>INSERT</literal>, <literal>SELECT</literal>,
+ <literal>UPDATE</literal>, and <literal>DELETE</literal> statements on
+ it just as you would with any other MySQL table.
+ </para>
+
+ <para>
+ For table <literal>dt_1</literal> as it has been defined here, only the
+ <literal>dob</literal> and <literal>joined</literal> columns are stored
+ on disk. This is because there are indexes on the <literal>id</literal>,
+ <literal>last_name</literal>, and <literal>first_name</literal> columns,
+ and so data belonging to these columns is stored in RAM. In MySQL 5.1,
+ only non-indexed columns can be held on disk; indexes and indexed
+ column data continue to be stored in memory. This tradeoff between
+ the use of indexes and conservation of RAM is something you must keep in
+ mind as you design Disk Data tables.
+ </para>
+ </listitem>
+ </orderedlist>
+
+ <para>
+ A logfile group, a tablespace, and any Disk Data tables using these must be
+ created in a particular order. The same is true for dropping any of these
+ objects:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+ A logfile group cannot be dropped, so long as any tablespaces are using
+ it.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ A tablespace cannot be dropped, so long as it contains any datafiles.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ You cannot drop any datafiles from a tablespace, so long as there remain
+ any tables which are using the tablespace.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ For example, to drop all the objects created so far in this section, you
+ would use the following statements:
+ </para>
+
+ <itemizedlist>
+ <listitem>
+ <para>
+<programlisting>
+DROP TABLE dt_1;
+</programlisting>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+<programlisting>
+ALTER TABLESPACE ts_1
+ DROP DATAFILE 'data_2.dat'
+ ENGINE NDB;
+</programlisting>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+<programlisting>
+ALTER TABLESPACE ts_1
+ DROP DATAFILE 'data_1.dat'
+ ENGINE NDB;
+</programlisting>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+<programlisting>
+DROP TABLESPACE ts_1
+ ENGINE NDB;
+</programlisting>
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+<programlisting>
+DROP LOGFILE GROUP lg_1
+ ENGINE NDB;
+</programlisting>
+ </para>
+ </listitem>
+
+ </itemizedlist>
+
+ <para>
+ These statements must be performed in the order shown, except
+ that the two <literal>ALTER TABLESPACE ... DROP DATAFILE</literal>
+ statements may be executed in either order.
+ </para>
+
+ <para>
+ You can obtain information about <literal>UNDO</literal> logfiles and data
+ files used by Disk Data tables by querying the <literal>FILES</literal>
+ table in the <literal>INFORMATION_SCHEMA</literal> database. For more
+ information, see <xref linkend="files-table"/>.
+ </para>
+
+</section>
+
<section id="mysql-cluster-interconnects">
<title>&title-mysql-cluster-interconnects;</title>
Modified: trunk/refman-5.1/sql-syntax.xml
===================================================================
--- trunk/refman-5.1/sql-syntax.xml 2006-03-08 04:28:31 UTC (rev 1524)
+++ trunk/refman-5.1/sql-syntax.xml 2006-03-08 04:45:45 UTC (rev 1525)
@@ -1123,7 +1123,185 @@
</para>
</section>
+
+ <section id="alter-logfile-group">
+ <title>&title-alter-logfile-group;</title>
+
+<programlisting>
+ALTER LOGFILE GROUP <replaceable>logfile_group</replaceable>
+ ADD UNDOFILE '<replaceable>file</replaceable>'
+ INITIAL_SIZE [=] <replaceable>size</replaceable>
+ ENGINE [=] <replaceable>engine</replaceable>
+</programlisting>
+
+ <para>
+ This statement adds an <literal>UNDO</literal> file named
+ '<replaceable>file</replaceable>' to an existing logfile group
+ <replaceable>logfile_group</replaceable>. An <literal>ALTER LOGFILE
+ GROUP</literal> statement has one and only one <literal>ADD
+ UNDOFILE</literal> clause. No <literal>DROP UNDOFILE</literal>
+ clause is supported.
+ </para>
+
+ <para>
+ The <literal>INITIAL_SIZE</literal> parameter sets the
+ <literal>UNDO</literal> file's initial size in bytes. You may
+ optionally follow <replaceable>size</replaceable> with a one-letter
+ abbreviation for an order of magnitude, similar to those used in
+ <filename>my.cnf</filename>. Generally, this is one of the letters
+ <literal>M</literal> (for megabytes) or <literal>G</literal> (for
+ gigabytes).
+ </para>
+
+ <para>
+ The <literal>ENGINE</literal> parameter (required) determines the
+ storage engine which is used by this logfile group, with
+ <replaceable>engine</replaceable> being the name of the storage
+ engine. In MySQL 5.1, the only accepted values for
+ <replaceable>engine</replaceable> are <literal>NDB</literal> and
+ <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ Here is an example, which assumes that the logfile group
+ <literal>lg_3</literal> has already been created using
+ <literal>CREATE LOGFILE GROUP</literal> (see
+ <xref linkend="create-logfile-group"/>):
+ </para>
+
+<programlisting>
+ALTER LOGFILE GROUP lg_3
+ ADD UNDOFILE 'undo_10.dat'
+ INITIAL_SIZE=32M
+ ENGINE=NDB;
+</programlisting>
+
+ <para>
+ When <literal>ALTER LOGFILE GROUP</literal> is used with
+ <literal>ENGINE = NDB</literal>, an <literal>UNDO</literal> logfile
+ is created on each Cluster data node. You can verify that the
+ <literal>UNDO</literal> files were created and obtain information
+ about them by querying the
+ <literal>INFORMATION_SCHEMA.FILES</literal> table. For example:
+ </para>
+
+<programlisting>
+mysql> <userinput>SELECT FILE_NAME, LOGFILE_GROUP_NUMBER, EXTRA</userinput>
+ -> <userinput>FROM INFORMATION_SCHEMA.FILES</userinput>
+ -> <userinput>WHERE LOGFILE_GROUP_NAME = 'lg_3';</userinput>
++-------------+----------------------+----------------+
+| 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)
+</programlisting>
+
+ <para>
+ (See <xref linkend="files-table"/>.)
+ </para>
+
+ <para>
+ <literal>ALTER LOGFILE GROUP</literal> was added in MySQL 5.1.6. In
+ MySQL 5.1, it is useful only with Disk Data storage for MySQL
+ Cluster. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+ </section>
+
+ <section id="alter-tablespace">
+ <title>&title-alter-tablespace;</title>
+<programlisting>
+ALTER TABLESPACE <replaceable>tablespace</replaceable>
+ ADD DATAFILE '<replaceable>file</replaceable>'
+ INITIAL_SIZE [=] <replaceable>size</replaceable>
+ ENGINE [=] <replaceable>engine</replaceable>
+
+ALTER TABLESPACE <replaceable>tablespace</replaceable>
+ DROP DATAFILE '<replaceable>file</replaceable>'
+ ENGINE [=] <replaceable>engine</replaceable>
+</programlisting>
+
+ <para>
+ This statement can be used either to add a new datafile, or to drop
+ a datafile from a tablespace.
+ </para>
+
+ <para>
+ The <literal>ADD DATAFILE</literal> variant requires that you
+ specify an initial size using an <literal>INITIAL_SIZE</literal>
+ clause, where <replaceable>size</replaceable> is measured in bytes.
+ You may optionally follow an integer value with a one-letter
+ abbreviation for an order of magnitude, similar to those used in
+ <filename>my.cnf</filename>. Generally, this is one of the letters
+ <literal>M</literal> (for megabytes) or <literal>G</literal> (for
+ gigabytes).
+ </para>
+
+ <para>
+ Once a datafile has been created, its size cannot
+ be changed; however, you can add more datafiles to the tablespace
+ using additional <literal>ALTER TABLESPACE ... ADD
+ DATAFILE</literal> statements.
+ </para>
+
+ <para>
+ Using <literal>DROP DATAFILE</literal> with <literal>ALTER
+ TABLESPACE</literal> drops a datafile
+ '<replaceable>file</replaceable>' from the tablespace. This file
+ must already have been added to the tablespace using <literal>CREATE
+ TABLESPACE</literal> or <literal>ALTER TABLESPACE</literal>;
+ otherwise an error will result.
+ </para>
+
+ <para>
+ Both <literal>ALTER TABLESPACE ... ADD DATAFILE</literal> and
+ <literal>ALTER TABLESPACE ... DROP DATAFILE</literal> require an
+ <literal>ENGINE</literal> clause which specifies the storage engine
+ used by the tablespace. In MySQL 5.1, the only accepted values for
+ <replaceable>engine</replaceable> are <literal>NDB</literal> and
+ <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ When <literal>ALTER TABLESPACE ... ADD DATAFILE</literal> is used
+ with <literal>ENGINE = NDB</literal>, a datafile is created on each
+ Cluster data node. You can verify that the datafiles were created
+ and obtain information about them by querying the
+ <literal>INFORMATION_SCHEMA.FILES</literal> table. For example, the
+ following query shows all datafiles belonging to the tablespace
+ named <literal>newts</literal>:
+ </para>
+
+<programlisting>
+mysql> <userinput>SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA</userinput>
+ -> <userinput>FROM INFORMATION_SCHEMA.FILES</userinput>
+ -> <userinput>WHERE TABLESPACE_NAME = 'newts' AND FILE_TYPE = 'DATAFILE';</userinput>
++--------------------+--------------+----------------+
+| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |
++--------------------+--------------+----------------+
+| lg_3 | newdata.dat | CLUSTER_NODE=3 |
+| lg_3 | newdata.dat | CLUSTER_NODE=4 |
+| lg_3 | newdata2.dat | CLUSTER_NODE=3 |
+| lg_3 | newdata2.dat | CLUSTER_NODE=4 |
++--------------------+--------------+----------------+
+2 rows in set (0.03 sec)
+</programlisting>
+
+ <para>
+ See <xref linkend="files-table"/>.
+ </para>
+
+ <para>
+ <literal>ALTER TABLESPACE</literal> was added in MySQL 5.1.6. In
+ MySQL 5.1, it is useful only with Disk Data storage for MySQL
+ Cluster. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+</section>
+
<section id="create-database">
<title>&title-create-database;</title>
@@ -1487,6 +1665,7 @@
<programlisting>
CREATE [TEMPORARY] TABLE [IF NOT EXISTS] <replaceable>tbl_name</replaceable>
[(<replaceable>create_definition</replaceable>,...)]
+ [<replaceable>partition_options</replaceable>]
[<replaceable>table_options</replaceable>] [<replaceable>select_statement</replaceable>]
</programlisting>
@@ -1565,6 +1744,7 @@
<replaceable>table_options</replaceable>: <replaceable>table_option</replaceable> [<replaceable>table_option</replaceable>] ...
<replaceable>table_option</replaceable>:
+ [TABLESPACE <replaceable>tablespace_name</replaceable> STORAGE DISK]
ENGINE [=] <replaceable>engine_name</replaceable>
| AUTO_INCREMENT [=] <replaceable>value</replaceable>
| AVG_ROW_LENGTH [=] <replaceable>value</replaceable>
@@ -2246,6 +2426,16 @@
</listitem>
</itemizedlist>
+
+ <para>
+ The <literal>TABLESPACE ... STORAGE DISK</literal> table option
+ is used only with <literal>NDB Cluster</literal> tables. It
+ assigns the table to a Cluster Disk Data tablespace. The
+ tablespace named <replaceable>tablespace_name</replaceable> must
+ already have been created using <literal>CREATE
+ TABLESPACE</literal>. This table option was introduced in
+ MySQL 5.1.6. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
<para>
The <literal>ENGINE</literal> table option specifies the storage
@@ -3368,6 +3558,188 @@
</para>
</section>
+
+ <section id="create-logfile-group">
+ <title>&title-create-logfile-group;</title>
+
+<programlisting>
+CREATE LOGFILE GROUP <replaceable>logfile_group</replaceable>
+ ADD UNDOFILE '<replaceable>undo_file</replaceable>'
+ INITIAL_SIZE [=] <replaceable>initial_size</replaceable>
+ [UNDO_BUFFER_SIZE [=] <replaceable>undo_buffer_size</replaceable>]
+ ENGINE [=] <replaceable>engine_name</replaceable>
+</programlisting>
+
+ <para>
+ This statement creates a new logfile group named
+ <replaceable>logfile_group</replaceable> having a single
+ <literal>UNDO</literal> file named
+ '<replaceable>undo_file</replaceable>'. A <literal>CREATE LOGFILE
+ GROUP</literal> statement has one and only one <literal>ADD
+ UNDOFILE</literal> clause.
+ </para>
+
+ <para>
+ The <literal>INITIAL_SIZE</literal> parameter sets the
+ <literal>UNDO</literal> file's initial size. The optional
+ <literal>UNDO_BUFFFER_SIZE</literal> parameter sets the size used by the
+ <literal>UNDO</literal> buffer for the logfile group; the default is
+ <literal>8M</literal> (eight megabytes). Both
+ <replaceable>initial_size</replaceable> and
+ <replaceable>undo_buffer_size_size</replaceable> 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 <filename>my.cnf</filename>. Generally, this is one of the
+ letters <literal>M</literal> (for megabytes) or <literal>G</literal>
+ (for gigabytes).
+ </para>
+
+ <para>
+ The <literal>ENGINE</literal> parameter determines the storage
+ engine to be used by this logfile group, with
+ <replaceable>engine</replaceable> being the name of the storage
+ engine. In MySQL 5.1. <replaceable>engine</replaceable> must be one
+ of the values <literal>NDB</literal> or
+ <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ When used with <literal>ENGINE = NDB</literal>, a logfile group and
+ associated <literal>UNDO</literal> logfile are created on each
+ Cluster data node. You can verify that the <literal>UNDO</literal>
+ files were created and obtain information about them by querying the
+ <literal>INFORMATION_SCHEMA.FILES</literal> table. For example:
+ </para>
+
+<programlisting>
+mysql> <userinput>SELECT LOGFILE_GROUP_NAME, LOGFILE_GROUP_NUMBER, EXTRA</userinput>
+ -> <userinput>FROM INFORMATION_SCHEMA.FILES</userinput>
+ -> <userinput>WHERE FILE_NAME = 'undo_10.dat';</userinput>
++--------------------+----------------------+----------------+
+| 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)
+</programlisting>
+
+ <para>
+ (See <xref linkend="files-table"/>.)
+ </para>
+
+ <para>
+ <literal>CREATE LOGFILE GROUP</literal> was added in MySQL 5.1.6. In
+ MySQL 5.1, it is useful only with Disk Data storage for MySQL
+ Cluster. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+</section>
+
+ <section id="create-tablespace">
+ <title>&title-create-tablespace;</title>
+
+<programlisting>
+CREATE TABLESPACE <replaceable>tablespace</replaceable>
+ ADD DATAFILE '<replaceable>file</replaceable>'
+ USE LOGFILE GROUP <replaceable>logfile_group</replaceable>
+ EXTENT_SIZE [=] <replaceable>extent_size</replaceable>
+ INITIAL_SIZE [=] <replaceable>initial_size</replaceable>
+ ENGINE [=] <replaceable>engine</replaceable>
+</programlisting>
+
+ <para>
+ This statement is used to create a tablespace, which can contain one
+ or more datafiles, providing storage space for tables. One datafile
+ is created and added to the tablespace using this statement.
+ Additional datafiles may be added to the tablespace by using the
+ <literal>ALTER TABLESPACE</literal> statement (see
+ <xref linkend="alter-tablespace"/>).
+ </para>
+
+ <para>
+ A logfile group of one or more <literal>UNDO</literal> log files
+ must be assigned to the tablespace to be created with the
+ <literal>USE LOGFILE GROUP</literal> clause.
+ <replaceable>logfile_group</replaceable> must be an existing logfile
+ group created with <literal>CREATE LOGFILE GROUP</literal> (see
+ <xref linkend="create-logfile-group"/>). Multiple tablespaces may
+ use the same logfile group for <literal>UNDO</literal> logging.
+ </para>
+
+ <para>
+ The <literal>EXTENT_SIZE</literal> sets the size, in bytes, of the extents
+ used by any files belonging to the tablespace. The default value is
+ 4 bytes.
+ </para>
+
+ <para>
+ An <firstterm>extent</firstterm> is a unit of disk space allocation.
+ One extent is filled with as much data as that extent can contain
+ before another extent is used. You can see how many extents for a
+ given file remain free by querying the
+ <literal>INFORMATION_SCHEMA.FILES</literal> table, and so derive an
+ estimate for how much space remains free in the file. For further
+ discussion and examples, see <xref linkend="files-table"/>.
+ </para>
+
+ <para>
+ The <literal>INITIAL_SIZE</literal> parameter sets the datafile's
+ total size in bytes. Once the file has been created, its size cannot
+ be changed; however, you can add more datafiles to the tablespace
+ using <literal>ALTER TABLESPACE ... ADD DATAFILE</literal>. See
+ <xref linkend="alter-tablespace"/>.
+ </para>
+
+ <para>
+ When setting <literal>EXTENT_SIZE</literal> or
+ <literal>INITIAL_SIZE</literal> (either or both), you may optionally follow
+ the number with a one-letter abbreviation for an order of magnitude, similar
+ to those used in <filename>my.cnf</filename>. Generally, this is one of the
+ letters <literal>M</literal> (for megabytes) or <literal>G</literal> (for
+ gigabytes).
+ </para>
+
+ <para>
+ The <literal>ENGINE</literal> parameter determines the storage
+ engine which uses this tablespace, with
+ <replaceable>engine</replaceable> being the name of the storage
+ engine. In MySQL 5.1, <replaceable>engine</replaceable> must be one
+ of the values <literal>NDB</literal> or
+ <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ When <literal>CREATE TABLESPACE</literal> is used with
+ <literal>ENGINE = NDB</literal>, a tablespace and associated
+ datafile are created on each Cluster data node. You can verify that
+ the datafiles were created and obtain information about them by
+ querying the <literal>INFORMATION_SCHEMA.FILES</literal> table. For
+ example:
+ </para>
+
+<programlisting>
+mysql> <userinput>SELECT LOGFILE_GROUP_NAME, FILE_NAME, EXTRA</userinput>
+ -> <userinput>FROM INFORMATION_SCHEMA.FILES</userinput>
+ -> <userinput>WHERE TABLESPACE_NAME = 'newts' AND FILE_TYPE = 'DATAFILE';</userinput>
++--------------------+-------------+----------------+
+| LOGFILE_GROUP_NAME | FILE_NAME | EXTRA |
++--------------------+-------------+----------------+
+| lg_3 | newdata.dat | CLUSTER_NODE=3 |
+| lg_3 | newdata.dat | CLUSTER_NODE=4 |
++--------------------+-------------+----------------+
+2 rows in set (0.01 sec)
+</programlisting>
+
+ <para>
+ (See <xref linkend="files-table"/>.)
+ </para>
+
+ <para>
+ <literal>CREATE TABLESPACE</literal> was added in MySQL 5.1.6. In
+ MySQL 5.1, it is useful only with Disk Data storage for MySQL
+ Cluster. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+</section>
<section id="drop-database">
@@ -3663,7 +4035,79 @@
</para>
</section>
+
+ <section id="drop-logfile-group">
+ <title>&title-drop-logfile-group;</title>
+<programlisting>
+DROP LOGFILE GROUP <replaceable>logfile_group</replaceable>
+ ENGINE [=] <replaceable>engine</replaceable>
+</programlisting>
+
+ <para>
+ This statement drops the logfile group named
+ <replaceable>logfile_group</replaceable>. The logfile group must
+ already exist or a syntax error results. (For information on
+ creating logfile groups, see
+ <xref linkend="create-logfile-group"/>.)
+ </para>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: Before dropping a
+ logfile group, you must drop all tablespaces that use that logfile
+ group for <literal>UNDO</literal> logging.
+ </para>
+
+ <para>
+ The <literal>ENGINE</literal> clause (required) provides the name of
+ the storage engine used by the logfile group to be dropped. In MySQL
+ 5.1, the only accepted values for <replaceable>engine</replaceable>
+ are <literal>NDB</literal> and <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ <literal>DROP LOGFILE GROUP</literal> was added in MySQL 5.1.6. In
+ MySQL 5.1, it is useful only with Disk Data storage for MySQL
+ Cluster. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+ </section>
+
+ <section id="drop-tablespace">
+ <title>&title-drop-tablespace;</title>
+
+<programlisting>
+DROP TABLESPACE <replaceable>tablespace</replaceable>
+ ENGINE [=] <replaceable>engine</replaceable>
+</programlisting>
+
+ <para>
+ This statement drops a tablespace that was previously created using
+ <literal>CREATE TABLESPACE</literal> (see
+ <xref linkend="create-tablespace"/>).
+ </para>
+
+ <para>
+ <emphasis role="bold">Important</emphasis>: The tablespace to be
+ dropped must not contain any datafiles; in other words, before you
+ can drop a tablespace, you must first drop each of its datafiles
+ using <literal>ALTER TABLESPACE ... DROP DATAFILE</literal> (see
+ <xref linkend="alter-tablespace"/>).
+ </para>
+
+ <para>
+ The <literal>ENGINE</literal> clause (required) specifies the
+ storage engine used by the tablespace. In MySQL 5.1, the only
+ accepted values for <replaceable>engine</replaceable> are
+ <literal>NDB</literal> and <literal>NDBCLUSTER</literal>.
+ </para>
+
+ <para>
+ <literal>DROP TABLESPACE</literal> was added in MySQL 5.1.6. In
+ MySQL 5.1, it is useful only with Disk Data storage for MySQL
+ Cluster. See <xref linkend="mysql-cluster-disk-data"/>.
+ </para>
+</section>
+
<section id="rename-database">
<title>&title-rename-database;</title>
Modified: trunk/refman-common/titles.en.ent
===================================================================
--- trunk/refman-common/titles.en.ent 2006-03-08 04:28:31 UTC (rev 1524)
+++ trunk/refman-common/titles.en.ent 2006-03-08 04:45:45 UTC (rev 1525)
@@ -31,8 +31,10 @@
<!ENTITY title-alpha-dec-osf1 "Alpha-DEC-OSF/1 Notes">
<!ENTITY title-alpha-dec-unix "Alpha-DEC-UNIX Notes (Tru64)">
<!ENTITY title-alter-database "<literal>ALTER DATABASE</literal> Syntax">
+<!ENTITY title-alter-logfile-group "<literal>ALTER LOGFILE GROUP</literal> Syntax">
<!ENTITY title-alter-procedure "<literal>ALTER PROCEDURE</literal> and <literal>ALTER FUNCTION</literal> Syntax">
<!ENTITY title-alter-table "<literal>ALTER TABLE</literal> Syntax">
+<!ENTITY title-alter-tablespace "<literal>ALTER TABLESPACE</literal> Syntax">
<!ENTITY title-alter-table-problems "Problems with <literal>ALTER TABLE</literal>">
<!ENTITY title-alter-view "<literal>ALTER VIEW</literal> Syntax">
<!ENTITY title-analysing-spatial-information "Analyzing Spatial Information">
@@ -267,8 +269,10 @@
<!ENTITY title-create-database "<literal>CREATE DATABASE</literal> Syntax">
<!ENTITY title-create-function "<literal>CREATE FUNCTION</literal> Syntax">
<!ENTITY title-create-index "<literal>CREATE INDEX</literal> Syntax">
+<!ENTITY title-create-logfile-group "<literal>CREATE LOGFILE GROUP</literal> Syntax">
<!ENTITY title-create-procedure "<literal>CREATE PROCEDURE</literal> and <literal>CREATE FUNCTION</literal> Syntax">
<!ENTITY title-create-table "<literal>CREATE TABLE</literal> Syntax">
+<!ENTITY title-create-tablespace "<literal>CREATE TABLESPACE</literal> Syntax">
<!ENTITY title-create-trigger "<literal>CREATE TRIGGER</literal> Syntax">
<!ENTITY title-create-user "<literal>CREATE USER</literal> Syntax">
<!ENTITY title-create-view "<literal>CREATE VIEW</literal> Syntax">
@@ -332,8 +336,10 @@
<!ENTITY title-drop-database "<literal>DROP DATABASE</literal> Syntax">
<!ENTITY title-drop-function "<literal>DROP FUNCTION</literal> Syntax">
<!ENTITY title-drop-index "<literal>DROP INDEX</literal> Syntax">
+<!ENTITY title-drop-logfile-group "<literal>DROP LOGFILE GROUP</literal> Syntax">
<!ENTITY title-drop-procedure "<literal>DROP PROCEDURE</literal> and <literal>DROP FUNCTION</literal> Syntax">
<!ENTITY title-drop-table "<literal>DROP TABLE</literal> Syntax">
+<!ENTITY title-drop-tablespace "<literal>DROP TABLESPACE</literal> Syntax">
<!ENTITY title-drop-trigger "<literal>DROP TRIGGER</literal> Syntax">
<!ENTITY title-drop-user "<literal>DROP USER</literal> Syntax">
<!ENTITY title-drop-view "<literal>DROP VIEW</literal> Syntax">
@@ -807,6 +813,7 @@
<!ENTITY title-mysql-cluster-configuration "MySQL Cluster Configuration">
<!ENTITY title-mysql-cluster-connectstring "The MySQL Cluster <literal>connectstring</literal>">
<!ENTITY title-mysql-cluster-db-definition "Defining MySQL Cluster Data Nodes">
+<!ENTITY title-mysql-cluster-disk-data "MySQL Cluster Disk Data Storage">
<!ENTITY title-mysql-cluster-direct-tcp-definition "MySQL Cluster TCP/IP Connections Using Direct Connections">
<!ENTITY title-mysql-cluster-event-reports "Event Reports Generated in MySQL Cluster">
<!ENTITY title-mysql-cluster-faq "MySQL Cluster FAQ">
| Thread |
|---|
| • svn commit - mysqldoc@docsrva: r1525 - in trunk: refman-5.1 refman-common | jon | 8 Mar |