Skip to content

Commit

Permalink
fts: Don't reindex FTS mails if .cache file is deleted
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
sirainen committed Feb 6, 2018
1 parent f5e3576 commit f5a00a8
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/plugins/fts/fts-storage.c
Expand Up @@ -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;
}
Expand Down

0 comments on commit f5a00a8

Please sign in to comment.