dovecot-1.2: Threading: Fixed fallbacking to in-memory hash if t...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Jun 26 19:12:17 EEST 2008
details: http://hg.dovecot.org/dovecot-1.2/rev/5e3b995372d4
changeset: 7951:5e3b995372d4
user: Timo Sirainen <tss at iki.fi>
date: Thu Jun 26 08:49:02 2008 +0300
description:
Threading: Fixed fallbacking to in-memory hash if the primary hash couldn't
be updated.
diffstat:
1 file changed, 21 insertions(+), 13 deletions(-)
src/lib-storage/index/index-thread.c | 34 +++++++++++++++++++++-------------
diffs (81 lines):
diff -r 3412c43d6707 -r 5e3b995372d4 src/lib-storage/index/index-thread.c
--- a/src/lib-storage/index/index-thread.c Tue Jun 24 16:49:36 2008 +0300
+++ b/src/lib-storage/index/index-thread.c Thu Jun 26 08:49:02 2008 +0300
@@ -41,6 +41,8 @@ struct mail_thread_mailbox {
static MODULE_CONTEXT_DEFINE_INIT(mail_thread_storage_module,
&mail_storage_module_register);
+
+static void mail_thread_clear(struct mail_thread_context *ctx);
bool mail_thread_type_parse(const char *str, enum mail_thread_type *type_r)
{
@@ -438,7 +440,7 @@ int mail_thread_init(struct mailbox *box
ctx->search_args = args;
while ((ret = mail_thread_update(ctx, reset)) < 0) {
- if (ctx->thread_ctx.hash == tbox->hash) {
+ if (ctx->thread_ctx.hash != tbox->hash) {
/* failed with in-memory hash */
mail_storage_set_critical(box->storage,
"Threading mailbox %s failed unexpectedly",
@@ -448,30 +450,24 @@ int mail_thread_init(struct mailbox *box
}
/* try again with in-memory hash */
- mail_thread_deinit(&ctx);
+ mail_thread_clear(ctx);
reset = TRUE;
memset(ctx, 0, sizeof(*ctx));
ctx->box = box;
+ ctx->search_args = args;
}
*ctx_r = ctx;
return 0;
}
-void mail_thread_deinit(struct mail_thread_context **_ctx)
-{
- struct mail_thread_context *ctx = *_ctx;
+static void mail_thread_clear(struct mail_thread_context *ctx)
+{
struct mail_thread_mailbox *tbox = MAIL_THREAD_CONTEXT(ctx->box);
- int ret;
-
- *_ctx = NULL;
-
- if (ctx->search_args->args == &ctx->tmp_search_arg)
- ctx->search_args->args = ctx->tmp_search_arg.next;
mail_hash_transaction_end(&ctx->thread_ctx.hash_trans);
- ret = mailbox_search_deinit(&ctx->search);
+ (void)mailbox_search_deinit(&ctx->search);
mail_free(&ctx->thread_ctx.tmp_mail);
(void)mailbox_transaction_commit(&ctx->t);
@@ -479,10 +475,22 @@ void mail_thread_deinit(struct mail_thre
if (ctx->thread_ctx.hash != tbox->hash)
mail_hash_free(&ctx->thread_ctx.hash);
+ if (ctx->search_args->args == &ctx->tmp_search_arg)
+ ctx->search_args->args = ctx->tmp_search_arg.next;
+
array_free(&ctx->thread_ctx.msgid_cache);
pool_unref(&ctx->thread_ctx.msgid_pool);
+}
+
+void mail_thread_deinit(struct mail_thread_context **_ctx)
+{
+ struct mail_thread_context *ctx = *_ctx;
+ struct mail_thread_mailbox *tbox = MAIL_THREAD_CONTEXT(ctx->box);
+
+ *_ctx = NULL;
+
+ mail_thread_clear(ctx);
mail_search_args_unref(&ctx->search_args);
-
i_assert(!tbox->ctx->syncing);
tbox->ctx = NULL;
i_free(ctx);
More information about the dovecot-cvs
mailing list