dovecot-2.0-sslstream: mdbox: Removed forced automatic purging f...

dovecot at dovecot.org dovecot at dovecot.org
Sat Feb 13 03:00:22 EET 2010


details:   http://hg.dovecot.org/dovecot-2.0-sslstream/rev/2917f019b179
changeset: 10632:2917f019b179
user:      Timo Sirainen <tss at iki.fi>
date:      Tue Feb 02 22:19:35 2010 +0200
description:
mdbox: Removed forced automatic purging for now. It was too ineffecient.

diffstat:

4 files changed, 57 deletions(-)
src/lib-storage/index/dbox-multi/mdbox-map.c  |   42 -------------------------
src/lib-storage/index/dbox-multi/mdbox-map.h  |    2 -
src/lib-storage/index/dbox-multi/mdbox-sync.c |   11 ------
src/lib-storage/index/dbox-multi/mdbox-sync.h |    2 -

diffs (104 lines):

diff -r b0b63deab22a -r 2917f019b179 src/lib-storage/index/dbox-multi/mdbox-map.c
--- a/src/lib-storage/index/dbox-multi/mdbox-map.c	Tue Feb 02 19:03:06 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-map.c	Tue Feb 02 22:19:35 2010 +0200
@@ -333,48 +333,6 @@ static void dbox_map_filter_zero_refs(st
 
 	hash_table_destroy(&hash);
 	pool_unref(&pool);
-}
-
-bool dbox_map_want_purge(struct dbox_map *map)
-{
-	const struct mail_index_header *hdr;
-	const struct dbox_map_mail_index_record *rec;
-	const uint16_t *ref16_p;
-	const void *data;
-	uoff_t ref0_size, total_size;
-	bool expunged;
-	uint32_t seq;
-
-	if (map->set->mdbox_purge_min_percentage >= 100) {
-		/* we never purge anything */
-		return FALSE;
-	}
-
-	ref0_size = total_size = 0;
-	hdr = mail_index_get_header(map->view);
-	for (seq = 1; seq <= hdr->messages_count; seq++) {
-		mail_index_lookup_ext(map->view, seq, map->map_ext_id,
-				      &data, &expunged);
-		if (data == NULL || expunged)
-			continue;
-		rec = data;
-
-		mail_index_lookup_ext(map->view, seq, map->ref_ext_id,
-				      &data, &expunged);
-		if (data == NULL || expunged)
-			continue;
-		ref16_p = data;
-
-		if (*ref16_p == 0)
-			ref0_size += rec->size;
-		total_size += rec->size;
-	}
-
-	if (ref0_size < DBOX_FORCE_PURGE_MIN_BYTES)
-		return FALSE;
-	if ((float)ref0_size / (float)total_size < DBOX_FORCE_PURGE_MIN_RATIO)
-		return FALSE;
-	return TRUE;
 }
 
 const ARRAY_TYPE(seq_range) *dbox_map_get_zero_ref_files(struct dbox_map *map)
diff -r b0b63deab22a -r 2917f019b179 src/lib-storage/index/dbox-multi/mdbox-map.h
--- a/src/lib-storage/index/dbox-multi/mdbox-map.h	Tue Feb 02 19:03:06 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-map.h	Tue Feb 02 22:19:35 2010 +0200
@@ -55,8 +55,6 @@ int dbox_map_update_refcounts(struct dbo
 			      const ARRAY_TYPE(uint32_t) *map_uids, int diff);
 int dbox_map_remove_file_id(struct dbox_map *map, uint32_t file_id);
 
-/* Returns TRUE if there's enough pressure to purge immediately. */
-bool dbox_map_want_purge(struct dbox_map *map);
 /* Return all files containing messages with zero refcount. */
 const ARRAY_TYPE(seq_range) *dbox_map_get_zero_ref_files(struct dbox_map *map);
 
diff -r b0b63deab22a -r 2917f019b179 src/lib-storage/index/dbox-multi/mdbox-sync.c
--- a/src/lib-storage/index/dbox-multi/mdbox-sync.c	Tue Feb 02 19:03:06 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-sync.c	Tue Feb 02 22:19:35 2010 +0200
@@ -105,15 +105,6 @@ static int mdbox_sync_index_finish_expun
 {
 	struct dbox_map_transaction_context *map_trans;
 	int ret;
-
-	/* prevent a user from saving + expunging messages all the time and
-	   using lots of disk space. but avoid doing this in situations where
-	   a user simply expunges a lot of mail for the first time. that's why
-	   we do this calculation before sync, not after: the purging is
-	   triggered only after the second expunge. */
-	if ((ctx->flags & MDBOX_SYNC_FLAG_NO_PURGE) == 0 &&
-	    dbox_map_want_purge(ctx->mbox->storage->map))
-		ctx->purge = TRUE;
 
 	map_trans = dbox_map_transaction_begin(ctx->mbox->storage->map, FALSE);
 	ret = dbox_map_update_refcounts(map_trans, &ctx->expunged_map_uids, -1);
@@ -282,8 +273,6 @@ int mdbox_sync_finish(struct mdbox_sync_
 		mail_index_sync_rollback(&ctx->index_sync_ctx);
 	}
 
-	if (ctx->purge)
-		(void)mdbox_sync_purge(&ctx->mbox->storage->storage.storage);
 	i_free(ctx);
 	return ret;
 }
diff -r b0b63deab22a -r 2917f019b179 src/lib-storage/index/dbox-multi/mdbox-sync.h
--- a/src/lib-storage/index/dbox-multi/mdbox-sync.h	Tue Feb 02 19:03:06 2010 +0200
+++ b/src/lib-storage/index/dbox-multi/mdbox-sync.h	Tue Feb 02 22:19:35 2010 +0200
@@ -22,8 +22,6 @@ struct mdbox_sync_context {
 	/* list of expunged map_uids. the same map_uid may be listed more than
 	   once in case message has been copied multiple times to mailbox. */
 	ARRAY_TYPE(uint32_t) expunged_map_uids;
-
-	unsigned int purge:1;
 };
 
 int mdbox_sync_begin(struct mdbox_mailbox *mbox, enum mdbox_sync_flags flags,


More information about the dovecot-cvs mailing list