]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/rgw/rgw_sync.cc
update source to Ceph Pacific 16.2.2
[ceph.git] / ceph / src / rgw / rgw_sync.cc
index c8cedfc4afa3d62f2c71e150a020cea1d31ceb5b..a934a2e28a50d52a0dac8a5688ba3171749677ed 100644 (file)
@@ -12,7 +12,6 @@
 #include "common/errno.h"
 
 #include "rgw_common.h"
-#include "rgw_rados.h"
 #include "rgw_zone.h"
 #include "rgw_sync.h"
 #include "rgw_metadata.h"
@@ -245,7 +244,7 @@ int RGWRemoteMetaLog::read_log_info(rgw_mdlog_info *log_info)
   rgw_http_param_pair pairs[] = { { "type", "metadata" },
                                   { NULL, NULL } };
 
-  int ret = conn->get_json_resource("/admin/log", pairs, *log_info);
+  int ret = conn->get_json_resource("/admin/log", pairs, null_yield, *log_info);
   if (ret < 0) {
     ldpp_dout(dpp, 0) << "ERROR: failed to fetch mdlog info" << dendl;
     return ret;
@@ -1047,10 +1046,12 @@ public:
     RGWRESTConn *conn = sync_env->conn;
     reenter(this) {
       yield {
+        string key_encode;
+        url_encode(key, key_encode);
         rgw_http_param_pair pairs[] = { { "key" , key.c_str()},
                                        { NULL, NULL } };
 
-        string p = string("/admin/metadata/") + section + "/" + key;
+        string p = string("/admin/metadata/") + section + "/" + key_encode;
 
         http_op = new RGWRESTReadResource(conn, p, pairs, NULL, sync_env->http_manager);
 
@@ -1085,7 +1086,7 @@ class RGWAsyncMetaStoreEntry : public RGWAsyncRadosRequest {
   bufferlist bl;
 protected:
   int _send_request() override {
-    int ret = store->ctl()->meta.mgr->put(raw_key, bl, null_yield, RGWMDLogSyncType::APPLY_ALWAYS);
+    int ret = store->ctl()->meta.mgr->put(raw_key, bl, null_yield, RGWMDLogSyncType::APPLY_ALWAYS, true);
     if (ret < 0) {
       ldout(store->ctx(), 0) << "ERROR: can't store key: " << raw_key << " ret=" << ret << dendl;
       return ret;
@@ -2087,7 +2088,8 @@ int RGWRemoteMetaLog::store_sync_info(const rgw_meta_sync_info& sync_info)
 
 // return a cursor to the period at our sync position
 static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
-                                              const rgw_meta_sync_info& info)
+                                              const rgw_meta_sync_info& info,
+                                             optional_yield y)
 {
   if (info.period.empty()) {
     // return an empty cursor with error=0
@@ -2110,14 +2112,14 @@ static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
 
   // read the period from rados or pull it from the master
   RGWPeriod period;
-  int r = store->svc()->mdlog->pull_period(info.period, period);
+  int r = store->svc()->mdlog->pull_period(info.period, period, y);
   if (r < 0) {
     lderr(store->ctx()) << "ERROR: failed to read period id "
         << info.period << ": " << cpp_strerror(r) << dendl;
     return RGWPeriodHistory::Cursor{r};
   }
   // attach the period to our history
-  cursor = store->svc()->mdlog->get_period_history()->attach(std::move(period));
+  cursor = store->svc()->mdlog->get_period_history()->attach(std::move(period), y);
   if (!cursor) {
     r = cursor.get_error();
     lderr(store->ctx()) << "ERROR: failed to read period history back to "
@@ -2126,7 +2128,7 @@ static RGWPeriodHistory::Cursor get_period_at(rgw::sal::RGWRadosStore* store,
   return cursor;
 }
 
-int RGWRemoteMetaLog::run_sync()
+int RGWRemoteMetaLog::run_sync(optional_yield y)
 {
   if (store->svc()->zone->is_meta_master()) {
     return 0;
@@ -2248,7 +2250,7 @@ int RGWRemoteMetaLog::run_sync()
       case rgw_meta_sync_info::StateSync:
         tn->log(20, "sync");
         // find our position in the period history (if any)
-        cursor = get_period_at(store, sync_status.sync_info);
+        cursor = get_period_at(store, sync_status.sync_info, y);
         r = cursor.get_error();
         if (r < 0) {
           return r;