dovecot-2.2: lib-index: modseq -> {log file, offset} lookup ofte...

dovecot at dovecot.org dovecot at dovecot.org
Mon Jun 9 19:54:27 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/98195220a0f7
changeset: 17445:98195220a0f7
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Jun 09 22:53:16 2014 +0300
description:
lib-index: modseq -> {log file, offset} lookup often ignored dovecot.index.log.2
This caused the code to think that the modseq was too old and fall back into
slower sync.

So this change should fix the dsync "Modseq .. nom longer in transaction
log" warnings as well as improve IMAP QRESYNC efficiency.

diffstat:

 src/lib-index/mail-index-modseq.c |  19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)

diffs (30 lines):

diff -r ff8402fe378e -r 98195220a0f7 src/lib-index/mail-index-modseq.c
--- a/src/lib-index/mail-index-modseq.c	Mon Jun 09 18:15:51 2014 +0300
+++ b/src/lib-index/mail-index-modseq.c	Mon Jun 09 22:53:16 2014 +0300
@@ -691,9 +691,24 @@
 					   uint64_t modseq, uint32_t *log_seq_r,
 					   uoff_t *log_offset_r)
 {
-	struct mail_transaction_log_file *file, *prev_file = NULL;
+	struct mail_transaction_log *log = view->index->log;
+	struct mail_transaction_log_file *file, *prev_file;
+	int ret;
 
-	for (file = view->index->log->files; file != NULL; file = file->next) {
+	if (log->files == NULL) {
+		/* we shouldn't normally get here */
+		return FALSE;
+	}
+	while (modseq < log->files->hdr.initial_modseq) {
+		/* try to find the previous log file if it still exists */
+		ret = mail_transaction_log_find_file(log,
+			log->files->hdr.file_seq - 1, FALSE, &file);
+		if (ret <= 0)
+			return FALSE;
+	}
+
+	prev_file = NULL;
+	for (file = log->files; file != NULL; file = file->next) {
 		if (modseq < file->hdr.initial_modseq)
 			break;
 		prev_file = file;


More information about the dovecot-cvs mailing list