[dovecot-cvs] dovecot/src/lib-index mail-index-private.h, 1.69.2.4, 1.69.2.5 mail-index-sync-keywords.c, 1.9.2.2, 1.9.2.3 mail-index-sync-private.h, 1.29.2.1, 1.29.2.2 mail-index-sync-update.c, 1.96.2.7, 1.96.2.8 mail-index.c, 1.230.2.14, 1.230.2.15

tss at dovecot.org tss at dovecot.org
Wed Jan 17 23:33:29 UTC 2007


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

Modified Files:
      Tag: branch_1_0
	mail-index-private.h mail-index-sync-keywords.c 
	mail-index-sync-private.h mail-index-sync-update.c 
	mail-index.c 
Log Message:
Keywords were sometimes being re-added to the index even while they already
existed, causing the record size to bloat.



Index: mail-index-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-private.h,v
retrieving revision 1.69.2.4
retrieving revision 1.69.2.5
diff -u -d -r1.69.2.4 -r1.69.2.5
--- mail-index-private.h	16 Jan 2007 15:07:39 -0000	1.69.2.4
+++ mail-index-private.h	17 Jan 2007 23:33:26 -0000	1.69.2.5
@@ -122,6 +122,7 @@
 	   be rewritten. */
 	uint32_t write_seq_first, write_seq_last;
 
+	unsigned int keywords_read:1;
 	unsigned int write_to_disk:1;
 	unsigned int write_atomic:1; /* copy to new file and rename() */
 };

Index: mail-index-sync-keywords.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-keywords.c,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -d -r1.9.2.2 -r1.9.2.3
--- mail-index-sync-keywords.c	23 Jul 2006 21:41:37 -0000	1.9.2.2
+++ mail-index-sync-keywords.c	17 Jan 2007 23:33:26 -0000	1.9.2.3
@@ -15,10 +15,9 @@
 	const unsigned int *idx_map;
 	unsigned int i, count, keyword_idx;
 
-	if (!ctx->keywords_read) {
+	if (!map->keywords_read) {
 		if (mail_index_map_parse_keywords(ctx->view->index, map) < 0)
 			return -1;
-		ctx->keywords_read = TRUE;
 	}
 	if (array_is_created(&map->keyword_idx_map) &&
 	    mail_index_keyword_lookup(ctx->view->index, keyword_name,
@@ -87,6 +86,7 @@
 		buffer_create_static_hard(pool_datastack_create(),
 					  sizeof(*u) + sizeof("keywords")-1);
 
+	i_assert(keywords_count <= 6);
 	u = buffer_append_space_unsafe(ext_intro_buf, sizeof(*u));
 	u->ext_id = ext_id;
 	u->reset_id = reset_id;
@@ -186,7 +186,7 @@
 	map->hdr_base = map->hdr_copy_buf->data;
 
 	*keyword_idx_r = keywords_count - 1;
-        ctx->keywords_read = FALSE;
+        map->keywords_read = FALSE;
 	return 1;
 }
 
@@ -299,11 +299,10 @@
 		return 1;
 	}
 
-	if (!ctx->keywords_read) {
+	if (!ctx->view->map->keywords_read) {
 		if (mail_index_map_parse_keywords(ctx->view->index,
                                                   ctx->view->map) < 0)
 			return -1;
-		ctx->keywords_read = TRUE;
 	}
 
 	while (uid+2 <= end) {

Index: mail-index-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-private.h,v
retrieving revision 1.29.2.1
retrieving revision 1.29.2.2
diff -u -d -r1.29.2.1 -r1.29.2.2
--- mail-index-sync-private.h	18 May 2006 10:08:55 -0000	1.29.2.1
+++ mail-index-sync-private.h	17 Jan 2007 23:33:26 -0000	1.29.2.2
@@ -51,7 +51,6 @@
 	unsigned int expunge_handlers_set:1;
 	unsigned int expunge_handlers_used:1;
 	unsigned int cur_ext_ignore:1;
-	unsigned int keywords_read:1;
 	unsigned int unreliable_flags:1;
 };
 

Index: mail-index-sync-update.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index-sync-update.c,v
retrieving revision 1.96.2.7
retrieving revision 1.96.2.8
diff -u -d -r1.96.2.7 -r1.96.2.8
--- mail-index-sync-update.c	16 Jan 2007 18:27:51 -0000	1.96.2.7
+++ mail-index-sync-update.c	17 Jan 2007 23:33:26 -0000	1.96.2.8
@@ -22,7 +22,7 @@
 	/* if map still exists after this, it's only in views. */
 	view->map->write_to_disk = FALSE;
 	/* keywords aren't parsed for the new map yet */
-	ctx->keywords_read = FALSE;
+	view->map->keywords_read = FALSE;
 
 	mail_index_unmap(view->index, &view->map);
 	view->map = map;
@@ -656,6 +656,9 @@
 	sync_map_ctx->cur_ext_id = (uint32_t)-1;
 	sync_map_ctx->type = type;
 
+	/* make sure we re-read it in case it has changed */
+	sync_map_ctx->view->map->keywords_read = FALSE;
+
 	mail_index_sync_init_handlers(sync_map_ctx);
 }
 

Index: mail-index.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-index/mail-index.c,v
retrieving revision 1.230.2.14
retrieving revision 1.230.2.15
diff -u -d -r1.230.2.14 -r1.230.2.15
--- mail-index.c	17 Jan 2007 16:17:38 -0000	1.230.2.14
+++ mail-index.c	17 Jan 2007 23:33:26 -0000	1.230.2.15
@@ -408,6 +408,8 @@
 	unsigned int i, name_area_end_offset, old_count;
 	uint32_t ext_id;
 
+	map->keywords_read = TRUE;
+
 	ext_id = mail_index_map_lookup_ext(map, "keywords");
 	if (ext_id == (uint32_t)-1) {
 		if (array_is_created(&map->keyword_idx_map))



More information about the dovecot-cvs mailing list