From ca3710a5f3b9f9f36f439109542f40b3d8f2543d Mon Sep 17 00:00:00 2001 From: Jan Radon Date: Mon, 26 Nov 2018 12:00:08 +0100 Subject: [PATCH 1/4] #215: Check for old mailbox name will no longer be done. Mailbox GUID is now the only matching criteria. doveadm rmb check indices -u will list all not assigned mail objects --- src/storage-rbox/rbox-sync-rebuild.cpp | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/src/storage-rbox/rbox-sync-rebuild.cpp b/src/storage-rbox/rbox-sync-rebuild.cpp index f25b560b..63a76370 100644 --- a/src/storage-rbox/rbox-sync-rebuild.cpp +++ b/src/storage-rbox/rbox-sync-rebuild.cpp @@ -180,17 +180,7 @@ int search_objects(struct index_rebuild_context *ctx, struct rbox_sync_rebuild_c // rebuild index. librados::NObjectIterator iter_guid(storage->find_mails(&attr_guid)); - if (iter_guid != librados::NObjectIterator::__EndObjectIterator) { - ret = rbox_sync_rebuild_entry(ctx, iter_guid, rebuild_ctx); - } else { -#ifdef DEBUG - i_debug("guid is empty, using mailbox name to detect mail objects "); -#endif - librmb::RadosMetadata attr_name(rbox_metadata_key::RBOX_METADATA_ORIG_MAILBOX, rbox->box.name); - // rebuild index. - librados::NObjectIterator iter_name(storage->find_mails(&attr_name)); - ret = rbox_sync_rebuild_entry(ctx, iter_name, rebuild_ctx); - } + ret = rbox_sync_rebuild_entry(ctx, iter_guid, rebuild_ctx); FUNC_END(); return ret; } @@ -266,8 +256,9 @@ int repair_namespace(struct mail_namespace *ns, bool force) { const struct mailbox_info *info; int ret = 0; - iter = mailbox_list_iter_init(ns->list, "*", static_cast(MAILBOX_LIST_ITER_RAW_LIST | - MAILBOX_LIST_ITER_RETURN_NO_FLAGS)); + iter = mailbox_list_iter_init( + ns->list, "*", + static_cast(MAILBOX_LIST_ITER_RAW_LIST | MAILBOX_LIST_ITER_RETURN_NO_FLAGS)); while ((info = mailbox_list_iter_next(iter)) != NULL) { if ((info->flags & (MAILBOX_NONEXISTENT | MAILBOX_NOSELECT)) == 0) { struct mailbox *box = mailbox_alloc(ns->list, info->vname, MAILBOX_FLAG_SAVEONLY); From 1a8ed249936ba086d9dc6fc6f2106b7b68d5d848 Mon Sep 17 00:00:00 2001 From: Jan Radon Date: Mon, 26 Nov 2018 21:41:38 +0100 Subject: [PATCH 2/4] #218: fix exit code for doveadm revert. --- src/librmb/rados-storage-impl.cpp | 3 +++ src/storage-rbox/doveadm-rbox-plugin.cpp | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/librmb/rados-storage-impl.cpp b/src/librmb/rados-storage-impl.cpp index 55f1fbcc..6f2cec92 100644 --- a/src/librmb/rados-storage-impl.cpp +++ b/src/librmb/rados-storage-impl.cpp @@ -223,6 +223,9 @@ bool RadosStorageImpl::wait_for_write_operations_complete( case WAIT_FOR_SAFE_AND_CB: map_it->first->wait_for_safe_and_cb(); break; + default: + map_it->first->wait_for_complete_and_cb(); + break; } failed = map_it->first->get_return_value() < 0 || failed ? true : false; diff --git a/src/storage-rbox/doveadm-rbox-plugin.cpp b/src/storage-rbox/doveadm-rbox-plugin.cpp index 821bfdab..2c1cc045 100644 --- a/src/storage-rbox/doveadm-rbox-plugin.cpp +++ b/src/storage-rbox/doveadm-rbox-plugin.cpp @@ -459,7 +459,6 @@ static int restore_index_entry(struct mail_user *user, const char *mailbox_name, /* add to index */ #if DOVECOT_PREREQ(2, 3) - if ((save_ctx->transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0) { mail_index_append(save_ctx->transaction->itrans, next_uid, &seq); } else { seq = save_ctx->data.stub_seq; @@ -590,7 +589,9 @@ static int cmd_rmb_revert_log_run(struct doveadm_mail_cmd_context *ctx, struct m } std::map> moved_items; ctx->exit_code = librmb::RmbCommands::delete_with_save_log(log_file, plugin.config->get_rados_cluster_name(), - plugin.config->get_rados_username(), &moved_items); + plugin.config->get_rados_username(), &moved_items) >= 0 + ? 0 + : -1; for (std::map>::iterator iter = moved_items.begin(); iter != moved_items.end(); ++iter) { From d963d5fa7ddb465acdd0249b5f843d4add3dfa57 Mon Sep 17 00:00:00 2001 From: Jan Radon Date: Mon, 26 Nov 2018 22:37:42 +0100 Subject: [PATCH 3/4] release 0.0.15 preparations --- CHANGELOG.md | 11 ++++++++++- configure.ac | 2 +- rpm/dovecot-ceph-plugin.spec | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 849d2966..a86269c7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,15 @@ # Change Log -## [0.0.14](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.14) +## [0.0.15](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.15) +[Full Changelog](https://github.com/ceph-dovecot/dovecot-ceph-plugin/compare/0.0.14...0.0.15) + +**Fixed bugs:** + +- doveadm rmb revert =\> does return count of deleted files instead of 0 in case of no error. [\#218](https://github.com/ceph-dovecot/dovecot-ceph-plugin/issues/218) +- doveadm force-resync restore mail \(rbox\_sync\) [\#215](https://github.com/ceph-dovecot/dovecot-ceph-plugin/issues/215) + +## [0.0.14](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.14) (2018-11-22) [Full Changelog](https://github.com/ceph-dovecot/dovecot-ceph-plugin/compare/0.0.13...0.0.14) **Fixed bugs:** @@ -26,6 +34,7 @@ **Merged pull requests:** +- Jrse 0.0.14 [\#214](https://github.com/ceph-dovecot/dovecot-ceph-plugin/pull/214) ([jrse](https://github.com/jrse)) - Jrse \#212 [\#213](https://github.com/ceph-dovecot/dovecot-ceph-plugin/pull/213) ([jrse](https://github.com/jrse)) - Jrse \#209 [\#211](https://github.com/ceph-dovecot/dovecot-ceph-plugin/pull/211) ([jrse](https://github.com/jrse)) - Jrse minor and minor fixes [\#208](https://github.com/ceph-dovecot/dovecot-ceph-plugin/pull/208) ([jrse](https://github.com/jrse)) diff --git a/configure.ac b/configure.ac index 05413636..9b654b8f 100644 --- a/configure.ac +++ b/configure.ac @@ -8,7 +8,7 @@ AC_PREREQ([2.59]) -AC_INIT([dovecot-ceph-plugin], [0.0.14], [https://github.com/ceph-dovecot/dovecot-ceph-plugin/issues/new], ,[https://github.com/ceph-dovecot/dovecot-ceph-plugin]) +AC_INIT([dovecot-ceph-plugin], [0.0.15], [https://github.com/ceph-dovecot/dovecot-ceph-plugin/issues/new], ,[https://github.com/ceph-dovecot/dovecot-ceph-plugin]) AC_CONFIG_AUX_DIR([.]) AC_CONFIG_SRCDIR([src]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/rpm/dovecot-ceph-plugin.spec b/rpm/dovecot-ceph-plugin.spec index f5e561d5..c8f23c9a 100644 --- a/rpm/dovecot-ceph-plugin.spec +++ b/rpm/dovecot-ceph-plugin.spec @@ -13,7 +13,7 @@ Name: dovecot-ceph-plugin Summary: Dovecot Ceph RADOS plugins -Version: 0.0.14 +Version: 0.0.15 Release: 0%{?dist} URL: https://github.com/ceph-dovecot/dovecot-ceph-plugin Group: Productivity/Networking/Email/Servers From 4e8305a0c9b7282a16c5eea3b4847792acd0436d Mon Sep 17 00:00:00 2001 From: Jan Radon Date: Mon, 26 Nov 2018 22:48:26 +0100 Subject: [PATCH 4/4] fix build --- src/storage-rbox/doveadm-rbox-plugin.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/storage-rbox/doveadm-rbox-plugin.cpp b/src/storage-rbox/doveadm-rbox-plugin.cpp index 2c1cc045..b4ecca24 100644 --- a/src/storage-rbox/doveadm-rbox-plugin.cpp +++ b/src/storage-rbox/doveadm-rbox-plugin.cpp @@ -458,7 +458,7 @@ static int restore_index_entry(struct mail_user *user, const char *mailbox_name, } /* add to index */ #if DOVECOT_PREREQ(2, 3) - + if ((save_ctx->transaction->flags & MAILBOX_TRANSACTION_FLAG_FILL_IN_STUB) == 0) { mail_index_append(save_ctx->transaction->itrans, next_uid, &seq); } else { seq = save_ctx->data.stub_seq;