Okay, I am having some trouble with MySQL that could *potentially* be quite
serious. A little background first.

I'm running PHP 4.2.0 (Release) and MySQL 3.23.49a over five servers. One
server is a MySQL Master with PHP CGI version, two are MySQL slaves and the
other two are Apache webservers with the PHP module. All the servers are
running FreeBSD 4.5 Release. The Master server also runs some scripts in
cron, which is where the problem is arising. I only send email from the
Master server and I want to keep a log of outgoing mail - so the other two
servers write mail into the database and a PHP script on the Master server
SELECTS unsent mail, sends it, then flags it as Sent

So:
SELECT MailID, MailBody, MailHeaders FROM Mail WHERE Sent = 0;
UPDATE Mail SET Sent = 1 WHERE MailID = [whatever];

This script runs every five minutes and works beautifully. Most of the time.
About six months ago, for some reason I can't fathom, the first query
returned ALL the mail from the database, and PHP dutifully started sending
out all the old email since the site launched. I investigated this as far as
possible, but couldn't figure out why MySQL had returned all the rows from
the Mail table - effectively ignoring my WHERE clause. I drew a blank and
hoped it was just a glitch. But yesterday it happened again! At 8:55 and
9:05 the script ran without any problems - but at 9:00 it glitched as I have
described. According to the binary logs, there were no changes to the data
during this time.

As I said, this script runs every five minutes - which means this query has
been ran around 83,000 times during the lifetime of my site. 82,998 times it
executed without any problems. Twice it has appeared to ignore my WHERE
clause. I really am at a loss about why this is happening - does anyone have
any ideas?

--Mike






---------------------------------------------------------------------
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

Reply via email to