Skip to content

Commit

Permalink
Develop (#345)
Browse files Browse the repository at this point in the history
* Loglevel Debug is sufficient as it gets retried (#337)

* Bugfix/339 rados config timeout (#340)

* 339 retry 10 times with random wait. retry read for simple read e.g. rados_config. fail with assert in case we can't find rados_config

* Feature/342 object search (#343)

* Develop (#331)

* #328: fix copy move (#330)

* Develop (#334)

* 217: fix unused code.

* 217: unused code and warning

* disabled man pages for rmb

* Bugfix/283 virtual mailbox fetch metadata (#284)

* Develop (#282)

* 217: fix unused code.

* 217: unused code and warning

* disabled man pages for rmb

* #283: fetch metadata for mails in virtual mailbox

* #283: fix metadata date.saved. date.received virtual mailbox

* #283: version

* Feature/286 use guid from UUID string (#287)

* #256: use guid_128_from_uuid_string instead of guid_128_from_string, to support older uuid formats like RECORD or MICROSOFT, always use compact for printing

* version 0.0.25 preparations

* #286: build issue

* merge

* version

* #286: prefere cached mail guid.

* #286: determine if uuid has - hyphon, if true preseve it.

* fix non void return

* Feature/289 GitHub actions (#290)

* #289: build

* #289: build plugin.

* #289: submodules

* submodules

* upgrade git

* clean outdated repos

* Bugfix/UUID record format (#293)

* bugfix initialisaction rados_mail->deprecated_uid

* rados_mail creation and default value check

* #295: update index after full object has been moved (metadata) (#296)

* Bugfix/298 295 bugfixes (#300)

* #289: fix force-resync (always use INBOX)
#295: rbox_mail_set_expunge (play save)

* #298: move ceph objects the standard way.

* clean up log.

* #298: log warning if client connection times out.

* Feature/302 retry expunge connection timeout (#303)

* #302: retry in case of ceph connection timeout

* rpm

* #302: max_retry = 10

* max 10 retry, in case object not available, fail with error

* #304: use last know uid to restore email flags (#305)

* #306: re-assign unreferenced mail objects to inbox (#309)

* #310: read osd_max_object_size and fail if mail.size > osd_max_object_size (#311)

* version: 0.0.31

* #313: fix imap append crash (#314)

* version 0.0.32

* Bugfix/316 mailbox save (#317)

* #316: imap append (remove index entry twice in case of error)

* #316: changed storage for big attachments. (sync write)

* #316: operate api

* #316:  fix operate call

* #316: release preparations

* #316: fixed some legacy unit tests

* 316: review results

* #316: fix

* Bugfix/test output stream check (#323)

* init output stream and free mailbuffer

* build

* extracted write chunks

* mailsize -1;

* fix

* debug messages

* init stream any case

* added deprecation comment, writing chunks now default. new config param rbox_chunk_size default 10240 bytes

* missing mock class

* version

* disabled (temporarily storage tests)

* disabled storage tests( api change)

* Feature/alternative save methods (#326)

* #322: alternative save methods

* version

* Feature/319 force resync immediatelly assign bugfix/328 segmentation fault copy from virtual mailbox (#321)

* #319: automatically add lost objects to inbox (if no mailbox guid exist)

* #319: version 0.0.34

* catch error in case mailbox does not have obox header: e.v. Virtual Mailbox

* check for virtual mailbox when moving or copying, (virtual mailbox not allowed as origin)

* version

* #328: fix copy move (#330)

* Bugfix/332 quota and move (#333)

* 291: failed save mock test

* 291: fixed most of the tests

* 332 fix notify messages number and type

* Develop (#336)

* 217: fix unused code.

* 217: unused code and warning

* disabled man pages for rmb

* Bugfix/283 virtual mailbox fetch metadata (#284)

* Develop (#282)

* 217: fix unused code.

* 217: unused code and warning

* disabled man pages for rmb

* #283: fetch metadata for mails in virtual mailbox

* #283: fix metadata date.saved. date.received virtual mailbox

* #283: version

* Feature/286 use guid from UUID string (#287)

* #256: use guid_128_from_uuid_string instead of guid_128_from_string, to support older uuid formats like RECORD or MICROSOFT, always use compact for printing

* version 0.0.25 preparations

* #286: build issue

* merge

* version

* #286: prefere cached mail guid.

* #286: determine if uuid has - hyphon, if true preseve it.

* fix non void return

* Feature/289 GitHub actions (#290)

* #289: build

* #289: build plugin.

* #289: submodules

* submodules

* upgrade git

* clean outdated repos

* Bugfix/UUID record format (#293)

* bugfix initialisaction rados_mail->deprecated_uid

* rados_mail creation and default value check

* #295: update index after full object has been moved (metadata) (#296)

* Bugfix/298 295 bugfixes (#300)

* #289: fix force-resync (always use INBOX)
#295: rbox_mail_set_expunge (play save)

* #298: move ceph objects the standard way.

* clean up log.

* #298: log warning if client connection times out.

* Feature/302 retry expunge connection timeout (#303)

* #302: retry in case of ceph connection timeout

* rpm

* #302: max_retry = 10

* max 10 retry, in case object not available, fail with error

* #304: use last know uid to restore email flags (#305)

* #306: re-assign unreferenced mail objects to inbox (#309)

* #310: read osd_max_object_size and fail if mail.size > osd_max_object_size (#311)

* version: 0.0.31

* #313: fix imap append crash (#314)

* version 0.0.32

* Bugfix/316 mailbox save (#317)

* #316: imap append (remove index entry twice in case of error)

* #316: changed storage for big attachments. (sync write)

* #316: operate api

* #316:  fix operate call

* #316: release preparations

* #316: fixed some legacy unit tests

* 316: review results

* #316: fix

* Bugfix/test output stream check (#323)

* init output stream and free mailbuffer

* build

* extracted write chunks

* mailsize -1;

* fix

* debug messages

* init stream any case

* added deprecation comment, writing chunks now default. new config param rbox_chunk_size default 10240 bytes

* missing mock class

* version

* disabled (temporarily storage tests)

* disabled storage tests( api change)

* Feature/alternative save methods (#326)

* #322: alternative save methods

* version

* Feature/319 force resync immediatelly assign bugfix/328 segmentation fault copy from virtual mailbox (#321)

* #319: automatically add lost objects to inbox (if no mailbox guid exist)

* #319: version 0.0.34

* catch error in case mailbox does not have obox header: e.v. Virtual Mailbox

* check for virtual mailbox when moving or copying, (virtual mailbox not allowed as origin)

* version

* #328: fix copy move (#330)

* Bugfix/332 quota and move (#333)

* 291: failed save mock test

* 291: fixed most of the tests

* 332 fix notify messages number and type

* #332: fix append additional error mssage in case connection can't be opend (#335)

* Develop (#341)

* Loglevel Debug is sufficient as it gets retried (#337)

* Bugfix/339 rados config timeout (#340)

* 339 retry 10 times with random wait. retry read for simple read e.g. rados_config. fail with assert in case we can't find rados_config

* #342: simple multithreading object search

* #342: version 0.0.40

Co-authored-by: Ewald Dieterich <[email protected]>

* Bugfix/342 logging multithreading (#344)

* #342 fix threading and additional logs

* version

* Bugfix/rbox copy context (#347)

* 346; fix rbox-copy seg fault always init rbox_mail

* #346 fix segmentation fault rbox_copy

Co-authored-by: Ewald Dieterich <[email protected]>
  • Loading branch information
jrse and edieterich authored Oct 20, 2022
1 parent 7c0aed6 commit 28b6532
Show file tree
Hide file tree
Showing 6 changed files with 64 additions and 23 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Change Log

## [0.0.42](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.42) (2022-10-18)
- #346 segmentation fault (rbox_copy) if rbox_mail is null

## [0.0.41](https://github.com/ceph-dovecot/dovecot-ceph-plugin/tree/0.0.41) (2022-09-27)
- #342 multithreading bugfix and additional logging

Expand Down
3 changes: 1 addition & 2 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,7 @@
AC_PREREQ([2.59])


AC_INIT([dovecot-ceph-plugin], [0.0.41], [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.42], [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])
Expand Down
3 changes: 2 additions & 1 deletion rpm/dovecot-ceph-plugin.spec
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ Name: dovecot-ceph-plugin
Summary: Dovecot Ceph RADOS plugins


Version: 0.0.41
Version: 0.0.42


Release: 0%{?dist}
URL: https://github.com/ceph-dovecot/dovecot-ceph-plugin
Expand Down
46 changes: 36 additions & 10 deletions src/librmb/rados-storage-impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -203,48 +203,74 @@ std::set<std::string> RadosStorageImpl::find_mails_async(const RadosMetadata *at

std::set<std::string> oid_list;
std::mutex oid_list_mutex;

// Thread!!
auto f = [](const std::vector<std::string> &list,
std::mutex &oid_mutex,
std::set<std::string> &oids,
librados::IoCtx *io_ctx,
void (*ptr)(std::string&),
std::string osd,
ceph::bufferlist &filter) {

// Define a Lambda Expression
auto f = [](const std::vector<std::string> &list, std::mutex &oid_mutex, std::set<std::string> &oids, librados::IoCtx *io_ctx,
void (*ptr)(std::string&), std::string osd) {
int total_count = 0;

for (auto const &pg: list) {

uint64_t ppool;
uint32_t pseed;
int r = sscanf(pg.c_str(), "%llu.%x", (long long unsigned *)&ppool, &pseed);

librados::NObjectIterator iter= io_ctx->nobjects_begin(pseed);
librados::NObjectIterator iter= io_ctx->nobjects_begin(pseed, filter);
int count = 0;
while (iter != librados::NObjectIterator::__EndObjectIterator) {
std::string oid = iter->get_oid();
{
std::lock_guard<std::mutex> guard(oid_mutex);
oids.insert(oid);
count++;
}
iter++;
}
std::string t = "osd "+ osd +" pg done " + pg;
total_count+=count;
std::string t = "osd "+ osd +" pg done " + pg + " objects " + std::to_string(count);
(*ptr)(t);
}
std::string t = "done with osd "+ osd ;
std::string t = "done with osd "+ osd + " total: " + std::to_string(total_count);
(*ptr)(t);
};
};


//std::string pool_mame = "mail_storage";
std::map<std::string, std::vector<std::string>> osd_pg_map = cluster->list_pgs_osd_for_pool(pool_name);
std::vector<std::thread> threads;


std::string filter_name = PLAIN_FILTER_NAME;
ceph::bufferlist filter_bl;

encode(filter_name, filter_bl);
encode("_" + attr->key, filter_bl);
encode(attr->bl.to_str(), filter_bl);
std::string msg_1 = "buffer set";
(*ptr)(msg_1);

for (const auto& x : osd_pg_map){
if(threads.size() == num_threads){
threads[0].join();
threads.erase(threads.begin());
}
threads.push_back(std::thread(f, std::ref(x.second),std::ref(oid_list_mutex),std::ref(oid_list), &get_io_ctx(), ptr, x.first));
//TODO: update parser that this will not end here filter out invalid osd
if(x.first == "oon") {
std::string create_msg = "skipping thread for osd: "+ x.first;
(*ptr)(create_msg);
continue;
}
threads.push_back(std::thread(f, std::ref(x.second),std::ref(oid_list_mutex),std::ref(oid_list), &get_io_ctx(), ptr, x.first, std::ref(filter_bl)));
std::string create_msg = "creating thread for osd: "+ x.first;
(*ptr)(create_msg);
}


for (auto const &thread: threads) {
thread.join();
}
Expand Down
12 changes: 5 additions & 7 deletions src/storage-rbox/rbox-copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,16 +236,14 @@ static int rbox_mail_storage_try_copy(struct mail_save_context **_ctx, struct ma
if (get_src_dest_namespace(r_storage, mail, dest_mbox, &ns_src, &ns_dest) < 0) {
return -1;
}

// always make sure rados mail is valid.
if(rmail->rados_mail == nullptr){
rmail->rados_mail = r_storage->s->alloc_rados_mail();
}
#ifdef DEBUG
i_debug("namespaces: src=%s, dst=%s", ns_src.c_str(), ns_dest.c_str());
#endif
if(ctx->copy_src_mail->box->virtual_vfuncs != NULL) {
i_debug("copy from virtual mailbox requires us to create the rados mail structure here!");
if(rmail->rados_mail == nullptr){
rmail->rados_mail = r_storage->s->alloc_rados_mail();
}
}


if (r_ctx->copying == TRUE) {
if (rbox_get_index_record(mail) < 0) {
Expand Down
20 changes: 17 additions & 3 deletions src/storage-rbox/rbox-sync-rebuild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ extern "C" {
#include "data-stack.h"
}

#include <sys/time.h>

#include "rbox-sync-rebuild.h"

#include "rbox-storage.hpp"
Expand Down Expand Up @@ -187,7 +189,7 @@ int rbox_sync_rebuild_entry(struct index_rebuild_context *ctx, std::map<std::str

sync_add_objects_ret =
rbox_sync_add_object(ctx, *it->get_oid(), &(*it), rebuild_ctx->alt_storage, rebuild_ctx->next_uid);
i_info("re-adding mail oid:(%s) with uid: %d to mailbox %s (%s) ", it->get_oid()->c_str(), rebuild_ctx->next_uid, mailbox_guid.c_str(), ctx->box->name );
i_debug("re-adding mail oid:(%s) with uid: %d to mailbox %s (%s) ", it->get_oid()->c_str(), rebuild_ctx->next_uid, mailbox_guid.c_str(), ctx->box->name );

if (sync_add_objects_ret < 0) {
i_error("sync_add_object: oid(%s), alt_storage(%d),uid(%d)", it->get_oid()->c_str(),
Expand Down Expand Up @@ -462,11 +464,23 @@ int repair_namespace(struct mail_namespace *ns, bool force, struct rbox_storage
std::string pool_name = r_storage->s->get_pool_name();

if( r_storage->config->get_object_search_method() == 1) {
mail_list = r_storage->s->find_mails_async(nullptr,

librmb::RadosMetadata filter(rbox_metadata_key::RBOX_METADATA_ORIG_MAILBOX, "INBOX");

long milli_time, seconds, useconds;
struct timeval start_time, end_time;
gettimeofday(&start_time, NULL);

mail_list = r_storage->s->find_mails_async(&filter,
pool_name,
r_storage->config->get_object_search_threads(),
&cb);
i_info("multithreading done");
gettimeofday(&end_time, NULL);
seconds = end_time.tv_sec - start_time.tv_sec; //seconds
useconds = end_time.tv_usec - start_time.tv_usec; //milliseconds
milli_time = ((seconds) * 1000 + useconds/1000.0);

i_info("multithreading done : took: %ld ms", (milli_time));
}else{
i_info("Ceph connection established using namespace: %s",r_storage->s->get_namespace().c_str());
i_info("Loading mails... ");
Expand Down

0 comments on commit 28b6532

Please sign in to comment.