dsync replication quota2 issue
George Kontostanos
gkontos.mail at gmail.com
Tue Oct 11 11:31:57 UTC 2016
Hello list,
We are testing a configuration with 2 mail servers using dsync replication
(dovecot 2.2.25 ). Everything works fine except the quota2 which is
calculated wrong only on one server. Quota2 resides on different databases
since each server needs to update it.
The problem: The local server always updates quota2 twice on each message
it receives. This happens only on one server. Updates run fine on the
second.
SQL Debug:
Query UPDATE quota2 SET bytes=bytes+2108,messages=messages+1 WHERE
username = 'user at domain.org'
Query UPDATE quota2 SET bytes=bytes+2108,messages=messages+1 WHERE
username = 'user at domain.org'
The result on the server that runs fine
mysql> select * from quota2;
+----------------------------+---------+----------+
| username | bytes | messages |
+----------------------------+---------+----------+
|
| user at domain.org | 2917126 | 17 |
The result on the server that has the problem:
mysql> select * from quota2;
+----------------------------+---------+----------+
| username | bytes | messages |
+----------------------------+---------+----------+
|
| user at domain.org | 2920317 | 19 |
dovecot -n is the same on both:
root at mx2:/var/log # dovecot -n
# 2.2.25 (7be1766): /usr/local/etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.15 (97b3da0)
# OS: FreeBSD 10.3-RELEASE amd64 ufs
auth_mechanisms = plain login
auth_verbose = yes
default_client_limit = 2560
default_process_limit = 512
dict {
acl = mysql:/usr/local/etc/dovecot/dovecot-dict-shares-sql.conf.ext
quota = mysql:/usr/local/etc/dovecot/dovecot-dict-quota-sql.conf.ext
}
doveadm_password = # hidden, use -P to show it
doveadm_port = 12345
log_path = /var/log/dovecot.log
mail_debug = yes
mail_home = /usr/local/vhosts/mail/%d/%n
mail_location = maildir:/usr/local/vhosts/mail/%d/%n:LAYOUT=fs
mail_max_userip_connections = 70
mail_plugins = quota acl notify replication
mail_privileged_group = vmail
mail_shared_explicit_inbox = yes
managesieve_notify_capability = mailto
managesieve_sieve_capability = fileinto reject envelope encoded-character
vacation subaddress comparator-i;ascii-numeric relational regex imap4flags
copy include variables body enotify environment mailbox date index ihave
duplicate mime foreverypart extracttext
mbox_write_locks = fcntl
namespace {
inbox = no
list = children
location =
maildir:/usr/local/vhosts/mail/%%d/%%n:LAYOUT=fs:INDEX=/usr/local/vhosts/indexes/%d/%n/shared/%%u:INDEXPVT=/usr/local/vhosts/indexes/%d/%n/shared/%%u
prefix = shared/%%d/%%n/
separator = /
subscriptions = no
type = shared
}
namespace inbox {
inbox = yes
list = yes
location =
mailbox Drafts {
auto = subscribe
special_use = \Drafts
}
mailbox Junk {
auto = subscribe
special_use = \Junk
}
mailbox Sent {
auto = subscribe
special_use = \Sent
}
mailbox Trash {
auto = subscribe
special_use = \Trash
}
prefix =
separator = /
type = private
}
passdb {
args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
plugin {
acl = vfile
acl_shared_dict = proxy::acl
mail_replica = tcp:beta.sophimail.com:12345
quota = dict:User quota::proxy::quota
quota_rule2 = Trash:storage=+100M
sieve = /usr/local/vhosts/mail/%d/%n/.dovecot.sieve
sieve_before = /usr/local/vhosts/sieve/before.d/
sieve_dir = /usr/local/vhosts/mail/%d/%n
sieve_global_dir = /usr/local/vhosts/sieve/%d
sieve_global_path = /usr/local/vhosts/sieve/%d/default.sieve
}
protocols = imap lmtp sieve sieve
service aggregator {
fifo_listener replication-notify-fifo {
mode = 0666
user = vmail
}
unix_listener replication-notify {
mode = 0666
user = vmail
}
}
service auth-worker {
user = vmail
}
service auth {
unix_listener /var/spool/postfix/private/auth {
group = postfix
mode = 0666
user = postfix
}
unix_listener auth-userdb {
mode = 0600
user = vmail
}
user = dovecot
}
service config {
unix_listener config {
user = vmail
}
}
service dict {
unix_listener dict {
mode = 0600
user = vmail
}
}
service doveadm {
inet_listener {
port = 12345
}
user = vmail
}
service imap-login {
inet_listener imap {
port = 143
}
}
service lmtp {
unix_listener /var/spool/postfix/private/dovecot-lmtp {
group = postfix
mode = 0600
user = postfix
}
}
service managesieve-login {
inet_listener sieve {
port = 4190
}
process_min_avail = 0
service_count = 1
vsz_limit = 64 M
}
service replicator {
unix_listener replicator-doveadm {
mode = 0666
}
}
ssl_cert = </usr/local/etc/postfix/keys/domain.com.crt
ssl_key = </usr/local/etc/postfix/keys/domain.com.key
userdb {
args = /usr/local/etc/dovecot/dovecot-sql.conf.ext
driver = sql
}
protocol lmtp {
mail_plugins = quota acl notify replication sieve notify replication
}
protocol imap {
imap_client_workarounds = tb-extra-mailbox-sep
mail_plugins = quota acl notify replication imap_quota imap_acl notify
replication
}
protocol lda {
mail_plugins = quota acl notify replication sieve acl
postmaster_address = root
}
local 192.168.3.6 {
protocol imap {
ssl_cert = </usr/local/etc/postfix/keys/domain.com.crt
ssl_key = </usr/local/etc/postfix/keys/domain.com.key
}
}
dovecot-dict-quota-sql.conf.ext:
connect = host=127.0.0.1 dbname=quota user=mailadmin password=**********
map {
pattern = priv/quota/storage
table = quota2
username_field = username
value_field = bytes
}
map {
pattern = priv/quota/messages
table = quota2
username_field = username
value_field = messages
}
Sorry for the lengthy email, any help is very much appreciated.
--
George Kontostanos
---
More information about the dovecot
mailing list