From: Timo Sirainen Date: Fri, 5 Nov 2010 18:58:56 +0000 (+0000) Subject: lib-index: Fix to transaction log read optimization. X-Git-Tag: 2.0.7~6 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f34227d18c5458c5a8bfe576ecf8d7bb4e75162e;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Fix to transaction log read optimization. The log wasn't always refreshed while locked when it should have. --- diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 1196a08c92..823812a983 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -1564,9 +1564,6 @@ int mail_transaction_log_file_map(struct mail_transaction_log_file *file, end_offset = file->sync_offset; } - if (file->locked) - file->locked_sync_offset_updated = TRUE; - if (file->buffer != NULL && file->buffer_offset <= start_offset) { /* see if we already have it */ size = buffer_get_used_size(file->buffer); @@ -1574,6 +1571,12 @@ int mail_transaction_log_file_map(struct mail_transaction_log_file *file, return 1; } + if (file->locked) { + /* set this only when we've synced to end of file while locked + (either end_offset=(uoff_t)-1 or we had to read anyway) */ + file->locked_sync_offset_updated = TRUE; + } + if (MAIL_TRANSACTION_LOG_FILE_IN_MEMORY(file)) { if (start_offset < file->buffer_offset) { /* we had moved the log to memory but failed to read