Replication Features and Issues
1505
• Use one or more
ALTER TABLE
statements on the master to change the names of any database
objects where these names would be considered reserved words on the slave, and change any SQL
statements that use the old names to use the new names instead.
• In any SQL statements using these database object names, write the names as quoted identifiers
using backtick characters (
`
).
For listings of reserved words by MySQL version, see
Reserved Words
, in the MySQL Server Version
Reference. For identifier quoting rules, see
Section 9.2, “Schema Object Names”
.
16.4.1.20. Slave Errors During Replication
If a statement produces the same error (identical error code) on both the master and the slave, the
error is logged, but replication continues.
If a statement produces different errors on the master and the slave, the slave SQL thread terminates,
and the slave writes a message to its error log and waits for the database administrator to decide what
to do about the error. This includes the case that a statement produces an error on the master or the
slave, but not both. To address the issue, connect to the slave manually and determine the cause of
the problem.
SHOW SLAVE STATUS
is useful for this. Then fix the problem and run
START SLAVE
. For
example, you might need to create a nonexistent table before you can start the slave again.
If this error code validation behavior is not desirable, some or all errors can be masked out (ignored)
with the
--slave-skip-errors
[1463]
option.
For nontransactional storage engines such as
MyISAM
, it is possible to have a statement that only
partially updates a table and returns an error code. This can happen, for example, on a multiple-row
insert that has one row violating a key constraint, or if a long update statement is killed after updating
some of the rows. If that happens on the master, the slave expects execution of the statement to result
in the same error code. If it does not, the slave SQL thread stops as described previously.
If you are replicating between tables that use different storage engines on the master and slave, keep
in mind that the same statement might produce a different error when run against one version of the
table, but not the other, or might cause an error for one version of the table, but not the other. For
example, since
MyISAM
ignores foreign key constraints, an
INSERT
or
UPDATE
statement accessing
an
InnoDB
table on the master might cause a foreign key violation but the same statement performed
on a
MyISAM
version of the same table on the slave would produce no such error, causing replication
to stop.
16.4.1.21. Replication and Server SQL Mode
Using different server SQL mode settings on the master and the slave may cause the same
INSERT
statements to be handled differently on the master and the slave, leading the master and slave to
diverge. For best results, you should always use the same server SQL mode on the master and on the
slave.
For more information, see
Section 5.1.7, “Server SQL Modes”
.
16.4.1.22. Replication Retries and Timeouts
In MySQL 5.0 (starting from 5.0.3), there is a global system variable
slave_transaction_retries
[1466]
: If the slave SQL thread fails to
execute a transaction because of an
InnoDB
deadlock or because it exceeded
the
InnoDB
innodb_lock_wait_timeout
[1244]
or the NDBCLUSTER
TransactionDeadlockDetectionTimeout
or
TransactionInactiveTimeout
value, the slave
automatically retries the transaction
slave_transaction_retries
[1466]
times before stopping
with an error. The default value is 10. Starting from MySQL 5.0.4, the total retry count can be seen in
the output of
SHOW STATUS
; see
Section 5.1.6, “Server Status Variables”
.
16.4.1.23. Replication and
TIMESTAMP
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 ...