From: Or Friedmann Date: Sun, 8 Mar 2020 13:34:48 +0000 (+0200) Subject: rgw: Disable prefetch of entire head object when GET request with range header X-Git-Tag: v14.2.17~103^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=64077272bc3daa71da9a79985c83f28a38612ba6;p=ceph.git rgw: Disable prefetch of entire head object when GET request with range header Disable prefetch of entire head object when GET request with range header. The current behavior for the RGW is getting the whole object although the client asked only for a small bytes offset. For example: If the client asked for bytes=0-1, The RGW will anyway fetch 0-4194304 Fixes: https://tracker.ceph.com/issues/44508 Signed-off-by: Or Friedmann (cherry picked from commit 2be5af0006169cb54547034aa98b7eacb8751d59) --- diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 9ca7e1cfb82..2600f0ffef5 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -1948,22 +1948,14 @@ bool RGWGetObj::prefetch_data() return false; } - bool prefetch_first_chunk = true; range_str = s->info.env->get("HTTP_RANGE"); - + // TODO: add range prefetch if (range_str) { - int r = parse_range(); - /* error on parsing the range, stop prefetch and will fail in execute() */ - if (r < 0) { - return false; /* range_parsed==false */ - } - /* range get goes to shadow objects, stop prefetch */ - if (ofs >= s->cct->_conf->rgw_max_chunk_size) { - prefetch_first_chunk = false; - } + parse_range(); + return false; } - return get_data && prefetch_first_chunk; + return get_data; } void RGWGetObj::pre_exec()