changeset 14295:0c3cb8976e81

lib-storage: When searching with a sort program, don't prefetch any mails. The prefetching probably ends up being pointless.
author Timo Sirainen <tss@iki.fi>
date Mon, 05 Mar 2012 18:43:05 +0200
parents 8a47994cd509
children 721e127e107f
files src/lib-storage/index/index-search.c
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib-storage/index/index-search.c	Mon Mar 05 18:41:53 2012 +0200
+++ b/src/lib-storage/index/index-search.c	Mon Mar 05 18:43:05 2012 +0200
@@ -1501,6 +1501,14 @@
 		ret = search_more_with_mail(ctx, mail);
 		if (ret <= 0)
 			break;
+
+		if (ctx->mail_ctx.sort_program != NULL) {
+			/* don't prefetch when using a sort program,
+			   since the mails' access order will change */
+			i_assert(ctx->unused_mail_idx == 0);
+			*mail_r = mail;
+			return 1;
+		}
 		if (mail_prefetch(mail) && ctx->unused_mail_idx == 0) {
 			/* no prefetching done, return it immediately */
 			*mail_r = mail;