Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rbox sync rebuild #215 #219

Merged
merged 4 commits into from
Nov 26, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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:**
Expand All @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down
2 changes: 1 addition & 1 deletion rpm/dovecot-ceph-plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/librmb/rados-storage-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/storage-rbox/doveadm-rbox-plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,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 {
Expand Down Expand Up @@ -590,7 +589,9 @@ static int cmd_rmb_revert_log_run(struct doveadm_mail_cmd_context *ctx, struct m
}
std::map<std::string, std::list<librmb::RadosSaveLogEntry>> 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<std::string, std::list<librmb::RadosSaveLogEntry>>::iterator iter = moved_items.begin();
iter != moved_items.end(); ++iter) {
Expand Down
17 changes: 4 additions & 13 deletions src/storage-rbox/rbox-sync-rebuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -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_flags>(MAILBOX_LIST_ITER_RAW_LIST |
MAILBOX_LIST_ITER_RETURN_NO_FLAGS));
iter = mailbox_list_iter_init(
ns->list, "*",
static_cast<mailbox_list_iter_flags>(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);
Expand Down