Mercurial > dovecot > core-2.2
changeset 19318:f9a143c630a5
dsync: Added DSYNC_BRAIN_FLAG_NO_NOTIFY to enable MAILBOX_TRANSACTION_FLAG_NO_NOTIFY
It's arguable that this should be enabled by default, but people might like
to keep mail_log notifications for dsync.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Tue, 20 Oct 2015 15:29:07 +0300 |
parents | 16ff395c156e |
children | 5288c66c7d69 |
files | src/doveadm/dsync/dsync-brain-mailbox.c src/doveadm/dsync/dsync-brain-private.h src/doveadm/dsync/dsync-brain.c src/doveadm/dsync/dsync-brain.h src/doveadm/dsync/dsync-ibc-stream.c src/doveadm/dsync/dsync-mailbox-import.c src/doveadm/dsync/dsync-mailbox-import.h |
diffstat | 7 files changed, 21 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/doveadm/dsync/dsync-brain-mailbox.c Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-brain-mailbox.c Tue Oct 20 15:29:07 2015 +0300 @@ -216,6 +216,8 @@ if (brain->local_dsync_box.have_only_guid128 || remote_dsync_box->have_only_guid128) import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_MAILS_USE_GUID128; + if (brain->no_notify) + import_flags |= DSYNC_MAILBOX_IMPORT_FLAG_NO_NOTIFY; brain->box_importer = brain->backup_send ? NULL : dsync_mailbox_import_init(brain->box, brain->virtual_all_box,
--- a/src/doveadm/dsync/dsync-brain-private.h Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-brain-private.h Tue Oct 20 15:29:07 2015 +0300 @@ -111,6 +111,7 @@ unsigned int changes_during_sync:1; unsigned int require_full_resync:1; unsigned int verbose_proctitle:1; + unsigned int no_notify:1; unsigned int failed:1; };
--- a/src/doveadm/dsync/dsync-brain.c Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-brain.c Tue Oct 20 15:29:07 2015 +0300 @@ -142,6 +142,7 @@ (flags & DSYNC_BRAIN_FLAG_NO_MAIL_PREFETCH) != 0; brain->no_mailbox_renames = (flags & DSYNC_BRAIN_FLAG_NO_MAILBOX_RENAMES) != 0; + brain->no_notify = (flags & DSYNC_BRAIN_FLAG_NO_NOTIFY) != 0; } static void
--- a/src/doveadm/dsync/dsync-brain.h Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-brain.h Tue Oct 20 15:29:07 2015 +0300 @@ -30,7 +30,9 @@ DSYNC_BRAIN_FLAG_NO_MAIL_PREFETCH = 0x100, /* Disable mailbox renaming logic. This is just a kludge that should be removed once the renaming logic has no more bugs.. */ - DSYNC_BRAIN_FLAG_NO_MAILBOX_RENAMES = 0x200 + DSYNC_BRAIN_FLAG_NO_MAILBOX_RENAMES = 0x200, + /* Add MAILBOX_TRANSACTION_FLAG_NO_NOTIFY to transactions. */ + DSYNC_BRAIN_FLAG_NO_NOTIFY = 0x400 }; enum dsync_brain_sync_type {
--- a/src/doveadm/dsync/dsync-ibc-stream.c Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-ibc-stream.c Tue Oct 20 15:29:07 2015 +0300 @@ -76,7 +76,7 @@ "debug sync_visible_namespaces exclude_mailboxes " "send_mail_requests backup_send backup_recv lock_timeout " "no_mail_sync no_mailbox_renames no_backup_overwrite purge_remote " - "sync_since_timestamp sync_flags virtual_all_box" + "no_notify sync_since_timestamp sync_flags virtual_all_box" }, { .name = "mailbox_state", .chr = 'S', @@ -716,6 +716,8 @@ dsync_serializer_encode_add(encoder, "no_backup_overwrite", ""); if ((set->brain_flags & DSYNC_BRAIN_FLAG_PURGE_REMOTE) != 0) dsync_serializer_encode_add(encoder, "purge_remote", ""); + if ((set->brain_flags & DSYNC_BRAIN_FLAG_NO_NOTIFY) != 0) + dsync_serializer_encode_add(encoder, "no_notify", ""); dsync_serializer_encode_finish(&encoder, str); dsync_ibc_stream_send_string(ibc, str); @@ -822,6 +824,8 @@ set->brain_flags |= DSYNC_BRAIN_FLAG_NO_BACKUP_OVERWRITE; if (dsync_deserializer_decode_try(decoder, "purge_remote", &value)) set->brain_flags |= DSYNC_BRAIN_FLAG_PURGE_REMOTE; + if (dsync_deserializer_decode_try(decoder, "no_notify", &value)) + set->brain_flags |= DSYNC_BRAIN_FLAG_NO_NOTIFY; *set_r = set; return DSYNC_IBC_RECV_RET_OK;
--- a/src/doveadm/dsync/dsync-mailbox-import.c Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.c Tue Oct 20 15:29:07 2015 +0300 @@ -62,6 +62,7 @@ uint32_t remote_first_recent_uid; uint64_t remote_highest_modseq, remote_highest_pvt_modseq; time_t sync_since_timestamp; + enum mailbox_transaction_flags transaction_flags; enum mail_flags sync_flag; const char *sync_keyword; @@ -170,12 +171,12 @@ dsync_mailbox_import_transaction_begin(struct dsync_mailbox_importer *importer) { const enum mailbox_transaction_flags ext_trans_flags = - MAILBOX_TRANSACTION_FLAG_SYNC | + importer->transaction_flags | MAILBOX_TRANSACTION_FLAG_EXTERNAL | MAILBOX_TRANSACTION_FLAG_ASSIGN_UIDS; importer->trans = mailbox_transaction_begin(importer->box, - MAILBOX_TRANSACTION_FLAG_SYNC); + importer->transaction_flags); importer->ext_trans = mailbox_transaction_begin(importer->box, ext_trans_flags); importer->mail = mail_alloc(importer->trans, 0, NULL); @@ -227,6 +228,9 @@ else importer->sync_keyword = p_strdup(pool, sync_flag); } + importer->transaction_flags = MAILBOX_TRANSACTION_FLAG_SYNC; + if ((flags & DSYNC_MAILBOX_IMPORT_FLAG_NO_NOTIFY) != 0) + importer->transaction_flags |= MAILBOX_TRANSACTION_FLAG_NO_NOTIFY; hash_table_create(&importer->import_guids, pool, 0, str_hash, strcmp); hash_table_create_direct(&importer->import_uids, pool, 0); @@ -2023,7 +2027,7 @@ importer->virtual_trans = mailbox_transaction_begin(importer->virtual_all_box, - MAILBOX_TRANSACTION_FLAG_SYNC); + importer->transaction_flags); search_ctx = mailbox_search_init(importer->virtual_trans, search_args, NULL, MAIL_FETCH_GUID, NULL); mail_search_args_unref(&search_args);
--- a/src/doveadm/dsync/dsync-mailbox-import.h Tue Oct 20 15:27:42 2015 +0300 +++ b/src/doveadm/dsync/dsync-mailbox-import.h Tue Oct 20 15:29:07 2015 +0300 @@ -9,7 +9,8 @@ DSYNC_MAILBOX_IMPORT_FLAG_REVERT_LOCAL_CHANGES = 0x04, DSYNC_MAILBOX_IMPORT_FLAG_DEBUG = 0x08, DSYNC_MAILBOX_IMPORT_FLAG_MAILS_HAVE_GUIDS = 0x10, - DSYNC_MAILBOX_IMPORT_FLAG_MAILS_USE_GUID128 = 0x20 + DSYNC_MAILBOX_IMPORT_FLAG_MAILS_USE_GUID128 = 0x20, + DSYNC_MAILBOX_IMPORT_FLAG_NO_NOTIFY = 0x40 }; struct mailbox;