Replication and MEMORY Tables
When a master server shuts down and restarts, its MEMORY 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
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:
• Row-format updates and deletes received from the master may fail with Can't find record in
• Statements such as 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.
An alternative restart method may apply in some cases. When binlog_format=ROW , you
can prevent the slave from stopping if you set slave_exec_mode=IDEMPOTENT  before
you start the slave again. This allows the slave to continue to replicate, but its MEMORY tables will
still be different from those on the master. This can be okay if the application logic is such that the
contents of MEMORY tables can be safely lost (for example, if the MEMORY tables are used for caching).
slave_exec_mode=IDEMPOTENT  applies globally to all tables, so it may hide other replication
errors in non-MEMORY tables.
The size of MEMORY tables is limited by the value of the max_heap_table_size  system
variable, which is not replicated (see Section 18.104.22.168, “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  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 ... zobacz całą notatkę