Created
November 16, 2017 08:23
-
-
Save liuchang0812/b6bfe85037039248fc4fa96116d3c796 to your computer and use it in GitHub Desktop.
S3RESTConn Patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/rgw/rgw_rest_conn.cc b/src/rgw/rgw_rest_conn.cc | |
index 7fdf5ff..3c86d05 100644 | |
--- a/src/rgw/rgw_rest_conn.cc | |
+++ b/src/rgw/rgw_rest_conn.cc | |
@@ -81,7 +81,7 @@ string RGWRESTConn::get_url() | |
return endpoint; | |
} | |
-static void populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup) | |
+void RGWRESTConn::populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup) | |
{ | |
if (uid) { | |
string uid_str = uid->to_str(); | |
@@ -371,7 +371,7 @@ RGWRESTReadResource::RGWRESTReadResource(RGWRESTConn *_conn, | |
void RGWRESTReadResource::init_common(param_vec_t *extra_headers) | |
{ | |
- populate_params(params, nullptr, conn->get_self_zonegroup()); | |
+ conn->populate_params(params, nullptr, conn->get_self_zonegroup()); | |
if (extra_headers) { | |
headers.insert(extra_headers->begin(), extra_headers->end()); | |
@@ -431,7 +431,7 @@ RGWRESTSendResource::RGWRESTSendResource(RGWRESTConn *_conn, | |
void RGWRESTSendResource::init_common(param_vec_t *extra_headers) | |
{ | |
- populate_params(params, nullptr, conn->get_self_zonegroup()); | |
+ conn->populate_params(params, nullptr, conn->get_self_zonegroup()); | |
if (extra_headers) { | |
headers.insert(extra_headers->begin(), extra_headers->end()); | |
diff --git a/src/rgw/rgw_rest_conn.h b/src/rgw/rgw_rest_conn.h | |
index aa91c65..68b2331 100644 | |
--- a/src/rgw/rgw_rest_conn.h | |
+++ b/src/rgw/rgw_rest_conn.h | |
@@ -90,6 +90,8 @@ public: | |
} | |
size_t get_endpoint_count() const { return endpoints.size(); } | |
+ virtual void populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup); | |
+ | |
/* sync request */ | |
int forward(const rgw_user& uid, req_info& info, obj_version *objv, size_t max_response, bufferlist *inbl, bufferlist *outbl); | |
@@ -149,6 +151,25 @@ public: | |
int get_json_resource(const string& resource, const rgw_http_param_pair *pp, T& t); | |
}; | |
+class S3RESTConn : public RGWRESTConn { | |
+ | |
+public: | |
+ | |
+ S3RESTConn(CephContext *_cct, RGWRados *store, const string& _remote_id, const list<string>& endpoints) : | |
+ RGWRESTConn(_cct, store, _remote_id, endpoints) { | |
+ } | |
+ | |
+ S3RESTConn(CephContext *_cct, RGWRados *store, const string& _remote_id, const list<string>& endpoints, RGWAccessKey _cred): | |
+ RGWRESTConn(_cct, store, _remote_id, endpoints, _cred) { | |
+ } | |
+ | |
+ | |
+ void populate_params(param_vec_t& params, const rgw_user *uid, const string& zonegroup) override { | |
+ // do not populate any params in S3 REST Connection. | |
+ return; | |
+ } | |
+}; | |
+ | |
template<class T> | |
int RGWRESTConn::get_json_resource(const string& resource, param_vec_t *params, bufferlist *in_data, T& t) | |
diff --git a/src/rgw/rgw_sync_module_aws.cc b/src/rgw/rgw_sync_module_aws.cc | |
index 55010c3..2c53be9 100644 | |
--- a/src/rgw/rgw_sync_module_aws.cc | |
+++ b/src/rgw/rgw_sync_module_aws.cc | |
@@ -788,7 +788,6 @@ public: | |
obj_path = bucket_info.bucket.name + "/" + key.name; | |
target_bucket_name = aws_bucket_name(bucket_info); | |
- /* | |
if (bucket_created.find(target_bucket_name) == bucket_created.end()){ | |
yield { | |
@@ -806,7 +805,6 @@ public: | |
bucket_created[target_bucket_name] = true; | |
} | |
- */ | |
ldout(sync_env->cct,0) << "DEBUGLC: start to upload object" << dendl; | |
@@ -912,7 +910,7 @@ public: | |
void init(RGWDataSyncEnv *sync_env, uint64_t instance_id) { | |
conf.id = string("s3:") + s3_endpoint; | |
- conf.conn.reset(new RGWRESTConn(cct, | |
+ conf.conn.reset(new S3RESTConn(cct, | |
sync_env->store, | |
conf.id, | |
{ s3_endpoint }, | |
diff --git a/src/rocksdb b/src/rocksdb | |
index 382277d..8dd0a7e 160000 | |
--- a/src/rocksdb | |
+++ b/src/rocksdb | |
@@ -1 +1 @@ | |
-Subproject commit 382277d0fe79ece86b799e3925919cf44c3afb4c | |
+Subproject commit 8dd0a7e11abad6bc32e59a5cba8769961e085312 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment