From: Timo Sirainen Date: Wed, 20 Jan 2021 15:22:20 +0000 (+0200) Subject: lib-index: Rename mail_index.last_read_log_* to main_index_hdr_log_* X-Git-Tag: 2.3.16~301 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=09a5aeb327500b00f8c81d096730cdc899073aa8;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Rename mail_index.last_read_log_* to main_index_hdr_log_* Also update the comment to describe better what the variables do. --- diff --git a/src/lib-index/mail-index-map-read.c b/src/lib-index/mail-index-map-read.c index 5880b80895..52d9e2e807 100644 --- a/src/lib-index/mail-index-map-read.c +++ b/src/lib-index/mail-index-map-read.c @@ -395,8 +395,8 @@ mail_index_map_latest_file(struct mail_index *index, const char **reason_r) } 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); diff --git a/src/lib-index/mail-index-private.h b/src/lib-index/mail-index-private.h index 150532a068..b08db905dc 100644 --- a/src/lib-index/mail-index-private.h +++ b/src/lib-index/mail-index-private.h @@ -186,11 +186,13 @@ struct mail_index { 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; diff --git a/src/lib-index/mail-index-sync.c b/src/lib-index/mail-index-sync.c index ae43d2e857..f3b9eb3aa8 100644 --- a/src/lib-index/mail-index-sync.c +++ b/src/lib-index/mail-index-sync.c @@ -835,8 +835,8 @@ static bool mail_index_sync_want_index_write(struct mail_index *index, const cha { 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. */ @@ -845,12 +845,12 @@ static bool mail_index_sync_want_index_write(struct mail_index *index, const cha } 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; } @@ -859,7 +859,7 @@ static bool mail_index_sync_want_index_write(struct mail_index *index, const cha *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; } diff --git a/src/lib-index/mail-index-write.c b/src/lib-index/mail-index-write.c index 5459ebadf0..7684d353a1 100644 --- a/src/lib-index/mail-index-write.c +++ b/src/lib-index/mail-index-write.c @@ -204,6 +204,6 @@ void mail_index_write(struct mail_index *index, bool want_rotate, 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; }