]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-storage: Replace mail_transaction_commit_changes.changed with changes_mask
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 8 Feb 2018 15:17:59 +0000 (17:17 +0200)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 13 Feb 2018 12:33:12 +0000 (14:33 +0200)
This allows better finding out what changed in the transaction.

src/lib-storage/index/index-transaction.c
src/lib-storage/list/mailbox-list-index-status.c
src/lib-storage/mail-storage.h
src/plugins/replication/replication-plugin.c

index f5a46c9e6e9261bcc0b43692731430c963644a96..85c94a92f7ff01df22be7281bd823c9358af7986 100644 (file)
@@ -56,8 +56,6 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
                } else if (t->box->v.transaction_save_commit_pre(t->save_ctx) < 0) {
                        t->save_ctx = NULL;
                        ret = -1;
-               } else {
-                       t->changes->changed = TRUE;
                }
        }
 
@@ -73,9 +71,8 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
                if (t->super.commit(index_trans, result_r) < 0) {
                        mailbox_set_index_error(t->box);
                        ret = -1;
-               } else if (result_r->commit_size > 0) {
-                       /* something was written to the transaction log */
-                       t->changes->changed = TRUE;
+               } else {
+                       t->changes->changes_mask = result_r->changes_mask;
                }
        }
 
index ee7f468509b127ff4ea79f4e402dcff7e658ce25..1a6655b1dd03d1261dc2f7ba8555c0dbe1373744 100644 (file)
@@ -792,7 +792,8 @@ index_list_transaction_commit(struct mailbox_transaction_context *t,
                return -1;
        t = NULL;
 
-       if (!changes_r->changed)
+       /* check all changes here, because e.g. vsize update is _OTHERS */
+       if (changes_r->changes_mask == 0)
                return 0;
 
        /* this transaction commit may have been done in error handling path
index e9d78ad0e823ba49717ff2274481b5da8c18f13c..f863993717a062826f0f00b1d0da1ecf346f3c3b 100644 (file)
@@ -343,8 +343,8 @@ struct mail_transaction_commit_changes {
        /* number of modseq changes that couldn't be changed as requested */
        unsigned int ignored_modseq_changes;
 
-       /* TRUE if anything actually changed with this commit */
-       bool changed;
+       /* Changes that occurred within this transaction */
+       enum mail_index_transaction_change changes_mask;
        /* User doesn't have read ACL for the mailbox, so don't show the
           uid_validity / saved_uids. */
        bool no_read_perm;
index d6f059c15fdcb4a7a56720aa8d3d7e958dec34b6..461cfeeda3b063a8604519a84852a406a0ff3d95 100644 (file)
@@ -262,7 +262,7 @@ replication_mail_transaction_commit(void *txn,
        enum replication_priority priority;
 
        if (ruser != NULL && !ctx->sync_trans &&
-           (ctx->new_messages || changes->changed)) {
+           (ctx->new_messages || changes->changes_mask != 0)) {
                priority = !ctx->new_messages ? REPLICATION_PRIORITY_LOW :
                        ruser->sync_secs == 0 ? REPLICATION_PRIORITY_HIGH :
                        REPLICATION_PRIORITY_SYNC;