Replication Features and Issues
1503
Temporary Tables”
. Unclean shutdowns might produce problems, especially if the disk cache was not
flushed to disk before the problem occurred:
• For transactions, the slave commits and then updates
relay-log.info
. If a crash occurs between
these two operations, relay log processing will have proceeded further than the information file
indicates and the slave will re-execute the events from the last transaction in the relay log after it has
been restarted.
• A similar problem can occur if the slave updates
relay-log.info
but the server host crashes
before the write has been flushed to disk. Writes are not forced to disk because the server relies on
the operating system to flush the file from time to time.
The fault tolerance of your system for these types of problems is greatly increased if you have a good
uninterruptible power supply.
16.4.1.14. Replication and
MEMORY
Tables
When a master server shuts down and restarts, its
MEMORY
(
HEAP
) tables become empty. To replicate
this effect to slaves, the first time that the master uses a given
MEMORY
table after startup, it logs an
event that notifies slaves that the table must to be emptied by writing a
DELETE
statement for that table
to the binary log.
When a slave server shuts down and restarts, its
MEMORY
tables become empty. This causes the slave
to be out of synchrony with the master and may lead to other failures or cause the slave to stop. For
example,
INSERT INTO ... SELECT FROM memory_table
may insert a different set of rows on
the master and slave.
The safe way to restart a slave that is replicating
MEMORY
tables is to first drop or delete all rows from
the
MEMORY
tables on the master and wait until those changes have replicated to the slave. Then it is
safe to restart the slave.
The size of
MEMORY
tables is limited by the value of the
max_heap_table_size
[468]
system
variable, which is not replicated (see
Section 16.4.1.28, “Replication and Variables”
). A change in
max_heap_table_size
takes effect for
MEMORY
tables that are created or updated using
ALTER
TABLE ... ENGINE = MEMORY
or
TRUNCATE TABLE
following the change, or for all
MEMORY
tables following a server restart. If you increase the value of this variable on the master without doing
so on the slave, it becomes possible for a table on the master to grow larger than its counterpart
on the slave, leading to inserts that succeed on the master but fail on the slave with
Table is
full
errors. This is a known issue (Bug #48666). In such cases, you must set the global value of
max_heap_table_size
[468]
on the slave as well as on the master, then restart replication. It is also
recommended that you restart both the master and slave MySQL servers, to insure that the new value
takes complete (global) effect on each of them.
See
Section 14.4, “The
MEMORY
(
HEAP
) Storage Engine”
, for more information about
MEMORY
tables.
16.4.1.15. Replication and Temporary Tables
Safe slave shutdown when using temporary tables.
Temporary tables are replicated except
in the case where you stop the slave server (not just the slave threads) and you have replicated
temporary tables that are open for use in updates that have not yet been executed on the slave. If you
stop the slave server, the temporary tables needed by those updates are no longer available when
the slave is restarted. To avoid this problem, do not shut down the slave while it has temporary tables
open. Instead, use the following procedure:
1. Issue a
STOP SLAVE SQL_THREAD
statement.
2. Use
SHOW STATUS
to check the value of the
Slave_open_temp_tables
[531]
variable.
3. If the value is not 0, restart the slave SQL thread with
START SLAVE SQL_THREAD
and repeat the
procedure later.
Summary of Contents for 5.0
Page 1: ...MySQL 5 0 Reference Manual ...
Page 18: ...xviii ...
Page 60: ...40 ...
Page 396: ...376 ...
Page 578: ...558 ...
Page 636: ...616 ...
Page 844: ...824 ...
Page 1234: ...1214 ...
Page 1427: ...MySQL Proxy Scripting 1407 ...
Page 1734: ...1714 ...
Page 1752: ...1732 ...
Page 1783: ...Configuring Connector ODBC 1763 ...
Page 1793: ...Connector ODBC Examples 1773 ...
Page 1839: ...Connector Net Installation 1819 2 You must choose the type of installation to perform ...
Page 2850: ...2830 ...
Page 2854: ...2834 ...
Page 2928: ...2908 ...
Page 3000: ...2980 ...
Page 3122: ...3102 ...
Page 3126: ...3106 ...
Page 3174: ...3154 ...
Page 3232: ...3212 ...