Rechercher dans le manuel MySQL
17.4.1.28 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 a temporary error is recorded in the slave's error log, you do not necessarily have to take any action suggested in the quoted error message. Temporary errors should be handled by the client retrying the transaction. For example, if the slave SQL thread records a temporary error relating to a deadlock, you do not need to restart the transaction manually on the slave, unless the slave SQL thread subsequently terminates with a nontemporary error message.
If this error code validation behavior is not desirable, some or
all errors can be masked out (ignored) with the
--slave-skip-errors
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.
Document created the 26/06/2006, last modified the 26/10/2018
Source of the printed document:https://www.gaudry.be/en/mysql-rf-replication-features-slaveerrors.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.