From: Timo Sirainen Date: Mon, 23 Mar 2009 21:02:00 +0000 (-0400) Subject: dbox: Cleaning wasn't actually expunging records from map index. X-Git-Tag: 2.0.alpha1~1038^2~24 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1206d11ed8adecbecc2447c00baf21c9535f6614;p=thirdparty%2Fdovecot%2Fcore.git dbox: Cleaning wasn't actually expunging records from map index. --HG-- branch : HEAD --- diff --git a/src/lib-storage/index/dbox/dbox-map.c b/src/lib-storage/index/dbox/dbox-map.c index a3c88946f5..7a77d0c372 100644 --- a/src/lib-storage/index/dbox/dbox-map.c +++ b/src/lib-storage/index/dbox/dbox-map.c @@ -256,14 +256,18 @@ const ARRAY_TYPE(seq_range) *dbox_map_get_zero_ref_files(struct dbox_map *map) } struct dbox_map_transaction_context * -dbox_map_transaction_begin(struct dbox_map *map) +dbox_map_transaction_begin(struct dbox_map *map, bool external) { struct dbox_map_transaction_context *ctx; + enum mail_index_transaction_flags flags = + MAIL_INDEX_TRANSACTION_FLAG_FSYNC; + + if (external) + flags |= MAIL_INDEX_TRANSACTION_FLAG_EXTERNAL; ctx = i_new(struct dbox_map_transaction_context, 1); ctx->map = map; - ctx->trans = mail_index_transaction_begin(map->view, - MAIL_INDEX_TRANSACTION_FLAG_FSYNC); + ctx->trans = mail_index_transaction_begin(map->view, flags); return ctx; } @@ -380,7 +384,7 @@ int dbox_map_remove_file_id(struct dbox_map *map, uint32_t file_id) return -1; /* we need a per-file transaction, otherwise we can't refresh the map */ - map_trans = dbox_map_transaction_begin(map); + map_trans = dbox_map_transaction_begin(map, TRUE); hdr = mail_index_get_header(map->view); for (seq = 1; seq <= hdr->messages_count; seq++) { diff --git a/src/lib-storage/index/dbox/dbox-map.h b/src/lib-storage/index/dbox/dbox-map.h index 8147ac117e..1069f83548 100644 --- a/src/lib-storage/index/dbox/dbox-map.h +++ b/src/lib-storage/index/dbox/dbox-map.h @@ -43,7 +43,7 @@ int dbox_map_get_file_msgs(struct dbox_map *map, uint32_t file_id, ARRAY_TYPE(dbox_map_file_msg) *recs); struct dbox_map_transaction_context * -dbox_map_transaction_begin(struct dbox_map *map); +dbox_map_transaction_begin(struct dbox_map *map, bool external); int dbox_map_transaction_commit(struct dbox_map_transaction_context **ctx); void dbox_map_transaction_rollback(struct dbox_map_transaction_context **ctx); diff --git a/src/lib-storage/index/dbox/dbox-sync-file.c b/src/lib-storage/index/dbox/dbox-sync-file.c index 1857ee5f6d..b03d6b6936 100644 --- a/src/lib-storage/index/dbox/dbox-sync-file.c +++ b/src/lib-storage/index/dbox/dbox-sync-file.c @@ -310,7 +310,8 @@ int dbox_sync_file(struct dbox_sync_context *ctx, } else { if (ctx->map_trans == NULL) { ctx->map_trans = - dbox_map_transaction_begin(mbox->storage->map); + dbox_map_transaction_begin(mbox->storage->map, + FALSE); } if (dbox_map_update_refcounts(ctx->map_trans, &entry->expunge_map_uids, -1) < 0)