Mercurial > dovecot > core-2.2
changeset 17928:193c82411d73
lib-index: Added mail_index_sync_no_warning() to prevent "long transaction lock" warnings.
Use it with Maildir to prevent double-warning.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 09 Oct 2014 18:27:14 +0300 |
parents | fce66ec2ac1c |
children | c36cfd735d60 |
files | src/lib-index/mail-index-sync.c src/lib-index/mail-index.h src/lib-storage/index/maildir/maildir-sync-index.c |
diffstat | 3 files changed, 13 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync.c Thu Oct 09 18:26:05 2014 +0300 +++ b/src/lib-index/mail-index-sync.c Thu Oct 09 18:27:14 2014 +0300 @@ -24,6 +24,8 @@ 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 @@ 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 @@ 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);
--- a/src/lib-index/mail-index.h Thu Oct 09 18:26:05 2014 +0300 +++ b/src/lib-index/mail-index.h Thu Oct 09 18:27:14 2014 +0300 @@ -377,6 +377,10 @@ /* 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
--- a/src/lib-storage/index/maildir/maildir-sync-index.c Thu Oct 09 18:26:05 2014 +0300 +++ b/src/lib-storage/index/maildir/maildir-sync-index.c Thu Oct 09 18:27:14 2014 +0300 @@ -316,6 +316,7 @@ 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)