[dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-private.h, 1.56.2.1, 1.56.2.2 mbox-sync.c, 1.181.2.3, 1.181.2.4
tss at dovecot.org
tss at dovecot.org
Thu Oct 26 01:17:24 UTC 2006
- Previous message: [dovecot-cvs] dovecot/src/plugins/fts-lucene fts-backend-lucene.c, 1.3, 1.4 lucene-wrapper.cc, 1.5, 1.6 lucene-wrapper.h, 1.3, 1.4
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-private.h, 1.58, 1.59 mbox-sync.c, 1.187, 1.188
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/lib/cvs/dovecot/src/lib-storage/index/mbox
In directory talvi:/tmp/cvs-serv10389
Modified Files:
Tag: branch_1_0
mbox-sync-private.h mbox-sync.c
Log Message:
Last keyword pool clearing optimization broke the keywords if we had to move
mails around in the file.
Index: mbox-sync-private.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync-private.h,v
retrieving revision 1.56.2.1
retrieving revision 1.56.2.2
diff -u -d -r1.56.2.1 -r1.56.2.2
--- mbox-sync-private.h 15 Oct 2006 22:47:48 -0000 1.56.2.1
+++ mbox-sync-private.h 26 Oct 2006 00:17:22 -0000 1.56.2.2
@@ -115,7 +115,10 @@
array_t ARRAY_DEFINE(syncs, struct mail_index_sync_rec);
struct mail_index_sync_rec sync_rec;
+ /* per-mail pool */
pool_t mail_keyword_pool;
+ /* used for mails[].keywords */
+ pool_t saved_keywords_pool;
uint32_t prev_msg_uid, next_uid, idx_next_uid;
uint32_t seq, idx_seq, need_space_seq;
Index: mbox-sync.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib-storage/index/mbox/mbox-sync.c,v
retrieving revision 1.181.2.3
retrieving revision 1.181.2.4
diff -u -d -r1.181.2.3 -r1.181.2.4
--- mbox-sync.c 15 Oct 2006 22:47:48 -0000 1.181.2.3
+++ mbox-sync.c 26 Oct 2006 00:17:22 -0000 1.181.2.4
@@ -789,9 +789,17 @@
struct mbox_sync_context *sync_ctx = mail_ctx->sync_ctx;
uoff_t end_offset, move_diff, extra_space, needed_space;
uint32_t last_seq;
+ array_t ARRAY_DEFINE(keywords_copy, unsigned int);
i_assert(mail_ctx->mail.uid == 0 || mail_ctx->mail.space > 0 ||
mail_ctx->mail.offset == mail_ctx->hdr_offset);
+
+ /* mail's keywords are allocated from a pool that's cleared for each
+ mail. we'll need to copy it to something more permanent. */
+ ARRAY_CREATE(&keywords_copy, sync_ctx->saved_keywords_pool,
+ unsigned int, array_count(&mail_ctx->mail.keywords));
+ array_append_array(&keywords_copy, &mail_ctx->mail.keywords);
+ mail_ctx->mail.keywords = keywords_copy;
array_append(&sync_ctx->mails, &mail_ctx->mail, 1);
sync_ctx->space_diff += mail_ctx->mail.space;
@@ -854,6 +862,7 @@
sync_ctx->need_space_seq = 0;
sync_ctx->space_diff = 0;
array_clear(&sync_ctx->mails);
+ p_clear(sync_ctx->saved_keywords_pool);
return 0;
}
@@ -1292,6 +1301,7 @@
sync_ctx->need_space_seq = 0;
array_clear(&sync_ctx->mails);
+ p_clear(sync_ctx->saved_keywords_pool);
}
if (sync_ctx->expunged_space > 0) {
@@ -1406,6 +1416,7 @@
array_clear(&sync_ctx->mails);
array_clear(&sync_ctx->syncs);
+ p_clear(sync_ctx->saved_keywords_pool);
memset(&sync_ctx->sync_rec, 0, sizeof(sync_ctx->sync_rec));
mail_index_sync_reset(sync_ctx->index_sync_ctx);
@@ -1541,6 +1552,7 @@
if (sync_ctx->index_sync_ctx != NULL)
mail_index_sync_rollback(&sync_ctx->index_sync_ctx);
pool_unref(sync_ctx->mail_keyword_pool);
+ pool_unref(sync_ctx->saved_keywords_pool);
str_free(&sync_ctx->header);
str_free(&sync_ctx->from_line);
array_free(&sync_ctx->mails);
@@ -1656,6 +1668,8 @@
sync_ctx.t = mail_index_transaction_begin(sync_view, FALSE, TRUE);
sync_ctx.mail_keyword_pool =
pool_alloconly_create("mbox keywords", 256);
+ sync_ctx.saved_keywords_pool =
+ pool_alloconly_create("mbox saved keywords", 4096);
/* make sure we've read the latest keywords in index */
(void)mail_index_get_keywords(mbox->ibox.index);
- Previous message: [dovecot-cvs] dovecot/src/plugins/fts-lucene fts-backend-lucene.c, 1.3, 1.4 lucene-wrapper.cc, 1.5, 1.6 lucene-wrapper.h, 1.3, 1.4
- Next message: [dovecot-cvs] dovecot/src/lib-storage/index/mbox mbox-sync-private.h, 1.58, 1.59 mbox-sync.c, 1.187, 1.188
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the dovecot-cvs
mailing list