Mercurial > dovecot > core-2.2
changeset 11734:ba9f33f9c6c3 HEAD
dsync: If verbosity is enabled, log why desyncing was caused.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Mon, 05 Jul 2010 15:45:06 +0100 |
parents | 529e85c548a9 |
children | 5738c65ad037 |
files | src/dsync/dsync-brain.c src/dsync/dsync-worker-local.c src/dsync/dsync-worker-private.h src/dsync/dsync-worker.c src/dsync/dsync-worker.h src/dsync/dsync.c |
diffstat | 6 files changed, 28 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/src/dsync/dsync-brain.c Mon Jul 05 15:29:07 2010 +0100 +++ b/src/dsync/dsync-brain.c Mon Jul 05 15:45:06 2010 +0100 @@ -34,6 +34,11 @@ brain->verbose = (flags & DSYNC_BRAIN_FLAG_VERBOSE) != 0; brain->backup = (flags & DSYNC_BRAIN_FLAG_BACKUP) != 0; brain->stdout_tty = isatty(STDOUT_FILENO) > 0; + + if ((flags & DSYNC_BRAIN_FLAG_VERBOSE) != 0) { + dsync_worker_set_verbose(src_worker); + dsync_worker_set_verbose(dest_worker); + } return brain; }
--- a/src/dsync/dsync-worker-local.c Mon Jul 05 15:29:07 2010 +0100 +++ b/src/dsync/dsync-worker-local.c Mon Jul 05 15:45:06 2010 +0100 @@ -1272,9 +1272,21 @@ if (mailbox_transaction_commit_get_changes(&ext_trans, &changes) < 0) dsync_worker_set_failure(&worker->worker); else { - if (changes.ignored_modseq_changes != 0 || - !has_expected_save_uids(worker, &changes)) + if (changes.ignored_modseq_changes != 0) { + if (worker->worker.verbose) { + i_info("%s: Ignored %u modseq changes", + mailbox_get_vname(worker->selected_box), + changes.ignored_modseq_changes); + } worker->worker.unexpected_changes = TRUE; + } + if (!has_expected_save_uids(worker, &changes)) { + if (worker->worker.verbose) { + i_info("%s: Couldn't keep all uids", + mailbox_get_vname(worker->selected_box)); + } + worker->worker.unexpected_changes = TRUE; + } pool_unref(&changes.pool); } array_clear(&worker->saved_uids);
--- a/src/dsync/dsync-worker-private.h Mon Jul 05 15:29:07 2010 +0100 +++ b/src/dsync/dsync-worker-private.h Mon Jul 05 15:45:06 2010 +0100 @@ -79,6 +79,7 @@ unsigned int readonly:1; unsigned int failed:1; + unsigned int verbose:1; unsigned int unexpected_changes:1; };
--- a/src/dsync/dsync-worker.c Mon Jul 05 15:29:07 2010 +0100 +++ b/src/dsync/dsync-worker.c Mon Jul 05 15:45:06 2010 +0100 @@ -17,6 +17,11 @@ worker->readonly = TRUE; } +void dsync_worker_set_verbose(struct dsync_worker *worker) +{ + worker->verbose = TRUE; +} + void dsync_worker_set_input_callback(struct dsync_worker *worker, io_callback_t *callback, void *context) {
--- a/src/dsync/dsync-worker.h Mon Jul 05 15:29:07 2010 +0100 +++ b/src/dsync/dsync-worker.h Mon Jul 05 15:45:06 2010 +0100 @@ -35,6 +35,8 @@ /* Set this worker as read-only. All attempted changes are ignored. */ void dsync_worker_set_readonly(struct dsync_worker *worker); +/* Log verbosely */ +void dsync_worker_set_verbose(struct dsync_worker *worker); /* If any function returns with "waiting for more data", the given callback gets called when more data is available. */
--- a/src/dsync/dsync.c Mon Jul 05 15:29:07 2010 +0100 +++ b/src/dsync/dsync.c Mon Jul 05 15:45:06 2010 +0100 @@ -317,7 +317,7 @@ if (unexpected_changes && (brain_flags & DSYNC_BRAIN_FLAG_VERBOSE) != 0) { i_info("Mailbox changes caused a desync. " - "You might want to run dsync again."); + "You may want to run dsync again."); } mail_storage_service_deinit(&storage_service);