]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-index: Fix to transaction log read optimization.
authorTimo Sirainen <tss@iki.fi>
Fri, 5 Nov 2010 18:58:56 +0000 (18:58 +0000)
committerTimo Sirainen <tss@iki.fi>
Fri, 5 Nov 2010 18:58:56 +0000 (18:58 +0000)
The log wasn't always refreshed while locked when it should have.

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

index 1196a08c923a224dd00880e76c7e2db94217806d..823812a983ab4bfc26b4672d9a8a222238c6578b 100644 (file)
@@ -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