dovecot-2.2: dsync: Fixed retrying a search when GUIDs aren't av...

dovecot at dovecot.org dovecot at dovecot.org
Wed Mar 20 20:57:09 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/3d5a065e18bb
changeset: 16069:3d5a065e18bb
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Mar 20 20:47:46 2013 +0200
description:
dsync: Fixed retrying a search when GUIDs aren't available.

diffstat:

 src/doveadm/dsync/dsync-mailbox-export.c |  11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diffs (48 lines):

diff -r 1a5a0b7cf37a -r 3d5a065e18bb src/doveadm/dsync/dsync-mailbox-export.c
--- a/src/doveadm/dsync/dsync-mailbox-export.c	Wed Mar 20 20:47:14 2013 +0200
+++ b/src/doveadm/dsync/dsync-mailbox-export.c	Wed Mar 20 20:47:46 2013 +0200
@@ -30,7 +30,7 @@
 	/* GUID => instances */
 	HASH_TABLE(char *, struct dsync_mail_guid_instances *) export_guids;
 	ARRAY_TYPE(seq_range) requested_uids;
-	unsigned int requested_uid_search_idx;
+	ARRAY_TYPE(seq_range) search_uids;
 
 	ARRAY_TYPE(seq_range) expunged_seqs;
 	ARRAY_TYPE(const_string) expunged_guids;
@@ -462,6 +462,7 @@
 	exporter->mails_have_guids =
 		(flags & DSYNC_MAILBOX_EXPORTER_FLAG_MAILS_HAVE_GUIDS) != 0;
 	p_array_init(&exporter->requested_uids, pool, 16);
+	p_array_init(&exporter->search_uids, pool, 16);
 	hash_table_create(&exporter->export_guids, pool, 0, str_hash, strcmp);
 	p_array_init(&exporter->expunged_seqs, pool, 16);
 	p_array_init(&exporter->expunged_guids, pool, 16);
@@ -688,14 +689,16 @@
 
 	/* add requested UIDs */
 	range = array_get(&exporter->requested_uids, &count);
-	for (i = exporter->requested_uid_search_idx; i < count; i++) {
+	for (i = 0; i < count; i++) {
 		mailbox_get_seq_range(exporter->box,
 				      range->seq1, range->seq2,
 				      &seq1, &seq2);
 		seq_range_array_add_range(&sarg->value.seqset,
 					  seq1, seq2);
 	}
-	exporter->requested_uid_search_idx = count;
+	array_clear(&exporter->search_uids);
+	array_append_array(&exporter->search_uids, &exporter->requested_uids);
+	array_clear(&exporter->requested_uids);
 
 	exporter->search_ctx =
 		mailbox_search_init(exporter->trans, search_args, NULL,
@@ -744,7 +747,7 @@
 		return -1;
 	}
 
-	if (!seq_range_exists(&exporter->requested_uids, mail->uid))
+	if (!seq_range_exists(&exporter->search_uids, mail->uid))
 		exporter->dsync_mail.uid = 0;
 	else
 		exporter->dsync_mail.guid = "";


More information about the dovecot-cvs mailing list