OPTION(rbd_journal_object_flush_interval, OPT_INT, 0) // maximum number of pending commits per journal object
OPTION(rbd_journal_object_flush_bytes, OPT_INT, 0) // maximum number of pending bytes per journal object
OPTION(rbd_journal_object_flush_age, OPT_DOUBLE, 0) // maximum age (in seconds) for pending commits
+OPTION(rbd_journal_pool, OPT_STR, "") // pool for journal objects
OPTION(nss_db_path, OPT_STR, "") // path to nss db
"rbd_journal_commit_age", false)(
"rbd_journal_object_flush_interval", false)(
"rbd_journal_object_flush_bytes", false)(
- "rbd_journal_object_flush_age", false);
+ "rbd_journal_object_flush_age", false)(
+ "rbd_journal_pool", false);
string start = METADATA_CONF_PREFIX;
int r = 0, j = 0;
ASSIGN_OPTION(journal_object_flush_interval);
ASSIGN_OPTION(journal_object_flush_bytes);
ASSIGN_OPTION(journal_object_flush_age);
+ ASSIGN_OPTION(journal_pool);
}
void ImageCtx::open_journal() {
int journal_object_flush_interval;
uint64_t journal_object_flush_bytes;
double journal_object_flush_age;
+ std::string journal_pool;
LibrbdAdminSocketHook *asok_hook;
}
int Journal::create(librados::IoCtx &io_ctx, const std::string &image_id,
- double commit_age, uint8_t order, uint8_t splay_width) {
+ double commit_age, uint8_t order, uint8_t splay_width,
+ const std::string &object_pool) {
CephContext *cct = reinterpret_cast<CephContext *>(io_ctx.cct());
ldout(cct, 5) << __func__ << ": image=" << image_id << dendl;
+ int64_t pool_id = -1;
+ if (!object_pool.empty()) {
+ librados::Rados rados(io_ctx);
+ IoCtx data_io_ctx;
+ int r = rados.ioctx_create(object_pool.c_str(), data_io_ctx);
+ if (r != 0) {
+ lderr(cct) << "failed to create journal: "
+ << "error opening journal objects pool '" << object_pool
+ << "': " << cpp_strerror(r) << dendl;
+ return r;
+ }
+ pool_id = data_io_ctx.get_id();
+ }
+
::journal::Journaler journaler(io_ctx, image_id, "", commit_age);
- int r = journaler.create(order, splay_width, io_ctx.get_id());
+ int r = journaler.create(order, splay_width, pool_id);
if (r < 0) {
lderr(cct) << "failed to create journal: " << cpp_strerror(r) << dendl;
return r;
assert(m_state == STATE_UNINITIALIZED);
assert(m_journaler == NULL);
- // TODO allow alternate pool for journal objects and commit flush interval
m_close_pending = false;
m_journaler = new ::journal::Journaler(m_image_ctx.md_ctx, m_image_ctx.id, "",
m_image_ctx.journal_commit_age);
-
m_journaler->init(new C_InitJournal(this));
transition_state(STATE_INITIALIZING);
}
static bool is_journal_supported(ImageCtx &image_ctx);
static int create(librados::IoCtx &io_ctx, const std::string &image_id,
- double commit_age, uint8_t order, uint8_t splay_width);
+ double commit_age, uint8_t order, uint8_t splay_width,
+ const std::string &object_pool);
static int remove(librados::IoCtx &io_ctx, const std::string &image_id);
bool is_journal_ready() const;
r = Journal::create(io_ctx, id, cct->_conf->rbd_journal_commit_age,
cct->_conf->rbd_journal_order,
- cct->_conf->rbd_journal_splay_width);
+ cct->_conf->rbd_journal_splay_width,
+ cct->_conf->rbd_journal_pool);
if (r < 0) {
lderr(cct) << "error creating journal: " << cpp_strerror(r) << dendl;
goto err_remove_object_map;
features_mask |= RBD_FEATURE_EXCLUSIVE_LOCK;
r = Journal::create(ictx->md_ctx, ictx->id, ictx->journal_commit_age,
- ictx->journal_order, ictx->journal_splay_width);
+ ictx->journal_order, ictx->journal_splay_width,
+ ictx->journal_pool);
if (r < 0) {
lderr(cct) << "error creating image journal: " << cpp_strerror(r)
<< dendl;