]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw/gc: fixing the condition when marker for a queue is 37846/head
authorPritha Srivastava <prsrivas@redhat.com>
Wed, 14 Oct 2020 11:05:50 +0000 (16:35 +0530)
committerNathan Cutler <ncutler@suse.com>
Tue, 27 Oct 2020 08:54:09 +0000 (09:54 +0100)
always reset to empty which causes RGWGC::list to get stuck in
a loop, which ultimately is broken out of when the queue's truncated
flag is false.

1. Check for entries size also while evaluating whether objects cache for
a gc object should be marked as 'transitioned' in case of cls_rgw_gc_list.
When there are no entries, we get back a return value of 0, and the
object cache is not marked as 'transitioned'.

2. Also for the last gc object, we need to check whether the queue is still
under process and set the correct flag.

Missing the two conditions above causes the GC::list to loop continously
over the same gc object.

Fixes: https://tracker.ceph.com/issues/47909
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
(cherry picked from commit bf3f3ba675d092f48e403826fc0813e23c07045d)

src/rgw/rgw_gc.cc

index 98be34bf4c282148ace13a45ca92d05b8b76ce82..2a5a3a8bbb81f05c7c356b4343a6b3cd90c011d1 100644 (file)
@@ -208,7 +208,7 @@ int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std
       }
       obj_version objv;
       cls_version_read(store->gc_pool_ctx, obj_names[*index], &objv);
-      if (ret == -ENOENT) {
+      if (ret == -ENOENT || entries.size() == 0) {
         if (objv.ver == 0) {
           continue;
         } else {
@@ -252,6 +252,11 @@ int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std
     marker = next_marker;
 
     if (*index == max_objs - 1) {
+      if (queue_entries.size() > 0 && *truncated) {
+        processing_queue = true;
+      } else {
+        processing_queue = false;
+      }
       /* we cut short here, truncated will hold the correct value */
       return 0;
     }
@@ -537,13 +542,13 @@ int RGWGC::process(int index, int max_secs, bool expired_only,
         if (non_expired_entries.size() == 0) {
           transitioned_objects_cache[index] = true;
           marker.clear();
-          ldpp_dout(this, 20) << "RGWGC::process cls_rgw_gc_list returned ENOENT for non expired entries, so setting cache entry to TRUE" << dendl;
+          ldpp_dout(this, 20) << "RGWGC::process cls_rgw_gc_list returned NO non expired entries, so setting cache entry to TRUE" << dendl;
         } else {
           ret = 0;
           goto done;
         }
       }
-      if ((objv.ver == 0) && (ret == -ENOENT)) {
+      if ((objv.ver == 0) && (ret == -ENOENT || entries.size() == 0)) {
         ret = 0;
         goto done;
       }