This section provides additional explanation and examples of usage for different combinations of replication filtering options.
Some typical combinations of replication filter rule types are given in the following table:
|Condition (Types of Options)||Outcome|
|No ||The slave executes all events that it receives from the master.|
|The slave accepts or ignores events using the database options. It executes all events permitted by those options because there are no table restrictions.|
|All events are accepted at the database-checking stage because there are no database conditions. The slave executes or ignores events based solely on the table options.|
|A combination of database and table options:||The slave accepts or ignores events using the database options. Then it evaluates all events permitted by those options according to the table options. This can sometimes lead to results that seem counterintuitive, and that may be different depending on whether you are using statement-based or row-based replication; see the text for an example.|
A more complex example follows, in which we examine the outcomes for both statement-based and row-based settings.
Suppose that we have two tables
db2 on the master, and the slave is
running with the following options (and no other replication
replicate-ignore-db = db1 replicate-do-table = db2.tbl2
Now we execute the following statements on the master:
USE db1; INSERT INTO db2.tbl2 VALUES (1);
The results on the slave vary considerably depending on the binary log format, and may not match initial expectations in either case.
USE statement causes
db1 to be the default database. Thus the
matches, and the
INSERT statement is
ignored. The table options are not checked.
The default database has no effect on how the slave reads
database options when using row-based replication. Thus, the
USE statement makes no
difference in how the
--replicate-ignore-db option is
handled: the database specified by this option does not match
the database where the
statement changes data, so the slave proceeds to check the
table options. The table specified by
the table to be updated, and the row is