Mercurial > dovecot > core-2.2
changeset 22467:d4274c2f8468
lib-index: Avoid opening .log.2 file if .log was reset
After a reset there's no point in trying to read the older log files.
This avoids trying to open .log.2 at least for newly created mailboxes
when trying to lookup log file sequence 1 (since due to some bug/feature
the log files start from sequence 2).
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Fri, 25 Aug 2017 15:12:06 +0300 |
parents | df0a2f4282f8 |
children | 01f841c0febb |
files | src/lib-index/mail-transaction-log.c |
diffstat | 1 files changed, 7 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/src/lib-index/mail-transaction-log.c Thu Aug 24 10:01:02 2017 +0300 +++ b/src/lib-index/mail-transaction-log.c Fri Aug 25 15:12:06 2017 +0300 @@ -441,6 +441,13 @@ *file_r = file; return 1; } + if (file->hdr.file_seq > file_seq && + file->hdr.prev_file_seq == 0) { + /* Fail here mainly to avoid unnecessarily trying to + open .log.2 that most likely doesn't even exist. */ + *reason_r = "Log was reset after requested file_seq"; + return 0; + } } if (MAIL_INDEX_IS_IN_MEMORY(log->index)) {