]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Added mail_index_sync_no_warning() to prevent "long transaction lock"...
authorTimo Sirainen <tss@iki.fi>
Thu, 9 Oct 2014 15:27:14 +0000 (18:27 +0300)
committerTimo Sirainen <tss@iki.fi>
Thu, 9 Oct 2014 15:27:14 +0000 (18:27 +0300)
Use it with Maildir to prevent double-warning.

src/lib-index/mail-index-sync.c
src/lib-index/mail-index.h
src/lib-storage/index/maildir/maildir-sync-index.c

index 57aa1a1454f2f7742dcd22355a0737f1553491c2..57a24114ab4f26d5d9f543a57e07cef5c59bdb72 100644 (file)
@@ -24,6 +24,8 @@ struct mail_index_sync_ctx {
        ARRAY(struct mail_index_sync_list) sync_list;
        uint32_t next_uid;
        uint32_t last_tail_seq, last_tail_offset;
+
+       unsigned int no_warning:1;
 };
 
 static void mail_index_sync_add_expunge(struct mail_index_sync_ctx *ctx)
@@ -716,6 +718,11 @@ void mail_index_sync_reset(struct mail_index_sync_ctx *ctx)
                sync_list->idx = 0;
 }
 
+void mail_index_sync_no_warning(struct mail_index_sync_ctx *ctx)
+{
+       ctx->no_warning = TRUE;
+}
+
 static void mail_index_sync_end(struct mail_index_sync_ctx **_ctx)
 {
         struct mail_index_sync_ctx *ctx = *_ctx;
@@ -726,7 +733,7 @@ static void mail_index_sync_end(struct mail_index_sync_ctx **_ctx)
 
        ctx->index->syncing = FALSE;
        mail_transaction_log_sync_unlock(ctx->index->log,
-               "Mailbox was synchronized");
+               ctx->no_warning ? NULL : "Mailbox was synchronized");
 
        mail_index_view_close(&ctx->view);
        mail_index_transaction_rollback(&ctx->sync_trans);
index a279e543265bb7fd8f646804d8318a400172713f..5ebd39d99a59e64f9d756289c9f6a98ad817acdf 100644 (file)
@@ -377,6 +377,10 @@ void mail_index_sync_reset(struct mail_index_sync_ctx *ctx);
 /* Update result when refreshing index at the end of sync. */
 void mail_index_sync_set_commit_result(struct mail_index_sync_ctx *ctx,
                                       struct mail_index_transaction_commit_result *result);
+/* Don't log a warning even if syncing took over
+   MAIL_TRANSACTION_LOG_LOCK_WARN_SECS seconds. Usually this is called because
+   the caller itself already logged a warning about it. */
+void mail_index_sync_no_warning(struct mail_index_sync_ctx *ctx);
 /* Commit synchronization by writing all changes to mail index file. */
 int mail_index_sync_commit(struct mail_index_sync_ctx **ctx);
 /* Rollback synchronization - none of the changes listed by sync_next() are
index dc344929187ec4195e36af31ac55dad6c623c1b8..22070bf7b0862a3e40702f43420db8ac4dd04263 100644 (file)
@@ -316,6 +316,7 @@ static int maildir_sync_index_finish(struct maildir_index_sync_context *ctx,
                          mailbox_get_path(&ctx->mbox->box), time_diff,
                          ctx->new_msgs_count, ctx->flag_change_count,
                          ctx->expunge_count);
+               mail_index_sync_no_warning(ctx->sync_ctx);
        }
 
        if (ret < 0)