changeset 22812:ae87a7535b2a

fts: Don't reindex FTS mails if .cache file is deleted 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.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 05 Feb 2018 22:21:13 +0200
parents d880c3334a2f
children 4fe2e5822180
files src/plugins/fts/fts-storage.c
diffstat 1 files changed, 4 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/fts/fts-storage.c	Wed Feb 07 15:28:45 2018 +0200
+++ b/src/plugins/fts/fts-storage.c	Mon Feb 05 22:21:13 2018 +0200
@@ -105,9 +105,10 @@
 		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;
 }