Mercurial > dovecot > core-2.2
changeset 2449:1543762353aa HEAD
Optimization for setting initial sync_offset from index.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Sun, 22 Aug 2004 13:05:07 +0300 |
parents | f1e4c99cbb2b |
children | ace62daa7abd |
files | src/lib-index/mail-transaction-log.c |
diffstat | 1 files changed, 9 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log.c Sun Aug 22 12:52:11 2004 +0300 +++ b/src/lib-index/mail-transaction-log.c Sun Aug 22 13:05:07 2004 +0300 @@ -477,6 +477,14 @@ return NULL; } + if (file->hdr.file_seq == log->index->map->log_file_seq && + log->index->map->log_file_offset != 0) { + /* we can get a valid log offset from index file. initialize + sync_offset from it so we don't have to read the whole log + file from beginning. */ + file->sync_offset = log->index->map->log_file_offset; + } + for (p = &log->tail; *p != NULL; p = &(*p)->next) { if ((*p)->hdr.file_seq >= file->hdr.file_seq) { /* log replaced with file having same sequence as @@ -1274,9 +1282,8 @@ } } - if (ret < 0) { + if (ret < 0) file->sync_offset = append_offset; - } *log_file_seq_r = file->hdr.file_seq; *log_file_offset_r = file->sync_offset;