]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
dsync: If verbosity is enabled, log why desyncing was caused.
authorTimo Sirainen <tss@iki.fi>
Mon, 5 Jul 2010 14:45:06 +0000 (15:45 +0100)
committerTimo Sirainen <tss@iki.fi>
Mon, 5 Jul 2010 14:45:06 +0000 (15:45 +0100)
--HG--
branch : HEAD

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

index b46098782dc2460c54be55dea89c387400249a09..6d9d537f2ab2e8d80e09ddc68bc8e460c707d9ae 100644 (file)
@@ -34,6 +34,11 @@ dsync_brain_init(struct dsync_worker *src_worker,
        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;
 }
 
index 26e10d47ae616c3112a01184b1073117aa2bca59..332ffd2c0ff4473dd6ed2747a69c9299dc4527b1 100644 (file)
@@ -1272,9 +1272,21 @@ static void local_worker_mailbox_close(struct local_dsync_worker *worker)
        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);
index 8e6455583b00d71ca80bd2ba09cd0ed3a80c5765..86eddcde9d4222405b8eaa3c47c58b360c8f7798 100644 (file)
@@ -79,6 +79,7 @@ struct dsync_worker {
 
        unsigned int readonly:1;
        unsigned int failed:1;
+       unsigned int verbose:1;
        unsigned int unexpected_changes:1;
 };
 
index 7d9fc7b8478afb64092911c1419a4a9d0e3c7a10..dddf0ce464c874c08effe970c54d909757cdc529 100644 (file)
@@ -17,6 +17,11 @@ void dsync_worker_set_readonly(struct dsync_worker *worker)
        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)
 {
index 34939c4bee8b768b2b3f5c0bfb5e3d56785f3eea..951a25cf9779760e42155ecd6e1f81979f11c0e1 100644 (file)
@@ -35,6 +35,8 @@ void dsync_worker_deinit(struct dsync_worker **worker);
 
 /* 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. */
index 5545490a83a365473edfd9b1b74a3f0b21c05eb4..a602386a3570ca1e9535f36ec811d57bc38ddd2b 100644 (file)
@@ -317,7 +317,7 @@ int main(int argc, char *argv[])
        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);