dovecot-2.2: dsync: Don't track too new changes from transaction...
dovecot at dovecot.org
dovecot at dovecot.org
Sat Nov 2 14:19:39 EET 2013
details: http://hg.dovecot.org/dovecot-2.2/rev/dbe7c5a0021e
changeset: 16910:dbe7c5a0021e
user: Timo Sirainen <tss at iki.fi>
date: Sat Nov 02 14:19:23 2013 +0200
description:
dsync: Don't track too new changes from transaction log.
This mattered only during race conditions while there were changes being
done to the mailbox during syncing.
diffstat:
src/doveadm/dsync/dsync-transaction-log-scan.c | 41 +++++++++++++++++++------
1 files changed, 30 insertions(+), 11 deletions(-)
diffs (64 lines):
diff -r 9ef23179892a -r dbe7c5a0021e src/doveadm/dsync/dsync-transaction-log-scan.c
--- a/src/doveadm/dsync/dsync-transaction-log-scan.c Sat Nov 02 13:52:30 2013 +0200
+++ b/src/doveadm/dsync/dsync-transaction-log-scan.c Sat Nov 02 14:19:23 2013 +0200
@@ -353,17 +353,16 @@
bool reset;
int ret;
- if (modseq == 0 ||
- !mail_index_modseq_get_next_log_offset(view, modseq,
- &log_seq, &log_offset))
- ret = 0;
- else {
+ end_seq = view->log_file_head_seq;
+ end_offset = view->log_file_head_offset;
+
+ if (modseq != 0 &&
+ mail_index_modseq_get_next_log_offset(view, modseq,
+ &log_seq, &log_offset)) {
/* scan the view only up to end of the current view.
if there are more changes, we don't care about them until
the next sync. the modseq may however already point to
beyond the current view's end (FIXME: why?) */
- end_seq = view->log_file_head_seq;
- end_offset = view->log_file_head_offset;
if (log_seq > end_seq ||
(log_seq == end_seq && log_offset > end_offset)) {
end_seq = log_seq;
@@ -373,12 +372,32 @@
log_seq, log_offset,
end_seq, end_offset,
&reset);
+ if (ret != 0)
+ return ret;
}
+
+ /* return everything we've got (until the end of the view) */
+ if (!pvt_scan)
+ ctx->returned_all_changes = TRUE;
+ if (mail_transaction_log_view_set_all(log_view) < 0)
+ return -1;
+
+ mail_transaction_log_view_get_prev_pos(log_view, &log_seq, &log_offset);
+ if (log_seq > end_seq ||
+ (log_seq == end_seq && log_offset > end_offset)) {
+ end_seq = log_seq;
+ end_offset = log_offset;
+ }
+ ret = mail_transaction_log_view_set(log_view,
+ log_seq, log_offset,
+ end_seq, end_offset, &reset);
if (ret == 0) {
- /* return everything we've got */
- if (!pvt_scan)
- ctx->returned_all_changes = TRUE;
- return mail_transaction_log_view_set_all(log_view);
+ /* we shouldn't get here. _view_set_all() already
+ reserved all the log files, the _view_set() only
+ removed unwanted ones. */
+ i_error("%s: Couldn't set transaction log view (seq %u..%u)",
+ view->index->filepath, log_seq, end_seq);
+ ret = -1;
}
return ret < 0 ? -1 : 0;
}
More information about the dovecot-cvs
mailing list