]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: splice cr drains writes
authorYehuda Sadeh <yehuda@redhat.com>
Mon, 2 Oct 2017 21:22:30 +0000 (14:22 -0700)
committerYehuda Sadeh <yehuda@redhat.com>
Tue, 10 Apr 2018 15:05:38 +0000 (08:05 -0700)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/rgw/rgw_cr_rest.cc
src/rgw/rgw_cr_rest.h

index 116857f520c98d2c2a94f1383b7cf85962ab57b3..5a5c8e944f2cd1cd972ba1517d5ef9905a11b017 100644 (file)
@@ -207,13 +207,6 @@ int TestSpliceCR::operate() {
       }
     }
 
-    {
-      int ret = out_crf->init();
-      if (ret < 0) {
-        return set_cr_error(ret);
-      }
-    }
-
     do {
 
       bl.clear();
@@ -227,7 +220,7 @@ int TestSpliceCR::operate() {
         }
 
         if (retcode < 0) {
-          ldout(20) << __func__ << ": in_crf->read() retcode=" << retcode << dendl;
+          ldout(cct, 20) << __func__ << ": in_crf->read() retcode=" << retcode << dendl;
           return set_cr_error(ret);
         }
       } while (need_retry);
@@ -238,6 +231,24 @@ int TestSpliceCR::operate() {
         break;
       }
 
+      if (total_read == 0) {
+#warning need to lock in_req->headers
+        for (auto h : in_req->get_out_headers()) {
+          if (h.first == "CONTENT_LENGTH") {
+            out_req->set_send_length(atoi(h.second.c_str()));
+          } else {
+            out_req->append_header(h.first, h.second);
+          }
+        }
+        int ret = out_crf->init();
+        if (ret < 0) {
+          return set_cr_error(ret);
+        }
+dout(0) << __FILE__ << ":" << __LINE__ << ": headers=" << in_req->get_out_headers() << dendl;
+      }
+
+      total_read += bl.length();
+
       yield {
         ret = out_crf->write(bl);
         if (ret < 0)  {
@@ -246,7 +257,7 @@ int TestSpliceCR::operate() {
       }
 
       if (retcode < 0) {
-        ldout(20) << __func__ << ": out_crf->write() retcode=" << retcode << dendl;
+        ldout(cct, 20) << __func__ << ": out_crf->write() retcode=" << retcode << dendl;
         return set_cr_error(ret);
       }
 
index be50387039c4de3053616aacabf9636fc24d5f8e..bc430b96de475987c30e81348a15ddeecc4025d4 100644 (file)
@@ -365,6 +365,7 @@ class TestSpliceCR : public RGWCoroutine {
   RGWStreamRWHTTPResourceCRF *out_crf{nullptr};
   bufferlist bl;
   bool need_retry{false};
+  uint64_t total_read{0};
   int ret{0};
 public:
   TestSpliceCR(CephContext *_cct, RGWHTTPManager *_mgr,