last_common_pvt_modseq = brain->mailbox_state.last_common_pvt_modseq;
highest_wanted_uid = last_common_uid == 0 ?
(uint32_t)-1 : last_common_uid;
- ret = dsync_transaction_log_scan_init(brain->box->view,
- brain->box->view_pvt,
+ ret = dsync_transaction_log_scan_init(brain,
highest_wanted_uid,
last_common_modseq,
last_common_pvt_modseq,
- &brain->log_scan, &pvt_too_old);
+ &pvt_too_old);
if (ret < 0) {
i_error("Failed to read transaction log for mailbox %s",
mailbox_get_vname(brain->box));
#include "dsync-mail.h"
#include "dsync-mailbox.h"
#include "dsync-transaction-log-scan.h"
+#include "dsync-brain-private.h"
struct dsync_transaction_log_scan {
pool_t pool;
+ struct event *event;
HASH_TABLE_TYPE(dsync_uid_mail_change) changes;
HASH_TABLE_TYPE(dsync_attr_change) attr_changes;
struct mail_index_view *view;
/* we shouldn't get here. _view_set_all() already
reserved all the log files, the _view_set() only
removed unwanted ones. */
- i_error("%s: Couldn't set transaction log view (seq %u..%u): %s",
+ e_error(ctx->event,
+ "%s: Couldn't set transaction log view (seq %u..%u): %s",
view->index->filepath, log_seq, end_seq, reason);
ret = -1;
}
return str_hash(attr->key) ^ attr->type;
}
-int dsync_transaction_log_scan_init(struct mail_index_view *view,
- struct mail_index_view *pvt_view,
+int dsync_transaction_log_scan_init(struct dsync_brain *brain,
uint32_t highest_wanted_uid,
uint64_t modseq, uint64_t pvt_modseq,
- struct dsync_transaction_log_scan **scan_r,
bool *pvt_too_old_r)
{
+ struct mail_index_view *view = brain->box->view;
+ struct mail_index_view *pvt_view = brain->box->view_pvt;
+ struct dsync_transaction_log_scan **scan_r = &brain->log_scan;
+
struct dsync_transaction_log_scan *ctx;
pool_t pool;
int ret, ret2;
10240);
ctx = p_new(pool, struct dsync_transaction_log_scan, 1);
ctx->pool = pool;
+ ctx->event = event_create(brain->event);
hash_table_create_direct(&ctx->changes, pool, 0);
hash_table_create(&ctx->attr_changes, pool, 0,
dsync_mailbox_attribute_hash,
hash_table_destroy(&scan->changes);
hash_table_destroy(&scan->attr_changes);
+ event_unref(&scan->event);
pool_unref(&scan->pool);
}
struct mail_index_view;
struct dsync_transaction_log_scan;
+struct dsync_brain;
-int dsync_transaction_log_scan_init(struct mail_index_view *view,
- struct mail_index_view *pvt_view,
+int dsync_transaction_log_scan_init(struct dsync_brain *brain,
uint32_t highest_wanted_uid,
uint64_t modseq, uint64_t pvt_modseq,
- struct dsync_transaction_log_scan **scan_r,
bool *pvt_too_old_r);
HASH_TABLE_TYPE(dsync_uid_mail_change)
dsync_transaction_log_scan_get_hash(struct dsync_transaction_log_scan *scan);