struct mail_index_settings set;
struct mail_index_optimization_settings optimization_set;
- uint32_t pending_log2_rotate_time;
pool_t extension_pool;
ARRAY(struct mail_index_registered_ext) extensions;
/* syncing will update this if non-NULL */
struct mail_index_transaction_commit_result *sync_commit_result;
+ /* Delayed log2_rotate_time update to mail_index_header. This is set
+ and unset within the same sync. */
+ uint32_t hdr_log2_rotate_time_delayed_update;
pool_t keywords_pool;
ARRAY_TYPE(keywords) keywords;
&next_uid, sizeof(next_uid), FALSE);
}
}
- if (index->pending_log2_rotate_time != 0) {
- uint32_t log2_rotate_time = index->pending_log2_rotate_time;
+ if (index->hdr_log2_rotate_time_delayed_update != 0) {
+ /* We checked whether .log.2 should be deleted in this same
+ sync. It resulted in wanting to change the log2_rotate_time
+ in the header. Do it here as part of the other changes. */
+ uint32_t log2_rotate_time =
+ index->hdr_log2_rotate_time_delayed_update;
mail_index_update_header(ctx->ext_trans,
offsetof(struct mail_index_header, log2_rotate_time),
&log2_rotate_time, sizeof(log2_rotate_time), TRUE);
- index->pending_log2_rotate_time = 0;
+ index->hdr_log2_rotate_time_delayed_update = 0;
}
ret2 = mail_index_transaction_commit(&ctx->ext_trans);
}
if (log2_rotate_time != log->index->map->hdr.log2_rotate_time) {
- /* Write this as part of the next sync's transaction. We're
+ /* Either the log2_rotate_time in header was missing, or we
+ just deleted the .log.2 and need to set it as nonexistent.
+ Either way we need to update the header.
+
+ Write this as part of the next sync's transaction. We're
here because we're already opening a sync lock, so it'll
always happen. It's also required especially with mdbox map
index, which doesn't like changes done outside syncing. */
- log->index->pending_log2_rotate_time = log2_rotate_time;
+ log->index->hdr_log2_rotate_time_delayed_update =
+ log2_rotate_time;
}
}