]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
Mailbox syncing: If syncing wrote to transaction log, update the tail offset to inclu...
authorTimo Sirainen <tss@iki.fi>
Fri, 20 Mar 2009 22:21:25 +0000 (18:21 -0400)
committerTimo Sirainen <tss@iki.fi>
Fri, 20 Mar 2009 22:21:25 +0000 (18:21 -0400)
--HG--
branch : HEAD

src/lib-index/mail-index-sync.c

index ab36b945835de23f45c773f5a77a0e42a4e9a1f8..1df834add06694be33cf34dce8aeb3760e93c2fa 100644 (file)
@@ -706,8 +706,15 @@ mail_index_sync_update_mailbox_offset(struct mail_index_sync_ctx *ctx)
        uint32_t seq;
        uoff_t offset;
 
-       mail_transaction_log_view_get_prev_pos(ctx->view->log_view,
-                                              &seq, &offset);
+       if (!mail_transaction_log_view_is_last(ctx->view->log_view)) {
+               /* didn't sync everything */
+               mail_transaction_log_view_get_prev_pos(ctx->view->log_view,
+                                                      &seq, &offset);
+       } else {
+               /* synced everything, but we might also have committed new
+                  transactions. include them also here. */
+               mail_transaction_log_get_head(ctx->index->log, &seq, &offset);
+       }
        mail_transaction_log_set_mailbox_sync_pos(ctx->index->log, seq, offset);
 
        /* If tail offset has changed, make sure it gets written to