Mercurial > dovecot > core-2.2
changeset 14254:3e9f91d8b2af
lib-storage: mail_transaction_commit_changes.changed=TRUE only when something actually changed.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Fri, 02 Mar 2012 14:36:13 +0200 |
parents | 91e035840dc6 |
children | d247d53f80b9 |
files | src/lib-storage/index/index-transaction.c src/lib-storage/index/maildir/maildir-mail.c src/lib-storage/mail-storage-private.h src/lib-storage/mail-storage.h |
diffstat | 4 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-storage/index/index-transaction.c Fri Mar 02 14:33:41 2012 +0200 +++ b/src/lib-storage/index/index-transaction.c Fri Mar 02 14:36:13 2012 +0200 @@ -21,10 +21,15 @@ MAIL_STORAGE_CONTEXT(index_trans); int ret = 0; + if (t->nontransactional_changes) + t->changes->changed = TRUE; + if (t->save_ctx != NULL) { if (t->box->v.transaction_save_commit_pre(t->save_ctx) < 0) { t->save_ctx = NULL; ret = -1; + } else { + t->changes->changed = TRUE; } } @@ -35,6 +40,9 @@ if (t->super.commit(index_trans, result_r) < 0) { mail_storage_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; } }
--- a/src/lib-storage/index/maildir/maildir-mail.c Fri Mar 02 14:33:41 2012 +0200 +++ b/src/lib-storage/index/maildir/maildir-mail.c Fri Mar 02 14:36:13 2012 +0200 @@ -593,6 +593,7 @@ uidl = ""; } + _mail->transaction->nontransactional_changes = TRUE; maildir_uidlist_set_ext(mbox->uidlist, _mail->uid, MAILDIR_UIDLIST_REC_EXT_POP3_UIDL, uidl); }
--- a/src/lib-storage/mail-storage-private.h Fri Mar 02 14:33:41 2012 +0200 +++ b/src/lib-storage/mail-storage-private.h Fri Mar 02 14:36:13 2012 +0200 @@ -395,6 +395,8 @@ struct mailbox_transaction_stats stats; /* Set to TRUE to update stats_* fields */ unsigned int stats_track:1; + /* We've done some non-transactional (e.g. dovecot-uidlist updates) */ + unsigned int nontransactional_changes:1; }; union mail_search_module_context {
--- a/src/lib-storage/mail-storage.h Fri Mar 02 14:33:41 2012 +0200 +++ b/src/lib-storage/mail-storage.h Fri Mar 02 14:36:13 2012 +0200 @@ -265,6 +265,9 @@ /* 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; }; struct mailbox_sync_rec {