changeset 8676:b45d3705f7d5 HEAD

dbox rebuild: Dont try to give unknown maildir files UIDs that are after uidlist's nextuid. Although it might allow keeping the same UIDs after repeated rebuilds, if any of the files were deleted at some point the UIDs would change and that would be just worse.
author Timo Sirainen <tss@iki.fi>
date Thu, 22 Jan 2009 02:42:35 +0200
parents 3be909959c02
children 61dd475e9f0a
files src/lib-storage/index/dbox/dbox-sync-rebuild.c
diffstat 1 files changed, 1 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/dbox/dbox-sync-rebuild.c	Thu Jan 22 02:39:52 2009 +0200
+++ b/src/lib-storage/index/dbox/dbox-sync-rebuild.c	Thu Jan 22 02:42:35 2009 +0200
@@ -339,30 +339,15 @@
 static int dbox_sync_new_maildir(struct dbox_sync_rebuild_context *ctx)
 {
 	struct mail_index_view *trans_view;
-	const struct mail_index_header *hdr;
 	char *const *fnames;
 	unsigned int i, count;
-	uint32_t next_uid, seq;
 	int ret = 0;
 
 	fnames = array_get(&ctx->maildir_new_files, &count);
 	if (count == 0)
 		return 0;
 
-	/* try to give them UIDs beginning from uidlist's next_uid */
-	next_uid = maildir_uidlist_get_next_uid(ctx->maildir_uidlist);
-	trans_view = mail_index_transaction_open_updated_view(ctx->trans);
-	for (i = 0; i < count; i++) {
-		if (mail_index_lookup_seq(trans_view, next_uid, &seq))
-			break;
-	}
-
-	if (i == count)
-		ctx->maildir_new_uid = next_uid;
-	else {
-		hdr = mail_index_get_header(trans_view);
-		ctx->maildir_new_uid = hdr->next_uid;
-	}
+	ctx->maildir_new_uid = mail_index_get_header(trans_view)->next_uid;
 	mail_index_view_close(&trans_view);
 
 	for (i = 0; i < count && ret == 0; i++) {