When evaluating replication or binary logging options, the slave
begins by checking to see whether there are any
--replicate-do-db
or
--replicate-ignore-db
options
that apply. (When using
--binlog-do-db
or
--binlog-ignore-db
the process is
similar but, the options are checked on the master.)
For statement-based logging, an exception is made in the rules
just given for the CREATE
DATABASE
, ALTER
DATABASE
, and DROP
DATABASE
statements (see
Section 16.1.3.4, “Binary Log Options and Variables”). In those
cases, the database being created, altered, or
dropped replaces the default database when
determining whether to log or to ignore updates.
When statement-based logging is in effect, the default database is checked for a match; when row-based logging is in use, the database where data is to be changed is the database that is checked. Regardless of the binary logging format, the checking of the database-level options proceeds as shown in this diagram:
The steps involved are listed here:
Are there any
--replicate-do-db
options?
Yes. Do any of them match the database?
Yes. Execute the statement and exit.
No. Continue to step 2.
No. Continue to step 2.
Are there any
--replicate-ignore-db
options?
Yes. Do any of them match the database?
Yes. Ignore the statement and exit.
No. Continue to step 3.
No. Continue to the next step.
--replicate-do-db
and
--replicate-ignore-db
options.
Proceed to checking the table-level replication options,
if there are any.
A statement that is not yet disallowed at this stage is not yet actually executed. The statement is not executed until all table-level options (if any) have also been checked, and the outcome of that process permits execution of the statement.
For a description of how the table-level replication options are checked, see Section 16.4.3.2, “Evaluation of Table-Level Replication Options”.
--binlog-do-db
and
--binlog-ignore-db
options.
Execute the statement and exit.
--binlog-do-db
can sometimes mean
“ignore other databases”. For example, when using
statement-based replication, a slave running with only
--binlog-do-db=sales
does not
write to the binary log any statement for which the default
database is different from sales
. When using
row-based replication and the same option, the slave writes to
the binary log only those updates that change data in
sales
.
User Comments
Add your own comment.