Michael, > I am seeing 15 min delays as amavisd tries (in vain) to add an existing > email ot the maddr table. I would almost thing that if amavisd sees a > duplicate entry, it might assume that one of the other processes put it > there.
> (92111-09) (!!)TROUBLE in check_mail: sql-enter FAILED: > find_or_save_addr: failed to insert addr deandrag...@yahoo.com: > at (eval 69) line 109, <GEN19> line 10872. > > (92109-09) (!!)TROUBLE in check_mail: sql-enter FAILED: > find_or_save_addr: failed to insert addr deandrag...@yahoo.com: > sql exec: err=1062, 23000, DBD::mysql::st execute failed: > Duplicate entry '201013-deandrag...@yahoo.com' > for key 'maddr_idx_tag_email' > at (eval 68) line 166, <GEN19> line 2708. > at (eval 69) line 109, <GEN19> line 2708. It's funny that the error text (between 'yahoo.com: ' and 'at') is empty in the process 92111-09. The 'Duplicate entry' as in 92109-09 is what could be expected. > this only happens with 'trigger happy' mail servers connect multiple > times in parallel and blast all their critically important spring sale > emails all at once. > (kinda wish yahoo would just connect once and send all three) > > so, should amavisd just use the existing maddr id if it exists? Yes it should. > which doesn't make sense, since amavisd does a (basically) > > if ! (sel_addr) then > ins_addr > sel_addr. > (do, a read, if it doesn't exist, then inserts, ignores the error code > of the insert, in case someone else inserted it, then a select. Right. > so, I don't see why I am getting these, I'll have to keep looking. I > don't think its amavis. > > I am assuming this is a race condition, all three processes read maddr, > don't find it, then try to insert it, looks like two of them failed. I checked our logs and I'm not getting any of these (using PostgreSQL). The race condition is probably due to some SQL optimization/caching/whatever. I assume the ENGINE=InnoDB is used. Which version of MySQL btw? The correct solution would probably be to do a SELECT-OR-INSERT in one go, or perhaps do an INSERT which could return a generated ID of the inserted record. Suggestion on how to do it in a standard SQL as understood by mainstream SQL servers is welcome. Mark ------------------------------------------------------------------------------ Download Intel® Parallel Studio Eval Try the new software tools for yourself. Speed compiling, find bugs proactively, and fine-tune applications for parallel performance. See why Intel Parallel Studio got high marks during beta. http://p.sf.net/sfu/intel-sw-dev _______________________________________________ AMaViS-user mailing list AMaViS-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/amavis-user AMaViS-FAQ:http://www.amavis.org/amavis-faq.php3 AMaViS-HowTos:http://www.amavis.org/howto/