[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-save.c, 1.65, 1.66 mbox-sync.c, 1.121, 1.122

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/mbox
In directory talvi:/tmp/cvs-serv13498/lib-storage/index/mbox

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



Index: mbox-save.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-save.c,v
retrieving revision 1.65
retrieving revision 1.66
diff -u -d -r1.65 -r1.66
--- mbox-save.c	6 Nov 2004 17:20:21 -0000	1.65
+++ mbox-save.c	11 Nov 2004 22:01:45 -0000	1.66
@@ -313,7 +313,8 @@
 		ctx = t->save_ctx = i_new(struct mbox_save_context, 1);
 		ctx->ctx.box = &ibox->box;
 		ctx->ibox = ibox;
-		ctx->trans = t->ictx.trans;
+		ctx->trans = mail_index_transaction_begin(ibox->view,
+							  FALSE, TRUE);
 		ctx->append_offset = (uoff_t)-1;
 		ctx->headers = str_new(default_pool, 512);
 		ctx->save_crlf = getenv("MAIL_SAVE_CRLF") != NULL;
@@ -520,6 +521,8 @@
 
 int mbox_transaction_save_commit(struct mbox_save_context *ctx)
 {
+	uint32_t seq;
+	uoff_t offset;
 	int ret = 0;
 
 	if (ctx->synced) {
@@ -535,6 +538,9 @@
 		}
 	}
 
+	if (mail_index_transaction_commit(ctx->trans, &seq, &offset) < 0)
+		ret = -1;
+
 	mbox_transaction_save_deinit(ctx);
 	return ret;
 }
@@ -555,5 +561,6 @@
 			mbox_set_syscall_error(ibox, "ftruncate()");
 	}
 
+	mail_index_transaction_rollback(ctx->trans);
 	mbox_transaction_save_deinit(ctx);
 }

Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.121
retrieving revision 1.122
diff -u -d -r1.121 -r1.122
--- mbox-sync.c	6 Nov 2004 17:20:21 -0000	1.121
+++ mbox-sync.c	11 Nov 2004 22:01:45 -0000	1.122
@@ -1158,7 +1158,7 @@
 
 		mail_index_transaction_rollback(sync_ctx->t);
 		sync_ctx->t = mail_index_transaction_begin(sync_ctx->sync_view,
-							   FALSE);
+							   FALSE, TRUE);
 
 		ret = mbox_sync_loop(sync_ctx, &mail_ctx, (uint32_t)-1, FALSE);
 		if (ret <= 0) {
@@ -1215,7 +1215,8 @@
 {
 	struct mbox_sync_mail_context mail_ctx;
 
-	sync_ctx->t = mail_index_transaction_begin(sync_ctx->sync_view, FALSE);
+	sync_ctx->t = mail_index_transaction_begin(sync_ctx->sync_view,
+						   FALSE, TRUE);
 	sync_ctx->update_base_uid_last = sync_ctx->next_uid-1;
 
 	mbox_sync_restart(sync_ctx);
@@ -1351,7 +1352,7 @@
 
 	sync_ctx.index_sync_ctx = index_sync_ctx;
 	sync_ctx.sync_view = sync_view;
-	sync_ctx.t = mail_index_transaction_begin(sync_view, FALSE);
+	sync_ctx.t = mail_index_transaction_begin(sync_view, FALSE, TRUE);
 
 	sync_ctx.mails = buffer_create_dynamic(default_pool, 4096);
 	sync_ctx.syncs = buffer_create_dynamic(default_pool, 256);



More information about the dovecot-cvs mailing list