jc@stripped ("Jesse") writes:
> Replication has come to a halt on my slave machine because of a
> foreign key constraint issue. It was attempting to add a child record
> for a parent record that is not present. After checking it, starting
> with that particular missing parent record, there are no more below
> that area. My question is this. If it's present on the master, why
> wouldn't it be present on the slave before the child record would have
> been added? I did not receive such an error on the master server?? I
> could probably add the missing master record, but the problem is that
> this will occur again. It's happened about 3 times now. Does anyone
> have any suggestions?
This is just showing you that the databases that you thought were in
synch are not in fact the same. If this is a must (and for most slaves
it is) then you need to check the db consistency between the 2
instances and find out what is different and fix it. maatkit has some
tools to do this as often it's quite hard on a busy system where the
data is changing while you're trying to check for differences.
If you can afford downtime it might be easier to take a new copy from
the master or another slave (if you have one) which you haven't had
these issues on.
Replication generally works fine if there are no problems. It also
assumes that there are no local changes on the slave which may break
replication. Could this be a possibility? Certainly the statements
(or transactions) are executed in the same order on the master as on
the slave so that shouldn't be an issue, under normal circumstances.