changeset 4282:7e1acaa7e76b HEAD

When extension data is being reset, recreate the index file to make sure that other processes notice the reset_id change. Fixes cache file corruption complaints around the time it's being compressed.
author Timo Sirainen <tss@iki.fi>
date Tue, 30 May 2006 11:34:23 +0300
parents b0ebcefc1967
children 22b54c007b91
files src/lib-index/mail-index-sync-ext.c
diffstat 1 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-index/mail-index-sync-ext.c	Tue May 30 11:33:20 2006 +0300
+++ b/src/lib-index/mail-index-sync-ext.c	Tue May 30 11:34:23 2006 +0300
@@ -461,6 +461,13 @@
 	if (ctx->cur_ext_ignore)
 		return 1;
 
+	if (!map->write_to_disk || map->refcount != 1) {
+		/* a new index file will be created, so the old data won't be
+		   accidentally used by other processes. */
+		map = mail_index_map_clone(map, map->hdr.record_size);
+		mail_index_sync_replace_map(ctx, map);
+	}
+
 	ext = array_idx_modifyable(&map->extensions, ctx->cur_ext_id);
 	ext->reset_id = u->new_reset_id;