]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
index: Pass index sync flags to index view sync for pvt
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 2 Jul 2019 16:33:59 +0000 (19:33 +0300)
committerVille Savolainen <ville.savolainen@dovecot.fi>
Tue, 24 Sep 2019 08:11:56 +0000 (11:11 +0300)
When recovering from inconsistent view, this needs to
passed for pvt indexes too. Fixes

Error: dovecot.index.pvt reset, view is now inconsistent

src/lib-storage/index/index-sync-private.h
src/lib-storage/index/index-sync-pvt.c
src/lib-storage/index/index-sync.c
src/lib-storage/index/index-transaction.c

index 1aefd9b98ab5f626fd6d7e9827be9de2309e50fb..7d670c4ee91eebee816b9d5ca3ab0890821939df 100644 (file)
@@ -26,6 +26,7 @@ void index_sync_search_results_expunge(struct index_mailbox_sync_context *ctx);
 
 /* Returns 1 = ok, 0 = no private indexes, -1 = error */
 int index_mailbox_sync_pvt_init(struct mailbox *box, bool lock,
+                               enum mail_index_view_sync_flags flags,
                                struct index_mailbox_sync_pvt_context **ctx_r);
 int index_mailbox_sync_pvt_newmails(struct index_mailbox_sync_pvt_context *ctx,
                                    struct mailbox_transaction_context *trans);
index 1eacf1241dddc79bccd6497276231f1cd00f9d0b..df50d03f27dd9f00c1bf8a4712afb5aade155c54 100644 (file)
@@ -11,6 +11,8 @@ struct index_mailbox_sync_pvt_context {
        struct mail_index_view *view_pvt;
        struct mail_index_transaction *trans_pvt;
        struct mail_index_view *view_shared;
+
+       enum mail_index_view_sync_flags flags;
 };
 
 static int sync_pvt_expunges(struct index_mailbox_sync_pvt_context *ctx)
@@ -123,6 +125,7 @@ index_mailbox_sync_open(struct index_mailbox_sync_pvt_context *ctx, bool force)
 }
 
 int index_mailbox_sync_pvt_init(struct mailbox *box, bool lock,
+                               enum mail_index_view_sync_flags flags,
                                struct index_mailbox_sync_pvt_context **ctx_r)
 {
        struct index_mailbox_sync_pvt_context *ctx;
@@ -135,6 +138,7 @@ int index_mailbox_sync_pvt_init(struct mailbox *box, bool lock,
 
        ctx = i_new(struct index_mailbox_sync_pvt_context, 1);
        ctx->box = box;
+       ctx->flags = flags;
        if (lock) {
                if (index_mailbox_sync_open(ctx, TRUE) < 0) {
                        index_mailbox_sync_pvt_deinit(&ctx);
@@ -300,7 +304,7 @@ int index_mailbox_sync_pvt_view(struct index_mailbox_sync_pvt_context *ctx,
                return -1;
 
        /* sync the private view */
-       view_sync_ctx = mail_index_view_sync_begin(ctx->box->view_pvt, 0);
+       view_sync_ctx = mail_index_view_sync_begin(ctx->box->view_pvt, ctx->flags);
        while (mail_index_view_sync_next(view_sync_ctx, &sync_rec)) {
                if (sync_rec.type != MAIL_INDEX_VIEW_SYNC_TYPE_FLAGS)
                        continue;
index 1c2da95a78735fd6f795eb8dc99880cbcb587a44..16707d24cf0bb8e618a415ae554b3afe65bf5a6d 100644 (file)
@@ -144,7 +144,7 @@ index_mailbox_sync_init(struct mailbox *box, enum mailbox_sync_flags flags,
           doesn't matter if it's called at _sync_init() or _sync_deinit().
           however we also need to know if any private flags have changed
           since last sync, so we need to call it before _sync_next() calls. */
-       if (index_mailbox_sync_pvt_init(box, FALSE, &pvt_ctx) > 0) {
+       if (index_mailbox_sync_pvt_init(box, FALSE, sync_flags, &pvt_ctx) > 0) {
                (void)index_mailbox_sync_pvt_view(pvt_ctx, &ctx->flag_updates,
                                                  &ctx->hidden_updates);
                index_mailbox_sync_pvt_deinit(&pvt_ctx);
index 85c94a92f7ff01df22be7281bd823c9358af7986..017f387ce99f89ab12147ccc25048ed6f38da965 100644 (file)
@@ -60,7 +60,7 @@ index_transaction_index_commit(struct mail_index_transaction *index_trans,
        }
 
        if (array_is_created(&t->pvt_saves)) {
-               if (index_mailbox_sync_pvt_init(t->box, TRUE, &pvt_sync_ctx) < 0)
+               if (index_mailbox_sync_pvt_init(t->box, TRUE, 0, &pvt_sync_ctx) < 0)
                        ret = -1;
        }