static int
view_sync_set_log_view_range(struct mail_index_view *view, bool sync_expunges,
- bool *reset_r)
+ bool *reset_r, bool *partial_sync_r)
{
const struct mail_index_header *hdr = &view->index->map->hdr;
uint32_t start_seq, end_seq;
const char *reason;
int ret;
+ *partial_sync_r = FALSE;
+
start_seq = view->log_file_expunge_seq;
start_offset = view->log_file_expunge_offset;
end_seq = hdr->log_file_seq;
view->log_file_expunge_seq);
break;
}
+ *partial_sync_r = TRUE;
}
return 1;
}
struct mail_index_view_sync_ctx *ctx;
struct mail_index_map *tmp_map;
unsigned int expunge_count = 0;
- bool reset, sync_expunges, have_expunges;
+ bool reset, partial_sync, sync_expunges, have_expunges;
int ret;
i_assert(!view->syncing);
return ctx;
}
- ret = view_sync_set_log_view_range(view, sync_expunges, &reset);
+ ret = view_sync_set_log_view_range(view, sync_expunges, &reset, &partial_sync);
if (ret < 0) {
ctx->failed = TRUE;
return ctx;
view->index->filepath);
}
- if (!have_expunges) {
+ if (!have_expunges && !partial_sync) {
/* no expunges, we can just replace the map */
if (view->index->map->hdr.messages_count <
ctx->finish_min_msg_count) {
mail_index_unmap(&view->map);
view->map = view->index->map;
} else {
- /* expunges seen. create a private map which we update.
- if we're syncing expunges the map will finally be replaced
- with the head map to remove the expunged messages. */
+ /* a) expunges seen. b) doing a partial sync because we saw
+ a reset.
+
+ Create a private map which we update. If we're syncing
+ expunges the map will finally be replaced with the head map
+ to remove the expunged messages. */
ctx->sync_map_update = TRUE;
if (view->map->refcount > 1) {