From: Timo Sirainen Date: Tue, 2 Feb 2021 13:24:53 +0000 (+0200) Subject: lib-index: Rename mail_transaction_log_file.saved_tail_offset to last_read_hdr_tail_o... X-Git-Tag: 2.3.16~277 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f2a58502039be4d154fe88288d9f8d1dbd05924b;p=thirdparty%2Fdovecot%2Fcore.git lib-index: Rename mail_transaction_log_file.saved_tail_offset to last_read_hdr_tail_offset This describes better what it's actually used for. --- diff --git a/src/lib-index/mail-transaction-log-append.c b/src/lib-index/mail-transaction-log-append.c index d78b99be49..662f72a9f9 100644 --- a/src/lib-index/mail-transaction-log-append.c +++ b/src/lib-index/mail-transaction-log-append.c @@ -158,9 +158,9 @@ log_append_sync_offset_if_needed(struct mail_transaction_log_append_ctx *ctx) } offset = file->max_tail_offset; - if (file->saved_tail_offset == offset) + if (file->last_read_hdr_tail_offset == offset) return; - i_assert(offset > file->saved_tail_offset); + i_assert(offset > file->last_read_hdr_tail_offset); buffer_create_from_data(&buf, update_data, sizeof(update_data)); u = buffer_append_space_unsafe(&buf, sizeof(*u)); diff --git a/src/lib-index/mail-transaction-log-file.c b/src/lib-index/mail-transaction-log-file.c index 15b94c57aa..b1e46807d6 100644 --- a/src/lib-index/mail-transaction-log-file.c +++ b/src/lib-index/mail-transaction-log-file.c @@ -179,12 +179,12 @@ mail_transaction_log_file_skip_to_head(struct mail_transaction_log_file *file) file->sync_highest_modseq = modseq_hdr->highest_modseq; } if (file->hdr.file_seq == log->index->map->hdr.log_file_seq) { - file->saved_tail_offset = + file->last_read_hdr_tail_offset = log->index->map->hdr.log_file_tail_offset; - file->saved_tail_sync_offset = file->saved_tail_offset; + file->saved_tail_sync_offset = file->last_read_hdr_tail_offset; } - if (file->saved_tail_offset > file->max_tail_offset) - file->max_tail_offset = file->saved_tail_offset; + if (file->last_read_hdr_tail_offset > file->max_tail_offset) + file->max_tail_offset = file->last_read_hdr_tail_offset; } static void @@ -992,7 +992,7 @@ log_file_track_mailbox_sync_offset_hdr(struct mail_transaction_log_file *file, CONST_PTR_OFFSET(u + 1, offset_pos - u->offset), sizeof(tail_offset)); - if (tail_offset < file->saved_tail_offset) { + if (tail_offset < file->last_read_hdr_tail_offset) { /* ignore shrinking tail offsets */ return 1; } else if (tail_offset > file->sync_offset + trans_size) { @@ -1000,7 +1000,7 @@ log_file_track_mailbox_sync_offset_hdr(struct mail_transaction_log_file *file, "log_file_tail_offset %u goes past sync offset %"PRIuUOFF_T, tail_offset, file->sync_offset + trans_size); } else { - file->saved_tail_offset = tail_offset; + file->last_read_hdr_tail_offset = tail_offset; if (tail_offset > file->max_tail_offset) file->max_tail_offset = tail_offset; return 1; diff --git a/src/lib-index/mail-transaction-log-private.h b/src/lib-index/mail-transaction-log-private.h index 5f012f9cff..b41566eb26 100644 --- a/src/lib-index/mail-transaction-log-private.h +++ b/src/lib-index/mail-transaction-log-private.h @@ -50,13 +50,13 @@ struct mail_transaction_log_file { uoff_t sync_offset; /* highest modseq at sync_offset */ uint64_t sync_highest_modseq; - /* saved_tail_offset is the offset that was last written to transaction + /* last_read_hdr_tail_offset is the offset that was last written to transaction log. max_tail_offset is what should be written to the log the next time a transaction is written. transaction log handling may update max_tail_offset automatically by making it skip external transactions after the last saved offset (to avoid re-reading them needlessly). */ - uoff_t saved_tail_offset, max_tail_offset; - /* don't give warnings about saved_tail_offset shrinking if + uoff_t last_read_hdr_tail_offset, max_tail_offset; + /* don't give warnings about last_read_hdr_tail_offset shrinking if sync_offset is less than this. */ uoff_t saved_tail_sync_offset; diff --git a/src/lib-index/mail-transaction-log.c b/src/lib-index/mail-transaction-log.c index f2211bece0..b48953c73e 100644 --- a/src/lib-index/mail-transaction-log.c +++ b/src/lib-index/mail-transaction-log.c @@ -418,7 +418,7 @@ void mail_transaction_log_set_mailbox_sync_pos(struct mail_transaction_log *log, uoff_t file_offset) { i_assert(file_seq == log->head->hdr.file_seq); - i_assert(file_offset >= log->head->saved_tail_offset); + i_assert(file_offset >= log->head->last_read_hdr_tail_offset); if (file_offset >= log->head->max_tail_offset) log->head->max_tail_offset = file_offset;