]> 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:27:25 +0000 (17:27 -0500)
committerTimo Sirainen <tss@iki.fi>
Thu, 5 Mar 2009 22:27:25 +0000 (17:27 -0500)
--HG--
branch : HEAD

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

index 65f44831baa9792533e1b108d90dc6513d9f87fa..b63a0b8566b86389ede43b3ad676450ff8617871 100644 (file)
@@ -532,6 +532,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;