]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix bad memory usage of bucket chown method 45491/head
authorMohammad Fatemipour <mohammad.fatemipour@sotoon.ir>
Sun, 19 Dec 2021 18:33:55 +0000 (22:03 +0330)
committerCory Snyder <csnyder@iland.com>
Thu, 17 Mar 2022 13:28:03 +0000 (09:28 -0400)
In RGWBucketCtl::chown we have one RGWObjectCtx for all objects of a bucket.
In RGWObjectCtx there is a cache mechanism (std::map) for states of objects that will grows
continuously. for buckets with millions of objects this mechanism leads to huge memory usage.

in chown process we really do not need this caching mechanism so we could create one RGWObjectCtx
for every 1000 objects to limit usage of memory.

Fixes: https://tracker.ceph.com/issues/53599
Signed-off-by: Mohammad Fatemipour <mohammad.fatemipour@sotoon.ir>
(cherry picked from commit cf2d83ef81458524715c23e802977dc0760c847f)

Conflicts:
src/rgw/rgw_bucket.cc

Cherry-pick notes:
- Conflicts due to Pacific impementation differences in RGWBucketCtl::chown

src/rgw/rgw_bucket.cc

index 26e30cc023c792cd317da8abaa920c0f6e762403..89cc597730cb8ef382e4e3a3539d4f1acf56d6b4 100644 (file)
@@ -3186,7 +3186,6 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in
                         const rgw_user& user_id, const std::string& display_name,
                         const std::string& marker, optional_yield y, const DoutPrefixProvider *dpp)
 {
-  RGWObjectCtx obj_ctx(store);
   std::vector<rgw_bucket_dir_entry> objs;
   map<string, bool> common_prefixes;
 
@@ -3204,6 +3203,7 @@ int RGWBucketCtl::chown(rgw::sal::RGWRadosStore *store, RGWBucketInfo& bucket_in
   //Loop through objects and update object acls to point to bucket owner
 
   do {
+    RGWObjectCtx obj_ctx(store);
     objs.clear();
     int ret = list_op.list_objects(dpp, max_entries, &objs, &common_prefixes, &is_truncated, y);
     if (ret < 0) {