}
i_assert(new_map->rec_map->records != NULL);
- index->last_read_log_file_seq = new_map->hdr.log_file_seq;
- index->last_read_log_file_tail_offset =
+ index->main_index_hdr_log_file_seq = new_map->hdr.log_file_seq;
+ index->main_index_hdr_log_file_tail_offset =
new_map->hdr.log_file_tail_offset;
mail_index_unmap(&index->map);
uint32_t indexid;
unsigned int inconsistency_id;
- /* last_read_log_file_* contains the seq/offsets we last read from
- the main index file's headers. these are used to figure out when
- the main index file should be updated. */
- uint32_t last_read_log_file_seq;
- uint32_t last_read_log_file_tail_offset;
+ /* These contain the log_file_seq and log_file_tail_offset that exists
+ in dovecot.index file's header. These are used to figure out if it's
+ time to rewrite the dovecot.index file. Note that these aren't
+ available in index->map->hdr, because it gets updated when
+ transaction log file is read. */
+ uint32_t main_index_hdr_log_file_seq;
+ uint32_t main_index_hdr_log_file_tail_offset;
/* log file which last updated index_deleted */
uint32_t index_delete_changed_file_seq;
{
uint32_t log_diff;
- if (index->last_read_log_file_seq != 0 &&
- index->last_read_log_file_seq != index->map->hdr.log_file_seq) {
+ if (index->main_index_hdr_log_file_seq != 0 &&
+ index->main_index_hdr_log_file_seq != index->map->hdr.log_file_seq) {
/* dovecot.index points to an old .log file. we were supposed
to rewrite the dovecot.index when rotating the log, so
we shouldn't usually get here. */
}
log_diff = index->map->hdr.log_file_tail_offset -
- index->last_read_log_file_tail_offset;
+ index->main_index_hdr_log_file_tail_offset;
if (log_diff > index->optimization_set.index.rewrite_max_log_bytes) {
*reason_r = t_strdup_printf(
".log read %u..%u > rewrite_max_log_bytes %"PRIuUOFF_T,
index->map->hdr.log_file_tail_offset,
- index->last_read_log_file_tail_offset,
+ index->main_index_hdr_log_file_tail_offset,
index->optimization_set.index.rewrite_max_log_bytes);
return TRUE;
}
*reason_r = t_strdup_printf(
".log read %u..%u > rewrite_min_log_bytes %"PRIuUOFF_T,
index->map->hdr.log_file_tail_offset,
- index->last_read_log_file_tail_offset,
+ index->main_index_hdr_log_file_tail_offset,
index->optimization_set.index.rewrite_min_log_bytes);
return TRUE;
}
index->filepath, hdr->log_file_seq, reason);
}
- index->last_read_log_file_seq = hdr->log_file_seq;
- index->last_read_log_file_tail_offset = hdr->log_file_tail_offset;
+ index->main_index_hdr_log_file_seq = hdr->log_file_seq;
+ index->main_index_hdr_log_file_tail_offset = hdr->log_file_tail_offset;
}