changeset 22892:11d9851aa504

imapc: Don't try to add mails to index if they already exist there Broken by 259a4ca5943123915a019799623d2e4a4ef7fd15 when imapc was used with (not in-memory) index files. This caused errors like "Append with UID 200, but next_uid = 201"
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Mon, 12 Mar 2018 15:06:13 +0200
parents 9273be33529b
children f03ca15a9bf1
files src/lib-storage/index/imapc/imapc-mailbox.c
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/imapc/imapc-mailbox.c	Mon Mar 05 14:55:04 2018 +0200
+++ b/src/lib-storage/index/imapc/imapc-mailbox.c	Mon Mar 12 15:06:13 2018 +0200
@@ -401,7 +401,8 @@
 	} else {
 		/* newly seen message */
 		imapc_msgmap_append(msgmap, rseq, uid);
-		if (uid < mbox->min_append_uid) {
+		if (uid < mbox->min_append_uid ||
+		    uid < mail_index_get_header(mbox->delayed_sync_view)->next_uid) {
 			/* message is already added to index */
 		} else {
 			mail_index_append(mbox->delayed_sync_trans,