diff options
author | Yehuda Sadeh <yehuda@inktank.com> | 2013-07-26 18:15:32 -0700 |
---|---|---|
committer | Yehuda Sadeh <yehuda@inktank.com> | 2013-07-29 10:54:02 -0700 |
commit | fa177338bbacd5fa4267855e406b8190c2dbdc87 (patch) | |
tree | ad85ee31dbfb683fc4b0c5575d43a93f790af254 | |
parent | 6ac8aed040049358aaf8aee5cfb16791c4bb54a2 (diff) | |
download | ceph-fa177338bbacd5fa4267855e406b8190c2dbdc87.tar.gz |
rgw: keep a region connection mapwip-5793
Fixes: #5793
Beforehand all remote copies were going to the master region
which was awfully wrong.
Signed-off-by: Yehuda Sadeh <yehuda@inktank.com>
-rw-r--r-- | src/rgw/rgw_rados.cc | 23 | ||||
-rw-r--r-- | src/rgw/rgw_rados.h | 1 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/rgw/rgw_rados.cc b/src/rgw/rgw_rados.cc index 8af03b03a8f..b928c6911cc 100644 --- a/src/rgw/rgw_rados.cc +++ b/src/rgw/rgw_rados.cc @@ -831,6 +831,11 @@ void RGWRados::finalize() RGWRESTConn *conn = iter->second; delete conn; } + + for (iter = region_conn_map.begin(); iter != region_conn_map.end(); ++iter) { + RGWRESTConn *conn = iter->second; + delete conn; + } } /** @@ -896,6 +901,12 @@ int RGWRados::init_complete() } RGWRegion& region = iter->second; rest_master_conn = new RGWRESTConn(cct, this, region.endpoints); + + for (iter = region_map.regions.begin(); iter != region_map.regions.end(); ++iter) { + RGWRegion& region = iter->second; + + region_conn_map[region.name] = new RGWRESTConn(cct, this, region.endpoints); + } } map<string, RGWZone>::iterator ziter; @@ -2535,7 +2546,17 @@ int RGWRados::copy_obj(void *ctx, RGWRESTConn *conn; if (source_zone.empty()) { - conn = rest_master_conn; + if (dest_bucket_info.region.empty()) { + /* source is in the master region */ + conn = rest_master_conn; + } else { + map<string, RGWRESTConn *>::iterator iter = region_conn_map.find(src_bucket_info.region); + if (iter == zone_conn_map.end()) { + ldout(cct, 0) << "could not find region connection to region: " << source_zone << dendl; + return -ENOENT; + } + conn = iter->second; + } } else { map<string, RGWRESTConn *>::iterator iter = zone_conn_map.find(source_zone); if (iter == zone_conn_map.end()) { diff --git a/src/rgw/rgw_rados.h b/src/rgw/rgw_rados.h index bcc40900299..72efce305ba 100644 --- a/src/rgw/rgw_rados.h +++ b/src/rgw/rgw_rados.h @@ -888,6 +888,7 @@ public: RGWRegionMap region_map; RGWRESTConn *rest_master_conn; map<string, RGWRESTConn *> zone_conn_map; + map<string, RGWRESTConn *> region_conn_map; RGWMetadataManager *meta_mgr; |