# HG changeset patch # User Timo Sirainen # Date 1503663126 -10800 # Node ID d4274c2f8468a0e86faad57b291f243774b3bebf # Parent df0a2f4282f87069fd63085b0a312d95c939c283 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). diff -r df0a2f4282f8 -r d4274c2f8468 src/lib-index/mail-transaction-log.c --- 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)) {