]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
fts: Don't reindex FTS mails if .cache file is deleted
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 5 Feb 2018 20:21:13 +0000 (22:21 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 6 Feb 2018 09:11:14 +0000 (11:11 +0200)
This means that if fts is enabled, "doveadm index" no longer adds mails
to dovecot.index.cache if it's deleted. However, it was rarely used for
that purpose. More likely due to a corrupted cache file all the mails were
unnecessarily being opened and reindexed.

src/plugins/fts/fts-storage.c

index 4b68663097694fa59d012c6210ca73e403b9c22b..deda1678540675d4990ebbaf61140e40178fe9ff 100644 (file)
@@ -109,9 +109,10 @@ fts_mailbox_get_status(struct mailbox *box, enum mailbox_status_items items,
                if (fts_mailbox_get_last_cached_seq(box, &seq) < 0)
                        return -1;
 
-               /* use whichever is smaller */
-               if (status_r->last_cached_seq > seq)
-                       status_r->last_cached_seq = seq;
+               /* Always use the FTS's last_cached_seq. This is because we
+                  don't want to reindex all mails to FTS if .cache file is
+                  deleted. */
+               status_r->last_cached_seq = seq;
        }
        return 0;
 }