name = prefix + buf;
}
-int RGWMetadataLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl) {
+int RGWMetadataLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl, optional_yield y) {
if (!svc.zone->need_to_log_metadata())
return 0;
rgw_shard_name(prefix, cct->_conf->rgw_md_log_max_shards, hash_key, oid, &shard_id);
mark_modified(shard_id);
real_time now = real_clock::now();
- return svc.cls->timelog.add(dpp, oid, now, section, key, bl, null_yield);
+ return svc.cls->timelog.add(dpp, oid, now, section, key, bl, y);
}
int RGWMetadataLog::get_shard_id(const string& hash_key, int *shard_id)
int max_entries,
list<cls_log_entry>& entries,
string *last_marker,
- bool *truncated) {
+ bool *truncated,
+ optional_yield y) {
LogListCtx *ctx = static_cast<LogListCtx *>(handle);
if (!max_entries) {
std::string next_marker;
int ret = svc.cls->timelog.list(dpp, ctx->cur_oid, ctx->from_time, ctx->end_time,
max_entries, entries, ctx->marker,
- &next_marker, truncated, null_yield);
+ &next_marker, truncated, y);
if ((ret < 0) && (ret != -ENOENT))
return ret;
return 0;
}
-int RGWMetadataLog::get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info)
+int RGWMetadataLog::get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info, optional_yield y)
{
string oid;
get_shard_oid(shard_id, oid);
cls_log_header header;
- int ret = svc.cls->timelog.info(dpp, oid, &header, null_yield);
+ int ret = svc.cls->timelog.info(dpp, oid, &header, y);
if ((ret < 0) && (ret != -ENOENT))
return ret;
}
int RGWMetadataLog::trim(const DoutPrefixProvider *dpp, int shard_id, const real_time& from_time, const real_time& end_time,
- const string& start_marker, const string& end_marker)
+ const string& start_marker, const string& end_marker, optional_yield y)
{
string oid;
get_shard_oid(shard_id, oid);
return svc.cls->timelog.trim(dpp, oid, from_time, end_time, start_marker,
- end_marker, nullptr, null_yield);
+ end_marker, nullptr, y);
}
int RGWMetadataLog::lock_exclusive(const DoutPrefixProvider *dpp, int shard_id, timespan duration, string& zone_id, string& owner_id) {
meta_log.init_list_entries(shard_id, {}, {}, marker, &handle);
op_ret = meta_log.list_entries(this, handle, max_entries, entries,
- &last_marker, &truncated);
+ &last_marker, &truncated, y);
meta_log.complete_list_entries(handle);
}
}
RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone, static_cast<rgw::sal::RadosStore*>(driver)->svc()->cls, period};
- op_ret = meta_log.get_info(this, shard_id, &info);
+ op_ret = meta_log.get_info(this, shard_id, &info, y);
}
void RGWOp_MDLog_ShardInfo::send_response() {
}
RGWMetadataLog meta_log{s->cct, static_cast<rgw::sal::RadosStore*>(driver)->svc()->zone, static_cast<rgw::sal::RadosStore*>(driver)->svc()->cls, period};
- op_ret = meta_log.trim(this, shard_id, {}, {}, {}, marker);
+ op_ret = meta_log.trim(this, shard_id, {}, {}, {}, marker, y);
}
void RGWOp_MDLog_Lock::execute(optional_yield y) {
mdlog->init_list_entries(shard_id, from_time, end_time, marker, &handle);
- int ret = mdlog->list_entries(dpp, handle, max_entries, entries, &marker, &truncated);
+ int ret = mdlog->list_entries(dpp, handle, max_entries, entries, &marker, &truncated, null_yield);
mdlog->complete_list_entries(handle);
meta_log->init_list_entries(i, {}, {}, marker, &handle);
bool truncated;
do {
- int ret = meta_log->list_entries(dpp(), handle, 1000, entries, NULL, &truncated);
+ int ret = meta_log->list_entries(dpp(), handle, 1000, entries, NULL, &truncated, null_yield);
if (ret < 0) {
cerr << "ERROR: meta_log->list_entries(): " << cpp_strerror(-ret) << std::endl;
return -ret;
for (; i < g_ceph_context->_conf->rgw_md_log_max_shards; i++) {
RGWMetadataLogInfo info;
- meta_log->get_info(dpp(), i, &info);
+ meta_log->get_info(dpp(), i, &info, null_yield);
::encode_json("info", info, formatter.get());
// trim until -ENODATA
do {
- ret = meta_log->trim(dpp(), shard_id, {}, {}, {}, marker);
+ ret = meta_log->trim(dpp(), shard_id, {}, {}, {}, marker, null_yield);
} while (ret == 0);
if (ret < 0 && ret != -ENODATA) {
cerr << "ERROR: meta_log->trim(): " << cpp_strerror(-ret) << std::endl;
oid = prefix + buf;
}
- int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl);
+ int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl, optional_yield y);
int get_shard_id(const std::string& hash_key, int *shard_id);
int store_entries_in_shard(const DoutPrefixProvider *dpp, std::list<cls_log_entry>& entries, int shard_id, librados::AioCompletion *completion);
int max_entries,
std::list<cls_log_entry>& entries,
std::string *out_marker,
- bool *truncated);
+ bool *truncated,
+ optional_yield y);
- int trim(const DoutPrefixProvider *dpp, int shard_id, const real_time& from_time, const real_time& end_time, const std::string& start_marker, const std::string& end_marker);
- int get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info);
+ int trim(const DoutPrefixProvider *dpp, int shard_id, const real_time& from_time, const real_time& end_time, const std::string& start_marker, const std::string& end_marker, optional_yield y);
+ int get_info(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfo *info, optional_yield y);
int get_info_async(const DoutPrefixProvider *dpp, int shard_id, RGWMetadataLogInfoCompletion *completion);
int lock_exclusive(const DoutPrefixProvider *dpp, int shard_id, timespan duration, std::string&zone_id, std::string& owner_id);
int unlock(const DoutPrefixProvider *dpp, int shard_id, std::string& zone_id, std::string& owner_id);
return &insert.first->second;
}
-int RGWSI_MDLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl)
+int RGWSI_MDLog::add_entry(const DoutPrefixProvider *dpp, const string& hash_key, const string& section, const string& key, bufferlist& bl, optional_yield y)
{
ceph_assert(current_log); // must have called init()
- return current_log->add_entry(dpp, hash_key, section, key, bl);
+ return current_log->add_entry(dpp, hash_key, section, key, bl, y);
}
int RGWSI_MDLog::get_shard_id(const string& hash_key, int *shard_id)
RGWObjVersionTracker *objv_tracker,
optional_yield y, bool exclusive = false);
- int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl);
+ int add_entry(const DoutPrefixProvider *dpp, const std::string& hash_key, const std::string& section, const std::string& key, bufferlist& bl, optional_yield y);
int get_shard_id(const std::string& hash_key, int *shard_id);
bufferlist logbl;
encode(log_data, logbl);
- ret = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl);
+ ret = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl, y);
if (ret < 0)
return ret;
bufferlist logbl;
encode(log_data, logbl);
- int r = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl);
+ int r = mdlog_svc->add_entry(dpp, ctx->module->get_hash_key(key), ctx->module->get_section(), key, logbl, y);
if (ret < 0)
return ret;