From 881cb988747b11c0b3b2803555299cfab107ccf8 Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 29 Aug 2016 11:18:43 -0700 Subject: [PATCH] rgw: index metadata in elasticsearch using realm name for path Signed-off-by: Yehuda Sadeh --- src/rgw/rgw_rados.h | 4 ++++ src/rgw/rgw_sync_module_es.cc | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index 7cb8f667db3..b2092a160ac 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -2024,6 +2024,10 @@ public: return ret; } + RGWRealm& get_realm() { + return realm; + } + RGWZoneParams& get_zone_params() { return zone_params; } RGWZoneGroup& get_zonegroup() { return zonegroup; diff --git a/src/rgw/rgw_sync_module_es.cc b/src/rgw/rgw_sync_module_es.cc index 7e7708b22c6..afecf7224f5 100644 --- a/src/rgw/rgw_sync_module_es.cc +++ b/src/rgw/rgw_sync_module_es.cc @@ -14,9 +14,9 @@ struct ElasticConfig { RGWRESTConn *conn{nullptr}; }; -static string es_get_obj_path(const RGWBucketInfo& bucket_info, const rgw_obj_key& key) +static string es_get_obj_path(const RGWRealm& realm, const RGWBucketInfo& bucket_info, const rgw_obj_key& key) { - string path = "/rgw/object/" + bucket_info.bucket.bucket_id + ":" + key.name + ":" + key.instance; + string path = "/rgw-" + realm.get_name() + "/object/" + bucket_info.bucket.bucket_id + ":" + key.name + ":" + key.instance; return path; } @@ -123,7 +123,7 @@ public: << " b=" << bucket_info.bucket << " k=" << key << " size=" << size << " mtime=" << mtime << " attrs=" << attrs << dendl; yield { - string path = es_get_obj_path(bucket_info, key); + string path = es_get_obj_path(sync_env->store->get_realm(), bucket_info, key); es_obj_metadata doc(sync_env->cct, bucket_info, key, mtime, size, attrs); call(new RGWPutRESTResourceCR(sync_env->cct, conf.conn, @@ -175,7 +175,7 @@ public: ldout(sync_env->cct, 0) << ": remove remote obj: z=" << sync_env->source_zone << " b=" << bucket_info.bucket << " k=" << key << " mtime=" << mtime << dendl; yield { - string path = es_get_obj_path(bucket_info, key); + string path = es_get_obj_path(sync_env->store->get_realm(), bucket_info, key); call(new RGWDeleteRESTResourceCR(sync_env->cct, conf.conn, sync_env->http_manager, -- 2.47.3