At 12:00 PM 10/9/2007, Olivier Smedts wrote:
>I agree to the idee that replication should not happen in policyd, but
>in MySQL, cause MySQL already supports replication and redundancy. And
>it works nearly like a charm. But here is the problem :
>policyd doesn't use an AUTO_INCREMENT id in its primary keys (in
>"triplet" table mostly), so if two mail servers receive the same mail in
>the same time (between the time at which policyd checks in the entry
>already exists and the time at which it inserts a new one), the first
>server will insert the new entry, and the second server won't be able to
>insert it (primary key constraint violation) so the replication will stop.
>
>  >
>  > I personnaly like this since I have already replicated system like
>  > that with severals slaves... and a loadbalancer have lb read slaves.
>
>I set up 3 mail servers (MX) with policyd and MySQL multi-master chain
>replication (each node is slave of the previous one and master of the
>next one).
>I think a solution would be to insert "IF EXIST" in DELETE and UPDATE
>queries, and "IF NOT EXIST" in INSERT queries of policyd (greylist.c
>source file), so that the same query could be executed two times without
>stopping replication. What do you think of this solution ? Could it be
>done upstream, to make policyd a perfect greylisting daemon for mail
>server clusters ?

We have a similar setup and it is pretty rare that this type of 
duplicate key item would occur.  A easy fix within mysql is to just 
tell mysql to ignore duplicate key errors on replication.  It'll 
create an extremely slight data inconsistency; however, it will not 
affect anything from my experience.  Just add the following to my.cnf 
[mysqld] section.

slave-skip-errors=126,1062

We use this reliably with policyd as well as dozens of other mysql 
apps with zero impact on data integrity.

- Nate




-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
policyd-users mailing list
policyd-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/policyd-users

Reply via email to