[dovecot-cvs] dovecot/src/lib-storage/index/maildir maildir-save.c, 1.43, 1.44 maildir-sync.c, 1.43, 1.44

cras at dovecot.org cras at dovecot.org
Fri Nov 12 00:01:47 EET 2004


Update of /var/lib/cvs/dovecot/src/lib-storage/index/maildir
In directory talvi:/tmp/cvs-serv13498/lib-storage/index/maildir

Modified Files:
	maildir-save.c maildir-sync.c 
Log Message:
Allow specifying to transaction if it's external. Make mail saving
transactions external to avoid problems with uids.



Index: maildir-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-save.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- maildir-save.c	25 Oct 2004 17:12:51 -0000	1.43
+++ maildir-save.c	11 Nov 2004 22:01:45 -0000	1.44
@@ -92,7 +92,7 @@
 	ctx->ctx.box = &ibox->box;
 	ctx->pool = pool;
 	ctx->ibox = ibox;
-	ctx->trans = t->ictx.trans;
+	ctx->trans = mail_index_transaction_begin(ibox->view, FALSE, TRUE);
 
 	index_mail_init(&t->ictx, &ctx->mail, 0, NULL);
 
@@ -313,6 +313,8 @@
 	uint32_t first_uid, last_uid;
 	enum maildir_uidlist_rec_flag flags;
 	const char *fname;
+	uint32_t seq;
+	uoff_t offset;
 	int ret = 0;
 
 	i_assert(ctx->output == NULL);
@@ -354,6 +356,9 @@
 			return -1;
 		}
 	}
+
+	if (mail_index_transaction_commit(ctx->trans, &seq, &offset) < 0)
+		ret = -1;
 	return ret;
 
 }
@@ -385,6 +390,7 @@
 	}
 	t_pop();
 
+	mail_index_transaction_rollback(ctx->trans);
 	index_mail_deinit(&ctx->mail);
 	pool_unref(ctx->pool);
 }

Index: maildir-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/maildir/maildir-sync.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -d -r1.43 -r1.44
--- maildir-sync.c	25 Oct 2004 17:12:51 -0000	1.43
+++ maildir-sync.c	11 Nov 2004 22:01:45 -0000	1.44
@@ -340,7 +340,7 @@
 				    ibox->commit_log_file_seq,
 				    ibox->commit_log_file_offset, FALSE, FALSE);
 	if (ret > 0) {
-		ctx.trans = mail_index_transaction_begin(ctx.view, FALSE);
+		ctx.trans = mail_index_transaction_begin(ctx.view, FALSE, TRUE);
 
 		while ((ret = mail_index_sync_next(ctx.sync_ctx,
 						   &ctx.sync_rec)) > 0) {
@@ -636,7 +636,7 @@
 		return -1;
 	}
 
-	trans = mail_index_transaction_begin(view, FALSE);
+	trans = mail_index_transaction_begin(view, FALSE, TRUE);
 	sync_ctx->trans = trans;
 
 	seq = 0;



More information about the dovecot-cvs mailing list