[dovecot-cvs] dovecot/src/lib-index mail-cache-sync-update.c, 1.9, 1.10 mail-cache.c, 1.80, 1.81 mail-index-private.h, 1.69, 1.70 mail-index-sync-update.c, 1.97, 1.98 mail-index-sync.c, 1.73, 1.74 mail-index.c, 1.231, 1.232

cras at dovecot.org cras at dovecot.org
Tue May 30 11:36:24 EEST 2006


Update of /var/lib/cvs/dovecot/src/lib-index
In directory talvi:/tmp/cvs-serv21972

Modified Files:
	mail-cache-sync-update.c mail-cache.c mail-index-private.h 
	mail-index-sync-update.c mail-index-sync.c mail-index.c 
Log Message:
We were updating index->map also when syncing views.



Index: mail-cache-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache-sync-update.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- mail-cache-sync-update.c	30 Sep 2005 18:46:30 -0000	1.9
+++ mail-cache-sync-update.c	30 May 2006 08:36:11 -0000	1.10
@@ -124,7 +124,7 @@
 	}
 
 	if (*old_cache_offset == 0 ||
-	    sync_ctx->type != MAIL_INDEX_SYNC_HANDLER_INDEX)
+	    sync_ctx->type != MAIL_INDEX_SYNC_HANDLER_FILE)
 		return 1;
 
 	/* we'll need to link the old and new cache records */

Index: mail-cache.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-cache.c,v
retrieving revision 1.80
retrieving revision 1.81
diff -u -d -r1.80 -r1.81
--- mail-cache.c	3 May 2006 20:07:13 -0000	1.80
+++ mail-cache.c	30 May 2006 08:36:11 -0000	1.81
@@ -304,7 +304,8 @@
 					    mail_cache_expunge_handler);
 	mail_index_register_sync_handler(index, cache->ext_id,
 					 mail_cache_sync_handler,
-                                         MAIL_INDEX_SYNC_HANDLER_INDEX |
+                                         MAIL_INDEX_SYNC_HANDLER_FILE |
+                                         MAIL_INDEX_SYNC_HANDLER_HEAD |
 					 (cache->file_cache == NULL ? 0 :
 					  MAIL_INDEX_SYNC_HANDLER_VIEW));
 

Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- mail-index-private.h	2 May 2006 22:06:32 -0000	1.69
+++ mail-index-private.h	30 May 2006 08:36:11 -0000	1.70
@@ -76,8 +76,9 @@
 };
 
 enum mail_index_sync_handler_type {
-	MAIL_INDEX_SYNC_HANDLER_INDEX	= 0x01,
-	MAIL_INDEX_SYNC_HANDLER_VIEW	= 0x02
+	MAIL_INDEX_SYNC_HANDLER_FILE	= 0x01,
+	MAIL_INDEX_SYNC_HANDLER_HEAD	= 0x02,
+	MAIL_INDEX_SYNC_HANDLER_VIEW	= 0x04
 };
 
 struct mail_index_sync_handler {

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.97
retrieving revision 1.98
diff -u -d -r1.97 -r1.98
--- mail-index-sync-update.c	30 May 2006 08:31:20 -0000	1.97
+++ mail-index-sync-update.c	30 May 2006 08:36:11 -0000	1.98
@@ -23,13 +23,17 @@
 	mail_index_unmap(view->index, &view->map);
 	view->map = map;
 	view->map->refcount++;
-	mail_index_unmap(view->index, &view->index->map);
-	view->index->map = map;
-	view->index->hdr = &map->hdr;
 
-	if (ctx->type == MAIL_INDEX_SYNC_HANDLER_INDEX) {
-		map->write_to_disk = TRUE;
-		map->write_atomic = TRUE;
+	if ((ctx->type & (MAIL_INDEX_SYNC_HANDLER_FILE |
+			  MAIL_INDEX_SYNC_HANDLER_HEAD)) != 0) {
+		mail_index_unmap(view->index, &view->index->map);
+		view->index->map = map;
+		view->index->hdr = &map->hdr;
+
+		if (ctx->type == MAIL_INDEX_SYNC_HANDLER_FILE) {
+			map->write_to_disk = TRUE;
+			map->write_atomic = TRUE;
+		}
 	}
 
 	i_assert(view->hdr.messages_count == map->hdr.messages_count);
@@ -158,12 +162,12 @@
 	if (seq1 == 0)
 		return 1;
 
-	/* don't call expunge handlers if we're syncing view */
-	if (ctx->type != MAIL_INDEX_SYNC_HANDLER_VIEW &&
+	/* call expunge handlers only when syncing index file */
+	if (ctx->type == MAIL_INDEX_SYNC_HANDLER_FILE &&
 	    !ctx->expunge_handlers_set)
 		mail_index_sync_init_expunge_handlers(ctx);
 
-	if (ctx->type != MAIL_INDEX_SYNC_HANDLER_VIEW &&
+	if (ctx->type == MAIL_INDEX_SYNC_HANDLER_FILE &&
 	    array_is_created(&ctx->expunge_handlers)) {
 		expunge_handlers = array_get(&ctx->expunge_handlers,
 					     &expunge_handlers_count);
@@ -655,7 +659,7 @@
 	bool had_dirty, skipped, check_ext_offsets;
 
 	mail_index_sync_map_init(&sync_map_ctx, view,
-				 MAIL_INDEX_SYNC_HANDLER_INDEX);
+				 MAIL_INDEX_SYNC_HANDLER_FILE);
 
 	/* we'll have to update view->lock_id to avoid mail_index_view_lock()
 	   trying to update the file later. */

Index: mail-index-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -d -r1.73 -r1.74
--- mail-index-sync.c	30 May 2006 08:31:20 -0000	1.73
+++ mail-index-sync.c	30 May 2006 08:36:11 -0000	1.74
@@ -745,7 +745,7 @@
 	va_start(va, fmt);
 	t_push();
 	error = t_strdup_vprintf(fmt, va);
-	if (ctx->type == MAIL_INDEX_SYNC_HANDLER_INDEX) {
+	if (ctx->type == MAIL_INDEX_SYNC_HANDLER_FILE) {
 		mail_transaction_log_view_set_corrupted(ctx->view->log_view,
 							"%s", error);
 	} else {

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.231
retrieving revision 1.232
diff -u -d -r1.231 -r1.232
--- mail-index.c	30 May 2006 08:26:48 -0000	1.231
+++ mail-index.c	30 May 2006 08:36:12 -0000	1.232
@@ -863,7 +863,7 @@
 
 	view = mail_index_view_open(index);
 	mail_index_sync_map_init(&sync_map_ctx, view,
-				 MAIL_INDEX_SYNC_HANDLER_VIEW);
+				 MAIL_INDEX_SYNC_HANDLER_HEAD);
 
 	check_ext_offsets = TRUE; broken = FALSE;
 	while ((ret = mail_transaction_log_view_next(log_view, &thdr, &tdata,



More information about the dovecot-cvs mailing list