]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm: dsync-transaction-log-scan - Replace i_<log>() with e_<log>()
authorMarco Bettini <marco.bettini@open-xchange.com>
Tue, 30 Aug 2022 14:37:34 +0000 (14:37 +0000)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Thu, 6 Oct 2022 18:01:26 +0000 (18:01 +0000)
src/doveadm/dsync/dsync-brain-mailbox.c
src/doveadm/dsync/dsync-transaction-log-scan.c
src/doveadm/dsync/dsync-transaction-log-scan.h

index c42fef7fcedd82c3dd623dd63459809339acc0d6..9c0d81b0334a42422771b1cdf453e40ba2f951f6 100644 (file)
@@ -264,12 +264,11 @@ int dsync_brain_sync_mailbox_open(struct dsync_brain *brain,
        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));
index dd2834ad5e24193e7a43b903a30853ee220c4eab..428d59c716f96ad736efe3d5f5b6d1fdeb80ba8b 100644 (file)
@@ -7,9 +7,11 @@
 #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;
@@ -391,7 +393,8 @@ dsync_log_set(struct dsync_transaction_log_scan *ctx,
                /* 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;
        }
@@ -498,13 +501,15 @@ dsync_mailbox_attribute_hash(const struct dsync_mailbox_attribute *attr)
        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;
@@ -515,6 +520,7 @@ int dsync_transaction_log_scan_init(struct mail_index_view *view,
                                     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,
@@ -604,5 +610,6 @@ void dsync_transaction_log_scan_deinit(struct dsync_transaction_log_scan **_scan
 
        hash_table_destroy(&scan->changes);
        hash_table_destroy(&scan->attr_changes);
+       event_unref(&scan->event);
        pool_unref(&scan->pool);
 }
index 458b7751944115be72cf77f6305c1355744ce2e2..2f0bfefcdf1cf886fb47039a15d24ade79b28558 100644 (file)
@@ -9,12 +9,11 @@ HASH_TABLE_DEFINE_TYPE(dsync_attr_change,
 
 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);