dovecot-2.0: dsync: If verbosity is enabled, log why desyncing w...
dovecot at dovecot.org
dovecot at dovecot.org
Mon Jul 5 17:45:09 EEST 2010
details: http://hg.dovecot.org/dovecot-2.0/rev/ba9f33f9c6c3
changeset: 11734:ba9f33f9c6c3
user: Timo Sirainen <tss at iki.fi>
date: Mon Jul 05 15:45:06 2010 +0100
description:
dsync: If verbosity is enabled, log why desyncing was caused.
diffstat:
src/dsync/dsync-brain.c | 5 +++++
src/dsync/dsync-worker-local.c | 16 ++++++++++++++--
src/dsync/dsync-worker-private.h | 1 +
src/dsync/dsync-worker.c | 5 +++++
src/dsync/dsync-worker.h | 2 ++
src/dsync/dsync.c | 2 +-
6 files changed, 28 insertions(+), 3 deletions(-)
diffs (92 lines):
diff -r 529e85c548a9 -r ba9f33f9c6c3 src/dsync/dsync-brain.c
--- 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;
}
diff -r 529e85c548a9 -r ba9f33f9c6c3 src/dsync/dsync-worker-local.c
--- 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);
diff -r 529e85c548a9 -r ba9f33f9c6c3 src/dsync/dsync-worker-private.h
--- 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;
};
diff -r 529e85c548a9 -r ba9f33f9c6c3 src/dsync/dsync-worker.c
--- 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)
{
diff -r 529e85c548a9 -r ba9f33f9c6c3 src/dsync/dsync-worker.h
--- 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. */
diff -r 529e85c548a9 -r ba9f33f9c6c3 src/dsync/dsync.c
--- 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);
More information about the dovecot-cvs
mailing list