]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
When committing with no changes, don't try to sync them later.
authorTimo Sirainen <tss@iki.fi>
Mon, 10 May 2004 21:09:15 +0000 (00:09 +0300)
committerTimo Sirainen <tss@iki.fi>
Mon, 10 May 2004 21:09:15 +0000 (00:09 +0300)
--HG--
branch : HEAD

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

index d7f90ec85d3a48d15a43a607f70bc433fa04ec24..ff8e08b619d16f58129e8f50ef389362416693aa 100644 (file)
@@ -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;
        }
 
index c6dea12306f8b41599449a13c108951ab1e233f5..3727f0d142f054392194150d5e9004bd0a22358e 100644 (file)
@@ -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);
index 535785df5ac9861c7cc2efad3ab819bda6a7a5bb..e9233f09fee50d7cab960cb65a8ab6972f104991 100644 (file)
@@ -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;
index 54fdc2e20d15e98bbaa20a8343542d524ccbedd0..e7124701867333b67dd0387bd6a78f3a9f450942 100644 (file)
@@ -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;
                }
index 0ef23a759eee58672ec97b4a3b08e6baee5d733d..879fd706211604ea05b5cf6966bce910470102aa 100644 (file)
@@ -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;
                }