]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
indexes: Make sure we don't shrink log_file_tail_offset.
authorTimo Sirainen <tss@iki.fi>
Thu, 5 Mar 2009 22:29:37 +0000 (17:29 -0500)
committerTimo Sirainen <tss@iki.fi>
Thu, 5 Mar 2009 22:29:37 +0000 (17:29 -0500)
--HG--
branch : HEAD

src/lib-index/mail-transaction-log-append.c
src/lib-index/mail-transaction-log-file.c

index d4a000727a7769e2d0f35dec47963edc4d45b130..d7d39c016cf6105a0e34196f5543f6bead5c5f22 100644 (file)
@@ -537,6 +537,7 @@ static void log_append_sync_offset_if_needed(struct log_append_context *ctx)
 
        if (ctx->file->saved_tail_offset == offset)
                return;
+       i_assert(offset > ctx->file->saved_tail_offset);
 
        buf = buffer_create_static_hard(pool_datastack_create(),
                                        sizeof(*u) + sizeof(offset));
index 15e55d0f26138041b3081b4682e04b6145fdde3d..316fae4262c06efe006eb0f09de6d5d184585225 100644 (file)
@@ -147,6 +147,8 @@ mail_transaction_log_file_skip_to_head(struct mail_transaction_log_file *file)
        }
        file->saved_tail_offset = log->index->map->hdr.log_file_tail_offset;
        file->saved_tail_sync_offset = file->saved_tail_offset;
+       if (file->saved_tail_offset > file->max_tail_offset)
+               file->max_tail_offset = file->saved_tail_offset;
 }
 
 static void
@@ -775,7 +777,10 @@ log_file_track_mailbox_sync_offset_hdr(struct mail_transaction_log_file *file,
                                return 1;
                        }
                        mail_transaction_log_file_set_corrupted(file,
-                               "log_file_tail_offset shrank");
+                               "log_file_tail_offset update shrank it "
+                               "(%u vs %"PRIuUOFF_T", file_seq=%u)",
+                               sync_offset, file->saved_tail_offset,
+                               file->hdr.file_seq);
                        return -1;
                }
                file->saved_tail_offset = sync_offset;