dovecot-2.2: replication plugin: Added debug logging when mail_d...
dovecot at dovecot.org
dovecot at dovecot.org
Fri May 15 10:57:54 UTC 2015
details: http://hg.dovecot.org/dovecot-2.2/rev/7cf62f28fd62
changeset: 18700:7cf62f28fd62
user: Timo Sirainen <tss at iki.fi>
date: Fri May 15 13:54:49 2015 +0300
description:
replication plugin: Added debug logging when mail_debug=yes
diffstat:
src/plugins/replication/replication-plugin.c | 25 ++++++++++++++++++-------
1 files changed, 18 insertions(+), 7 deletions(-)
diffs (88 lines):
diff -r 6a40cb15e48f -r 7cf62f28fd62 src/plugins/replication/replication-plugin.c
--- a/src/plugins/replication/replication-plugin.c Fri May 15 13:48:45 2015 +0300
+++ b/src/plugins/replication/replication-plugin.c Fri May 15 13:54:49 2015 +0300
@@ -180,7 +180,8 @@
}
static void replication_notify(struct mail_namespace *ns,
- enum replication_priority priority)
+ enum replication_priority priority,
+ const char *event)
{
struct replication_user *ruser;
@@ -188,6 +189,11 @@
if (ruser == NULL)
return;
+ if (ns->user->mail_debug) {
+ i_debug("replication: Replication requested by '%s', priority=%d",
+ event, priority);
+ }
+
if (priority == REPLICATION_PRIORITY_SYNC) {
if (replication_notify_sync(ns->user) == 0) {
timeout_remove(&ruser->to);
@@ -254,7 +260,7 @@
priority = !ctx->new_messages ? REPLICATION_PRIORITY_LOW :
ruser->sync_secs == 0 ? REPLICATION_PRIORITY_HIGH :
REPLICATION_PRIORITY_SYNC;
- replication_notify(ctx->ns, priority);
+ replication_notify(ctx->ns, priority, "transction commit");
}
i_free(ctx);
}
@@ -262,7 +268,7 @@
static void replication_mailbox_create(struct mailbox *box)
{
replication_notify(mailbox_get_namespace(box),
- REPLICATION_PRIORITY_LOW);
+ REPLICATION_PRIORITY_LOW, "mailbox create");
}
static void
@@ -270,7 +276,7 @@
struct mailbox *box)
{
replication_notify(mailbox_get_namespace(box),
- REPLICATION_PRIORITY_LOW);
+ REPLICATION_PRIORITY_LOW, "mailbox delete");
}
static void
@@ -278,14 +284,14 @@
struct mailbox *dest)
{
replication_notify(mailbox_get_namespace(dest),
- REPLICATION_PRIORITY_LOW);
+ REPLICATION_PRIORITY_LOW, "mailbox rename");
}
static void replication_mailbox_set_subscribed(struct mailbox *box,
bool subscribed ATTR_UNUSED)
{
replication_notify(mailbox_get_namespace(box),
- REPLICATION_PRIORITY_LOW);
+ REPLICATION_PRIORITY_LOW, "mailbox subscribe");
}
static void replication_user_deinit(struct mail_user *user)
@@ -311,12 +317,17 @@
const char *value;
value = mail_user_plugin_getenv(user, "mail_replica");
- if (value == NULL || value[0] == '\0')
+ if (value == NULL || value[0] == '\0') {
+ if (user->mail_debug)
+ i_debug("replication: No mail_replica setting - replication disabled");
return;
+ }
if (user->dsyncing) {
/* we're running dsync, which means that the remote is telling
us about a change. don't trigger a replication back to it */
+ if (user->mail_debug)
+ i_debug("replication: We're running dsync - replication disabled");
return;
}
More information about the dovecot-cvs
mailing list