i_assert(ctx->finished);
/* lock the mailbox before map to avoid deadlocks */
- if (dbox_sync_begin(ctx->mbox, DBOX_SYNC_FLAG_FORCE |
+ if (dbox_sync_begin(ctx->mbox, DBOX_SYNC_FLAG_NO_PURGE |
+ DBOX_SYNC_FLAG_FORCE |
DBOX_SYNC_FLAG_FSYNC, &ctx->sync_ctx) < 0) {
dbox_transaction_save_rollback(ctx);
return -1;
that's why we do this calculation before current
sync: the purging is triggered only after the
second expunge. */
- if (dbox_map_want_purge(ctx->mbox->storage->map))
+ if ((ctx->flags & DBOX_SYNC_FLAG_NO_PURGE) == 0 &&
+ dbox_map_want_purge(ctx->mbox->storage->map))
ctx->purge = TRUE;
}
ctx = i_new(struct dbox_sync_context, 1);
ctx->mbox = mbox;
+ ctx->flags = flags;
if (!mbox->ibox.keep_recent)
sync_flags |= MAIL_INDEX_SYNC_FLAG_DROP_RECENT;
enum dbox_sync_flags {
DBOX_SYNC_FLAG_FORCE = 0x01,
DBOX_SYNC_FLAG_FSYNC = 0x02,
- DBOX_SYNC_FLAG_FORCE_REBUILD = 0x04
+ DBOX_SYNC_FLAG_FORCE_REBUILD = 0x04,
+ DBOX_SYNC_FLAG_NO_PURGE = 0x08
};
struct dbox_sync_file_entry {
struct mail_index_view *sync_view;
struct mail_index_transaction *trans;
struct dbox_map_transaction_context *map_trans;
+ enum dbox_sync_flags flags;
string_t *path;
unsigned int path_dir_prefix_len;