Today I spent several hours trying to find a problem in our
application until I found out there was a problem on the MySQL
side. In our setup we have several slave machines that replicate
data from a master server. The slaves are configured with a
series of replicate-do-table
directives in the
my.cnf
file so that only parts of the schema get
replicated. The remaining tables are modified locally, so to
avoid conflicts they are not updated with data coming from the
master.
We do however have the need to replicate data from the master for
some special-case tables. To solve this we usually have a column
that indicates whether a record was created on a master or a
slave machine and use an appropriate WHERE
clause in
all updates. This avoids collisions in concurrent
INSERT
s on the master and the slave. The application
knows which of the two records to use.
Due to historical reasons I …
[Read more]