Sieve dict and bindir question

Stephan Bosch stephan at rename-it.nl
Sun Apr 30 19:29:15 EEST 2017


Op 4/28/2017 om 10:58 AM schreef Alessio Cecchi:
> Hi,
>
> I have setup the latest Dovecot and Sieve with dict in order to read
> rules from MySQL and works fine:
>
> sieve_before = dict:proxy::sieve;name=activesql;bindir=~/.sieve-bin
>
> dict {
>   sieve = mysql:/etc/dovecot/dovecot-dict-sieve-sql.conf.ext
> }
>
> # cat /etc/dovecot/dovecot-dict-sieve-sql.conf.ext
>
> connect = host=10.1.1.1 dbname=dovecot user=dovecot password=Ciao
> map {
>     pattern = priv/sieve/name/$script_name
>     table = user_sieve_scripts
>     username_field = username
>     value_field = id
>     fields {
>         script_name = $script_name
>     }
> }
> map {
>     pattern = priv/sieve/data/$id
>     table = user_sieve_scripts
>     username_field = username
>     value_field = script_data
>     fields {
>         id = $id
>     }
> }
>
> But when I update the rules in mysql sieve continue to apply only the
> "old" rules stored in the binary. The only way to apply the new rules
> is to delete the .sieve-bin/activesql.svbin. If I remove
> ";bindir=~/.sieve-bin" works fine.
>
> This is a cache issue and can be fixed via setting, is an issue or is
> a "feature" :-) ?

The wiki states the following:

The second query is only necessary when no compiled binary is available
or when the script has changed and needs to be recompiled. The data ID
is used to detect changes in the dict's underlying database. Changing a
Sieve script in the database must be done by first making a new script
data item with a new data ID. Then, the mapping from name to data ID
must be changed to point to the new script text, thereby changing the
data ID returned from the name lookup, i.e. the first query mentioned
above. Script binaries compiled from Sieve scripts contained in a dict
database record the data ID. While the data ID contained in the binary
is identical to the one returned from the dict lookup, the binary is
assumed up-to-date. When the returned data ID is different, the new
script text is retrieved using the second query and compiled into a new
binary containing the updated data ID.

Did you follow this?

Regards,

Stephan.



More information about the dovecot mailing list