From: Timo Sirainen Date: Thu, 8 Feb 2018 15:19:24 +0000 (+0200) Subject: replication: Don't trigger replication on changes not visible to dsync X-Git-Tag: 2.3.1~203 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6e2ea69b4634425229bd5e375848b7fa48357194;p=thirdparty%2Fdovecot%2Fcore.git replication: Don't trigger replication on changes not visible to dsync For example if there's a write to .cache file, it doesn't require replication. --- diff --git a/src/plugins/replication/replication-plugin.c b/src/plugins/replication/replication-plugin.c index 461cfeeda3..1fa883cf8d 100644 --- a/src/plugins/replication/replication-plugin.c +++ b/src/plugins/replication/replication-plugin.c @@ -251,6 +251,15 @@ static void replication_mail_copy(void *txn, struct mail *src, } } +static bool +replication_want_sync_changes(const struct mail_transaction_commit_changes *changes) +{ + /* Replication needs to be triggered on all the user-visible changes, + but not e.g. due to writes to cache file. */ + return (changes->changes_mask & + ~MAIL_INDEX_TRANSACTION_CHANGE_OTHERS) != 0; +} + static void replication_mail_transaction_commit(void *txn, struct mail_transaction_commit_changes *changes) @@ -262,7 +271,7 @@ replication_mail_transaction_commit(void *txn, enum replication_priority priority; if (ruser != NULL && !ctx->sync_trans && - (ctx->new_messages || changes->changes_mask != 0)) { + (ctx->new_messages || replication_want_sync_changes(changes))) { priority = !ctx->new_messages ? REPLICATION_PRIORITY_LOW : ruser->sync_secs == 0 ? REPLICATION_PRIORITY_HIGH : REPLICATION_PRIORITY_SYNC;