From: Yehuda Sadeh Date: Mon, 2 Oct 2017 21:22:30 +0000 (-0700) Subject: rgw: splice cr drains writes X-Git-Tag: v13.1.0~270^2~89 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=76154bd156c9609d0508f12ed15cf164b1320438;p=ceph.git rgw: splice cr drains writes Signed-off-by: Yehuda Sadeh --- diff --git a/src/rgw/rgw_cr_rest.cc b/src/rgw/rgw_cr_rest.cc index 116857f520c..5a5c8e944f2 100644 --- a/src/rgw/rgw_cr_rest.cc +++ b/src/rgw/rgw_cr_rest.cc @@ -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); } diff --git a/src/rgw/rgw_cr_rest.h b/src/rgw/rgw_cr_rest.h index be50387039c..bc430b96de4 100644 --- a/src/rgw/rgw_cr_rest.h +++ b/src/rgw/rgw_cr_rest.h @@ -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,