inserts with now() resulting in replication-problems

2001-01-19 Thread Jan Kirchhoff


My Replication-Slave crashed a few days ago with an error in the error-log 
saying something like "duplicate primary key processing query "INSERT INTO 
testtable (time,name,number) VALUES (NOW(),'Hello',10)"

testtable's primary key was (time,name)
time: datetime
name: varchar
number: int

What I was wondering after that:

I do a "INSERT INTO testtable (time,name,number) VALUES (NOW(),'Hello',10) on 
the master. Then I do the *same* query again 1 Minute later. No Problem, 
since time has passed and NOW() is now different, so i do not have a 
duplictae key. 

If the Slave gets out of sync (loses the connection to the server), connects 
again and tries to catch up, it processes those two queries *within one 
second* which would result in an duplicate primary key on the slave. The 
Slave would abort with an error and the replication would stop. 

Is that right or did I misunderstand the concept?
I changed the query to REPLACE instead of INSERT which is, in this case, fine 
with me, but is it possible to tell mysql to ignore such problems and keep 
the Replication up? I'd like to make the server send be a mail or SMS on my 
mobile phone if that happens. So if I could make the slave keep on 
replicating but write a line into a logfile like "serious-errors.log". I 
could then make some shell-script send me a mail...

i'm running mysql 3.23.28-gamma on debian linux on Athlon-PCs.

thanks for any explaination!

Jan


-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php




Re: inserts with now() resulting in replication-problems

2001-01-19 Thread Vivek Khera

 "JK" == Jan Kirchhoff [EMAIL PROTECTED] writes:

JK If the Slave gets out of sync (loses the connection to the server), connects 
JK again and tries to catch up, it processes those two queries *within one 
JK second* which would result in an duplicate primary key on the slave. The 
JK Slave would abort with an error and the replication would stop. 

But then the slave is still not in sync since the data is different.
That doesn't seem to make sense for a replication scheme...

Just seems wrong to me, but what do I know ;-)

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php