From e4fb1de76ff8f377f3cb15077387de05f564be9c Mon Sep 17 00:00:00 2001 From: Markus Valentin Date: Tue, 15 Jun 2021 08:59:17 +0200 Subject: [PATCH] Revert "lib-storage: Always fix inconsistency when syncing private flags index" This reverts commit 986d9cbbecffd836d977b6ad956b04e3ca606677. This is reverted because storing flags on private indexes no longer send untagged replies. --- src/lib-storage/index/index-sync-private.h | 1 + src/lib-storage/index/index-sync-pvt.c | 13 ++++++------- src/lib-storage/index/index-sync.c | 2 +- src/lib-storage/index/index-transaction.c | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/lib-storage/index/index-sync-private.h b/src/lib-storage/index/index-sync-private.h index 1aefd9b98a..7d670c4ee9 100644 --- a/src/lib-storage/index/index-sync-private.h +++ b/src/lib-storage/index/index-sync-private.h @@ -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); diff --git a/src/lib-storage/index/index-sync-pvt.c b/src/lib-storage/index/index-sync-pvt.c index ef374be7c2..df50d03f27 100644 --- a/src/lib-storage/index/index-sync-pvt.c +++ b/src/lib-storage/index/index-sync-pvt.c @@ -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); @@ -299,13 +303,8 @@ int index_mailbox_sync_pvt_view(struct index_mailbox_sync_pvt_context *ctx, if (index_mailbox_sync_pvt_index(ctx, NULL, 0) < 0) return -1; - /* Sync the private view. The flags index can't be fully synced with - the main index at all times anyway, so don't even try. Just fully - sync it always and fix any found inconsistencies. This way we also - avoid any unnecessary "dovecot.index.pvt reset, view is now - inconsistent" errors. */ - view_sync_ctx = mail_index_view_sync_begin(ctx->box->view_pvt, - MAIL_INDEX_VIEW_SYNC_FLAG_FIX_INCONSISTENT); + /* sync the private view */ + 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; diff --git a/src/lib-storage/index/index-sync.c b/src/lib-storage/index/index-sync.c index 1c2da95a78..16707d24cf 100644 --- a/src/lib-storage/index/index-sync.c +++ b/src/lib-storage/index/index-sync.c @@ -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); diff --git a/src/lib-storage/index/index-transaction.c b/src/lib-storage/index/index-transaction.c index ac7f2bf861..edd6c3f4bb 100644 --- a/src/lib-storage/index/index-transaction.c +++ b/src/lib-storage/index/index-transaction.c @@ -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; } -- 2.47.3