Status variables for Query_log_event
Status variable |
- 1-byte identifier |
- Size
|
+ 1 byte identifier |
+ Format |
Description |
@@ -1251,13 +1288,13 @@ protected:
flags2 |
Q_FLAGS2_CODE == 0 |
4 byte bitfield |
- The flags in thd->options, binary AND-ed with
- OPTIONS_WRITTEN_TO_BIN_LOG. The thd->options bitfield contains
- options for SELECT. OPTIONS_WRITTEN identifies those options that
- need to be written to the binlog (not all do). Specifically,
- OPTIONS_WRITTEN_TO_BIN_LOG equals (OPTION_AUTO_IS_NULL |
- OPTION_NO_FOREIGN_KEY_CHECKS | OPTION_RELAXED_UNIQUE_CHECKS |
- OPTION_NOT_AUTOCOMMIT), or 0x0c084000 in hex.
+ | The flags in @c thd->options, binary AND-ed with @c
+ OPTIONS_WRITTEN_TO_BIN_LOG. The @c thd->options bitfield contains
+ options for "SELECT". @c OPTIONS_WRITTEN identifies those options
+ that need to be written to the binlog (not all do). Specifically,
+ @c OPTIONS_WRITTEN_TO_BIN_LOG equals (@c OPTION_AUTO_IS_NULL | @c
+ OPTION_NO_FOREIGN_KEY_CHECKS | @c OPTION_RELAXED_UNIQUE_CHECKS |
+ @c OPTION_NOT_AUTOCOMMIT), or 0x0c084000 in hex.
These flags correspond to the SQL variables SQL_AUTO_IS_NULL,
FOREIGN_KEY_CHECKS, UNIQUE_CHECKS, and AUTOCOMMIT, documented in
@@ -1271,8 +1308,8 @@ protected:
|
sql_mode |
Q_SQL_MODE_CODE == 1 |
- 8 byte integer |
- The sql_mode variable. See the section "SQL Modes" in the
+ | 8 byte bitfield |
+ The @c sql_mode variable. See the section "SQL Modes" in the
MySQL manual, and see mysql_priv.h for a list of the possible
flags. Currently (2007-10-04), the following flags are available:
@@ -1310,10 +1347,10 @@ protected:
MODE_PAD_CHAR_TO_FULL_LENGTH==0x80000000
All these flags are replicated from the server. However, all
- flags except MODE_NO_DIR_IN_CREATE are honored by the slave; the
- slave always preserves its old value of MODE_NO_DIR_IN_CREATE.
- For a rationale, see comment in Query_log_event::do_apply_event in
- log_event.cc.
+ flags except @c MODE_NO_DIR_IN_CREATE are honored by the slave;
+ the slave always preserves its old value of @c
+ MODE_NO_DIR_IN_CREATE. For a rationale, see comment in
+ @c Query_log_event::do_apply_event in @c log_event.cc.
This field is always written to the binlog.
|
@@ -1327,7 +1364,7 @@ protected:
Stores the client's current catalog. Every database belongs
to a catalog, the same way that every table belongs to a
- database. Currently, there is only one catalog, 'std'.
+ database. Currently, there is only one catalog, "std".
This field is written if the length of the catalog is > 0;
otherwise it is not written.
@@ -1343,7 +1380,7 @@ protected:
auto_increment_offset, in that order. For more information, see
"System variables" in the MySQL manual.
- This field is written if auto_increment>1; otherwise it is not
+ This field is written if auto_increment > 1. Otherwise, it is not
written.
|
@@ -1351,14 +1388,14 @@ protected:
charset |
Q_CHARSET_CODE == 4 |
- three 2-byte unsigned integers (i.e., 6 bytes) |
+ three 2 byte unsigned integers, totally 2+2+2=6 bytes |
The three variables character_set_client,
collation_connection, and collation_server, in that order.
- `character_set_client' is a code identifying the character set and
+ character_set_client is a code identifying the character set and
collation used by the client to encode the query.
- `collation_connection' identifies the character set and collation
+ collation_connection identifies the character set and collation
that the master converts the query to when it receives it; this is
- useful when comparing literal strings. `collation_server' is the
+ useful when comparing literal strings. collation_server is the
default character set and collation used when a new database is
created.
@@ -1396,9 +1433,9 @@ protected:
| Q_LC_TIME_NAMES_CODE == 7 |
2 byte integer |
A code identifying a table of month and day names. The
- mapping from codes to languages is defined in sql_locale.cc.
+ mapping from codes to languages is defined in @c sql_locale.cc.
- This field is written if it is != 0, i.e., if the locale is not
+ This field is written if it is not 0, i.e., if the locale is not
en_US.
|
@@ -1409,14 +1446,14 @@ protected:
2 byte integer |
The value of the collation_database system variable (in the
- source code stored in thd->variables.collation_database), which
+ source code stored in @c thd->variables.collation_database), which
holds the code for a (character set, collation) pair as described
above (see Q_CHARSET_CODE).
- `collation_database' was used in old versions (???WHEN). Its
- value was loaded when issuing a "use db" command and could be
- changed by issuing a "SET collation_database=xxx" command. It
- used to affect the "LOAD DATA INFILE" and "CREATE TABLE" commands.
+ collation_database was used in old versions (???WHEN). Its value
+ was loaded when issuing a "use db" query and could be changed by
+ issuing a "SET collation_database=xxx" query. It used to affect
+ the "LOAD DATA INFILE" and "CREATE TABLE" commands.
In newer versions, "CREATE TABLE" has been changed to take the
character set from the database of the created table, rather than
@@ -1433,17 +1470,17 @@ protected:
@subsection Query_log_event_notes_on_previous_versions Notes on Previous Versions
- @li Status vars were introduced in version 5.0. To read earlier
+ * Status vars were introduced in version 5.0. To read earlier
versions correctly, check the length of the Post-Header.
- @li The status variable Q_CATALOG_CODE == 2 existed in MySQL 5.0.x,
+ * The status variable Q_CATALOG_CODE == 2 existed in MySQL 5.0.x,
where 0<=x<=3. It was identical to Q_CATALOG_CODE, except that the
string had a trailing '\0'. The '\0' was removed in 5.0.4 since it
was redundant (the string length is stored before the string). The
Q_CATALOG_CODE will never be written by a new master, but can still
be understood by a new slave.
- @li See Q_CHARSET_DATABASE_NUMBER in the table above.
+ * See Q_CHARSET_DATABASE_NUMBER in the table above.
*/
class Query_log_event: public Log_event
@@ -1576,7 +1613,8 @@ public: /* !!! Public in this patch to allow old usage */
/**
@class Muted_query_log_event
- Pretends to log SQL queries, but doesn't actually do so.
+ Pretends to log SQL queries, but doesn't actually do so. This is
+ used internally only and never written to any binlog.
@section Muted_query_log_event_binary_format Binary Format
@@ -1603,7 +1641,7 @@ public:
@class Slave_log_event
Note that this class is currently not used at all; no code writes a
- Slave_log_event (though some code in repl_failsafe.cc reads
+ @c Slave_log_event (though some code in @c repl_failsafe.cc reads @c
Slave_log_event). So it's not a problem if this code is not
maintained.
@@ -1617,7 +1655,7 @@ public:
|
Name |
- Size
|
+ Format |
Description |
@@ -1717,26 +1755,27 @@ private:
Name |
- Size
|
+ Format |
Description |
slave_proxy_id |
4 byte unsigned integer |
- An integer identifying the client thread, which is unique on
- the server. (Note, however, that the same slave_proxy_id may
- appear on different servers.) This is used when a client thread
- creates a temporary table. Temporary tables are local to the
- client, and the slave_proxy_id is used to distinguish temporary
- tables belonging to different clients.
+ | An integer identifying the client thread that issued the
+ query. The id is unique per server. (Note, however, that two
+ threads on different servers may have the same slave_proxy_id.)
+ This is used when a client thread creates a temporary table local
+ to the client. The slave_proxy_id is used to distinguish
+ temporary tables that belong to different clients.
|
exec_time |
4 byte unsigned integer |
- ???TODO |
+ The time from when the query started to when it was logged in
+ the binlog, in seconds. |
@@ -1773,7 +1812,7 @@ private:
Name |
- Size
|
+ Format |
Description |
@@ -1813,7 +1852,7 @@ private:
In the old format, we know that each string has length 0 or
1. Therefore, only the first byte of each string is stored. The
order of the strings is the same as in the new format. These five
- bytes are followed by the same 1-byte bitfield as in the new
+ bytes are followed by the same 1 byte bitfield as in the new
format. Finally, a 1 byte bitfield called empty_flags is stored.
The low 5 bits of empty_flags indicate which of the five strings
have length 0. For each of the following flags that is set, the
@@ -1831,7 +1870,7 @@ private:
field_lens |
- num_fields 1-byte unsigned integers |
+ num_fields 1 byte unsigned integers |
An array of num_fields integers representing the length of
each field in the query. (num_fields is from the Post-Header).
|
@@ -1992,11 +2031,13 @@ extern char server_version[SERVER_VERSION_LENGTH];
Start_log_event_v3 is the Start_log_event of binlog format 3 (MySQL 3.23 and
4.x).
- Format_description_log_event derives from Start_log_event_v3; it is the
- Start_log_event of binlog format 4 (MySQL 5.0), that is, the event that
- describes the other events' header/postheader lengths. This event is sent by
- MySQL 5.0 whenever it starts sending a new binlog if the requested position
- is >4 (otherwise if ==4 the event will be sent naturally).
+
+ Format_description_log_event derives from Start_log_event_v3; it is
+ the Start_log_event of binlog format 4 (MySQL 5.0), that is, the
+ event that describes the other events' Common-Header/Post-Header
+ lengths. This event is sent by MySQL 5.0 whenever it starts sending
+ a new binlog if the requested position is >4 (otherwise if ==4 the
+ event will be sent naturally).
@section Start_log_event_v3_binary_format Binary Format
*/
@@ -2150,7 +2191,9 @@ protected:
/**
@class Intvar_log_event
- Logs special variables related to auto_increment values.
+ An Intvar_log_event will be created just before a Query_log_event,
+ if the query uses one of the variables LAST_INSERT_ID or INSERT_ID.
+ Each Intvar_log_event holds the value of one of these variables.
@section Intvar_log_event_binary_format Binary Format
@@ -2161,12 +2204,12 @@ protected:
Name |
- Size
|
+ Format |
Description |
- Type |
+ type |
1 byte enumeration |
One byte identifying the type of variable stored. Currently,
two identifiers are supported: LAST_INSERT_ID_EVENT==1 and
@@ -2182,7 +2225,6 @@ protected:
|
*/
-
class Intvar_log_event: public Log_event
{
public:
@@ -2228,15 +2270,34 @@ private:
written in 4.1.1 for PASSWORD() (but the fact that it is written is just a
waste, it does not cause bugs).
+ The state of the random number generation consists of 128 bits,
+ which are stored internally as two 64-bit numbers.
+
@section Rand_log_event_binary_format Binary Format
This event type has no Post-Header. The Body of this event type has
two components:
- @li seed1 (8 bytes): 64 bit random seed1.
- @li seed2 (8 bytes): 64 bit random seed2.
+