Integrity constraint violation?
Posted by:
alejandro tami ()
Date: October 24, 2009 10:23AM
Hi to all, let me first put you in perspective. I have 4 multi master mysql servers configured to replicate in a circular form. This is because the client has connectivity issues. Each server has an application (witch i've made), and all works perfectly but sometimes when the user tries to insert a new registry in the DB the application throws this exception:
com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '212' for key 'PRIMARY'
the thing is that each my.ini file is configured as follows:
auto_increment_increment = 10 (this value remains in each server)
auto_increment_offset = 2 (this one changes in every server)
server-id=20 (this one changes in every server)
log-bin=mysql-bin
log-slave-updates
replicate-same-server-id = 0
One more thing, the replication it's been working perfectly so far, but, as a I said, when the user tries to write on the local data base the exception is thrown BUT (allmost forget) if the user does some action (like a search) and retries the previous operation it succeeds. What could be the problem? Thanks a lot in advance.BEST REGARDS
Edit: It's like the engine couldn't auto increment the previous id and tried to use the same id that is previously used by the same server, that is to say, it doesn't happen with id's generated by other servers.
Edited 2 time(s). Last edit at 10/24/2009 10:46AM by alejandro tami.
Sorry, only registered users may post in this forum.
© 1995-2008 MySQL AB, 2008- Sun Microsystems, Inc.