Skip to content

Commit

Permalink
#243: changed config to rbox_ceph_write_chunks
Browse files Browse the repository at this point in the history
  • Loading branch information
jrse committed Feb 5, 2019
1 parent 105c407 commit 8ebc2e9
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/librmb/rados-dovecot-ceph-cfg-impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class RadosDovecotCephCfgImpl : public RadosDovecotCephCfg {
bool is_rbox_check_empty_mailboxes() override { return dovecot_cfg.is_rbox_check_empty_mailboxes(); }
bool is_ceph_posix_bugfix_enabled() override { return dovecot_cfg.is_ceph_posix_bugfix_enabled(); }
bool is_ceph_aio_wait_for_safe_and_cb() override { return dovecot_cfg.is_ceph_aio_wait_for_safe_and_cb(); }
bool is_create_write_op_in_write_continue() override { return dovecot_cfg.is_create_write_op_in_write_continue(); }
bool is_write_chunks() override { return dovecot_cfg.is_write_chunks(); }
// rados config
bool is_user_mapping() override { return rados_cfg.is_user_mapping(); }
void set_config_valid(bool is_valid_) override {
Expand Down
2 changes: 1 addition & 1 deletion src/librmb/rados-dovecot-ceph-cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class RadosDovecotCephCfg {
virtual void update_pool_name_metadata(const char *value) = 0;
virtual bool is_ceph_posix_bugfix_enabled() = 0;
virtual bool is_ceph_aio_wait_for_safe_and_cb() = 0;
virtual bool is_create_write_op_in_write_continue() = 0;
virtual bool is_write_chunks() = 0;

virtual const std::string &get_pool_name_metadata_key() = 0;
virtual const std::string &get_update_attributes_key() = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/librmb/rados-dovecot-config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ RadosConfig::RadosConfig()
save_log("rados_save_log"),
rbox_check_empty_mailboxes("rados_check_empty_mailboxes"),
rbox_ceph_aio_wait_for_safe_and_cb("rbox_ceph_aio_wait_for_safe_and_cb"),
rbox_ceph_write_ops_in_save_continue("rbox_ceph_write_ops_in_save_continue") {
rbox_ceph_write_chunks("rbox_ceph_write_chunks") {
config[pool_name] = "mail_storage";

config[rbox_cfg_object_name] = "rbox_cfg";
Expand All @@ -37,7 +37,7 @@ RadosConfig::RadosConfig()
config[save_log] = "";
config[rbox_check_empty_mailboxes] = "false";
config[rbox_ceph_aio_wait_for_safe_and_cb] = "false";
config[rbox_ceph_write_ops_in_save_continue] = "false";
config[rbox_ceph_write_chunks] = "false";
is_valid = false;
}

Expand Down Expand Up @@ -72,7 +72,7 @@ std::string RadosConfig::to_string() {
ss << " " << save_log << "=" << config[save_log] << std::endl;
ss << " " << rbox_check_empty_mailboxes << "=" << config[rbox_check_empty_mailboxes] << std::endl;
ss << " " << rbox_ceph_aio_wait_for_safe_and_cb << "=" << config[rbox_ceph_aio_wait_for_safe_and_cb] << std::endl;
ss << " " << rbox_ceph_write_ops_in_save_continue << "=" << config[rbox_ceph_write_ops_in_save_continue]
ss << " " << rbox_ceph_write_chunks << "=" << config[rbox_ceph_write_chunks]
<< std::endl;
return ss.str();
}
Expand Down
6 changes: 3 additions & 3 deletions src/librmb/rados-dovecot-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,8 @@ class RadosConfig {
bool is_ceph_aio_wait_for_safe_and_cb() {
return config[rbox_ceph_aio_wait_for_safe_and_cb].compare("true") == 0 ? true : false;
}
bool is_create_write_op_in_write_continue() {
return config[rbox_ceph_write_ops_in_save_continue].compare("true") == 0 ? true : false;
bool is_write_chunks() {
return config[rbox_ceph_write_chunks].compare("true") == 0 ? true : false;
}

/*!
Expand All @@ -81,7 +81,7 @@ class RadosConfig {
std::string save_log;
std::string rbox_check_empty_mailboxes;
std::string rbox_ceph_aio_wait_for_safe_and_cb;
std::string rbox_ceph_write_ops_in_save_continue;
std::string rbox_ceph_write_chunks;
bool is_valid;
};

Expand Down
6 changes: 3 additions & 3 deletions src/storage-rbox/rbox-save.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ void init_output_stream(mail_save_context *_ctx) {

// create buffer ( delete is in wait_for_write_operations)
r_ctx->rados_mail->set_mail_buffer(new librados::bufferlist());
r_ctx->output_stream = o_stream_create_bufferlist(r_ctx->rados_mail, &r_ctx->rados_storage,
rbox->storage->config->is_create_write_op_in_write_continue());
r_ctx->output_stream =
o_stream_create_bufferlist(r_ctx->rados_mail, &r_ctx->rados_storage, rbox->storage->config->is_write_chunks());
o_stream_cork(r_ctx->output_stream);
_ctx->data.output = r_ctx->output_stream;
FUNC_END();
Expand Down Expand Up @@ -517,7 +517,7 @@ int rbox_save_finish(struct mail_save_context *_ctx) {
librados::ObjectWriteOperation write_op; // = new librados::ObjectWriteOperation();
r_storage->ms->get_storage()->save_metadata(&write_op, r_ctx->rados_mail);

if (!r_storage->config->is_create_write_op_in_write_continue()) {
if (!r_storage->config->is_write_chunks()) {
r_ctx->failed = !r_storage->s->save_mail(&write_op, r_ctx->rados_mail, async_write);
} else {
int ret = r_storage->s->aio_operate(&r_storage->s->get_io_ctx(), *r_ctx->rados_mail->get_oid(),
Expand Down
2 changes: 1 addition & 1 deletion src/tests/mocks/mock_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ class RadosDovecotCephCfgMock : public RadosDovecotCephCfg {
MOCK_METHOD1(set_update_attributes, void(const std::string &update_attributes_));
MOCK_METHOD0(is_ceph_posix_bugfix_enabled, bool());
MOCK_METHOD0(is_ceph_aio_wait_for_safe_and_cb, bool());
MOCK_METHOD0(is_create_write_op_in_write_continue, bool());
MOCK_METHOD0(is_write_chunks, bool());

MOCK_METHOD1(update_mail_attributes, void(const char *value));
MOCK_METHOD1(update_updatable_attributes, void(const char *value));
Expand Down
2 changes: 1 addition & 1 deletion src/tests/storage-rbox2/TestCase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ extern "C" {
#define i_zero(p) memset(p, 0, sizeof(*(p)))
#endif
static const char *rbox_pool_name = "rbox_pool_name";
static const char *user_env_save_continue = "rbox_ceph_write_ops_in_save_continue";
static const char *user_env_save_continue = "rbox_ceph_write_chunks";
static const char *user_env_save_continue_value = "true";

static int set_user_env(struct mail_user *user, const char *val) {
Expand Down

0 comments on commit 8ebc2e9

Please sign in to comment.