From: Timo Sirainen Date: Mon, 10 May 2004 21:09:15 +0000 (+0300) Subject: When committing with no changes, don't try to sync them later. X-Git-Tag: 1.1.alpha1~4097 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8a3d609fdd84f5938c82e8e7eeb84a24ab41b317;p=thirdparty%2Fdovecot%2Fcore.git When committing with no changes, don't try to sync them later. --HG-- branch : HEAD --- diff --git a/src/lib-index/mail-transaction-log.c b/src/lib-index/mail-transaction-log.c index d7f90ec85d..ff8e08b619 100644 --- a/src/lib-index/mail-transaction-log.c +++ b/src/lib-index/mail-transaction-log.c @@ -1104,8 +1104,8 @@ int mail_transaction_log_append(struct mail_index_transaction *t, if (t->updates == NULL && t->cache_updates == NULL && t->expunges == NULL && t->appends == NULL) { /* nothing to append */ - *log_file_seq_r = log->head->hdr.file_seq; - *log_file_offset_r = log->head->hdr.used_size; + *log_file_seq_r = 0; + *log_file_offset_r = 0; return 0; } diff --git a/src/lib-index/mail-transaction-log.h b/src/lib-index/mail-transaction-log.h index c6dea12306..3727f0d142 100644 --- a/src/lib-index/mail-transaction-log.h +++ b/src/lib-index/mail-transaction-log.h @@ -99,7 +99,8 @@ void mail_transaction_log_views_close(struct mail_transaction_log *log); /* Write data to transaction log. This is atomic operation. Sequences in updates[] and expunges[] are relative to given view, they're modified - to real ones. */ + to real ones. If nothing is written, log_file_seq_r and log_file_offset_r + will be set to 0. */ int mail_transaction_log_append(struct mail_index_transaction *t, uint32_t *log_file_seq_r, uoff_t *log_file_offset_r); diff --git a/src/lib-storage/index/index-transaction.c b/src/lib-storage/index/index-transaction.c index 535785df5a..e9233f09fe 100644 --- a/src/lib-storage/index/index-transaction.c +++ b/src/lib-storage/index/index-transaction.c @@ -27,8 +27,10 @@ int index_transaction_commit(struct mailbox_transaction_context *_t) if (ret < 0) mail_storage_set_index_error(t->ibox); - t->ibox->commit_log_file_seq = seq; - t->ibox->commit_log_file_offset = offset; + if (seq != 0) { + t->ibox->commit_log_file_seq = seq; + t->ibox->commit_log_file_offset = offset; + } index_transaction_free(t); return ret; diff --git a/src/lib-storage/index/maildir/maildir-sync.c b/src/lib-storage/index/maildir/maildir-sync.c index 54fdc2e20d..e712470186 100644 --- a/src/lib-storage/index/maildir/maildir-sync.c +++ b/src/lib-storage/index/maildir/maildir-sync.c @@ -628,7 +628,7 @@ static int maildir_sync_index(struct maildir_sync_context *ctx) if (mail_index_transaction_commit(trans, &seq, &offset) < 0) mail_storage_set_index_error(ibox); - else { + else if (seq != 0) { ibox->commit_log_file_seq = seq; ibox->commit_log_file_offset = offset; } diff --git a/src/lib-storage/index/mbox/mbox-sync.c b/src/lib-storage/index/mbox/mbox-sync.c index 0ef23a759e..879fd70621 100644 --- a/src/lib-storage/index/mbox/mbox-sync.c +++ b/src/lib-storage/index/mbox/mbox-sync.c @@ -381,7 +381,7 @@ static int mbox_sync_do(struct index_mailbox *ibox, else { if (mail_index_transaction_commit(t, &seq, &offset) < 0) ret = -1; - else { + else if (seq != 0) { ibox->commit_log_file_seq = seq; ibox->commit_log_file_offset = offset; }