diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/rgw/rgw_json_enc.cc | 2 | ||||
-rw-r--r-- | src/rgw/rgw_main.cc | 2 | ||||
-rw-r--r-- | src/rgw/rgw_metadata.cc | 63 | ||||
-rw-r--r-- | src/rgw/rgw_metadata.h | 5 | ||||
-rw-r--r-- | src/rgw/rgw_rados.cc | 1 | ||||
-rw-r--r-- | src/rgw/rgw_rados.h | 8 |
6 files changed, 77 insertions, 4 deletions
diff --git a/src/rgw/rgw_json_enc.cc b/src/rgw/rgw_json_enc.cc index 3e6a031b3ed..d16238fda5a 100644 --- a/src/rgw/rgw_json_enc.cc +++ b/src/rgw/rgw_json_enc.cc @@ -701,6 +701,7 @@ void rgw_obj::dump(Formatter *f) const void RGWZoneParams::dump(Formatter *f) const { encode_json("domain_root", domain_root.data_pool, f); + encode_json("metadata_heap", metadata_heap.data_pool, f); encode_json("control_pool", control_pool.data_pool, f); encode_json("gc_pool", gc_pool.data_pool, f); encode_json("log_pool", log_pool.data_pool, f); @@ -741,6 +742,7 @@ void RGWZonePlacementInfo::decode_json(JSONObj *obj) void RGWZoneParams::decode_json(JSONObj *obj) { ::decode_json("domain_root", domain_root, obj); + ::decode_json("metadata_heap", metadata_heap, obj); ::decode_json("control_pool", control_pool, obj); ::decode_json("gc_pool", gc_pool, obj); ::decode_json("log_pool", log_pool, obj); diff --git a/src/rgw/rgw_main.cc b/src/rgw/rgw_main.cc index 6666ef267a3..ee26c55e703 100644 --- a/src/rgw/rgw_main.cc +++ b/src/rgw/rgw_main.cc @@ -716,8 +716,6 @@ void RGWFCGXProcess::handle_request(RGWRequest *r) dout(20) << "process_request() returned " << ret << dendl; } - FCGX_Finish_r(fcgx); - delete req; } diff --git a/src/rgw/rgw_metadata.cc b/src/rgw/rgw_metadata.cc index a646ee17d10..af1ffbe6c1b 100644 --- a/src/rgw/rgw_metadata.cc +++ b/src/rgw/rgw_metadata.cc @@ -564,6 +564,56 @@ int RGWMetadataManager::post_modify(RGWMetadataHandler *handler, const string& s return 0; } +string RGWMetadataManager::heap_oid(RGWMetadataHandler *handler, const string& key, const obj_version& objv) +{ + char buf[objv.tag.size() + 32]; + snprintf(buf, sizeof(buf), "%s:%lld", objv.tag.c_str(), (long long)objv.ver); + return string(".meta:") + handler->get_type() + ":" + key + ":" + buf; +} + +int RGWMetadataManager::store_in_heap(RGWMetadataHandler *handler, const string& key, bufferlist& bl, + RGWObjVersionTracker *objv_tracker, time_t mtime, + map<string, bufferlist> *pattrs) +{ + if (!objv_tracker) { + return -EINVAL; + } + + rgw_bucket heap_pool(store->zone.metadata_heap); + + RGWObjVersionTracker otracker; + otracker.write_version = objv_tracker->write_version; + string oid = heap_oid(handler, key, objv_tracker->write_version); + int ret = rgw_put_system_obj(store, heap_pool, oid, + bl.c_str(), bl.length(), false, + &otracker, mtime, pattrs); + if (ret < 0) { + ldout(store->ctx(), 0) << "ERROR: rgw_put_system_obj() oid=" << oid << ") returned ret=" << ret << dendl; + return ret; + } + + return 0; +} + +int RGWMetadataManager::remove_from_heap(RGWMetadataHandler *handler, const string& key, RGWObjVersionTracker *objv_tracker) +{ + if (!objv_tracker) { + return -EINVAL; + } + + rgw_bucket heap_pool(store->zone.metadata_heap); + + string oid = heap_oid(handler, key, objv_tracker->write_version); + rgw_obj obj(heap_pool, oid); + int ret = store->delete_system_obj(obj); + if (ret < 0) { + ldout(store->ctx(), 0) << "ERROR: store->delete_system_obj()=" << oid << ") returned ret=" << ret << dendl; + return ret; + } + + return 0; +} + int RGWMetadataManager::put_entry(RGWMetadataHandler *handler, const string& key, bufferlist& bl, bool exclusive, RGWObjVersionTracker *objv_tracker, time_t mtime, map<string, bufferlist> *pattrs) { @@ -578,9 +628,22 @@ int RGWMetadataManager::put_entry(RGWMetadataHandler *handler, const string& key handler->get_pool_and_oid(store, key, bucket, oid); + ret = store_in_heap(handler, key, bl, objv_tracker, mtime, pattrs); + if (ret < 0) { + ldout(store->ctx(), 0) << "ERROR: " << __func__ << ": store_in_heap() key=" << key << " returned ret=" << ret << dendl; + goto done; + } + ret = rgw_put_system_obj(store, bucket, oid, bl.c_str(), bl.length(), exclusive, objv_tracker, mtime, pattrs); + if (ret < 0) { + int r = remove_from_heap(handler, key, objv_tracker); + if (r < 0) { + ldout(store->ctx(), 0) << "ERROR: " << __func__ << ": remove_from_heap() key=" << key << " returned ret=" << r << dendl; + } + } +done: /* cascading ret into post_modify() */ ret = post_modify(handler, section, key, log_data, objv_tracker, ret); diff --git a/src/rgw/rgw_metadata.h b/src/rgw/rgw_metadata.h index bb77e6561b2..5dc20bd7a6a 100644 --- a/src/rgw/rgw_metadata.h +++ b/src/rgw/rgw_metadata.h @@ -195,6 +195,11 @@ class RGWMetadataManager { int post_modify(RGWMetadataHandler *handler, const string& section, const string& key, RGWMetadataLogData& log_data, RGWObjVersionTracker *objv_tracker, int ret); + string heap_oid(RGWMetadataHandler *handler, const string& key, const obj_version& objv); + int store_in_heap(RGWMetadataHandler *handler, const string& key, bufferlist& bl, + RGWObjVersionTracker *objv_tracker, time_t mtime, + map<string, bufferlist> *pattrs); + int remove_from_heap(RGWMetadataHandler *handler, const string& key, RGWObjVersionTracker *objv_tracker); public: RGWMetadataManager(CephContext *_cct, RGWRados *_store); ~RGWMetadataManager(); diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 97203693336..852d4e92b39 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -307,6 +307,7 @@ int RGWRegion::equals(const string& other_region) void RGWZoneParams::init_default(RGWRados *store) { domain_root = "rgw.data.root"; + metadata_heap = "rgw.meta"; control_pool = "rgw.control"; gc_pool = "rgw.gc"; log_pool = "rgw.log"; diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 10da09a519c..30a7772a7ab 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -729,6 +729,7 @@ WRITE_CLASS_ENCODER(RGWZonePlacementInfo) struct RGWZoneParams { rgw_bucket domain_root; + rgw_bucket metadata_heap; rgw_bucket control_pool; rgw_bucket gc_pool; rgw_bucket log_pool; @@ -756,7 +757,7 @@ struct RGWZoneParams { int store_info(CephContext *cct, RGWRados *store, RGWRegion& region); void encode(bufferlist& bl) const { - ENCODE_START(4, 1, bl); + ENCODE_START(5, 1, bl); ::encode(domain_root, bl); ::encode(control_pool, bl); ::encode(gc_pool, bl); @@ -770,11 +771,12 @@ struct RGWZoneParams { ::encode(name, bl); ::encode(system_key, bl); ::encode(placement_pools, bl); + ::encode(metadata_heap, bl); ENCODE_FINISH(bl); } void decode(bufferlist::iterator& bl) { - DECODE_START(4, bl); + DECODE_START(5, bl); ::decode(domain_root, bl); ::decode(control_pool, bl); ::decode(gc_pool, bl); @@ -791,6 +793,8 @@ struct RGWZoneParams { ::decode(system_key, bl); if (struct_v >= 4) ::decode(placement_pools, bl); + if (struct_v >= 5) + ::decode(metadata_heap, bl); DECODE_FINISH(bl); } void dump(Formatter *f) const; |