]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw-admin: support for processing all gc objects including unexpired.
authorYao Zongyou <yaozongyou@vip.qq.com>
Tue, 5 Sep 2017 09:33:04 +0000 (17:33 +0800)
committerJesse Williamson <nerd.cpp@gmail.com>
Thu, 11 Jul 2019 17:32:58 +0000 (10:32 -0700)
Signed-off-by: Yao Zongyou <yaozongyou@vip.qq.com>
(cherry picked from commit ceccb54f191182813cae70841e87b9969c3d4aeb)

src/rgw/rgw_admin.cc
src/rgw/rgw_gc.cc
src/rgw/rgw_gc.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/test/cli/radosgw-admin/help.t

index 2209169c0f412a0a46bffe7ec239dc2b7a7b02ff..7f93bb3ac825c907fbde20ba2c6fa1ff7440cab4 100644 (file)
@@ -161,7 +161,8 @@ void usage()
   cout << "  usage trim                 trim usage (by user, date range)\n";
   cout << "  gc list                    dump expired garbage collection objects (specify\n";
   cout << "                             --include-all to list all entries, including unexpired)\n";
-  cout << "  gc process                 manually process garbage\n";
+  cout << "  gc process                 manually process garbage (specify\n";
+  cout << "                             --include-all to process all entries, including unexpired)\n";
   cout << "  lc list                    list all bucket lifecycle progress\n";
   cout << "  lc process                 manually process lifecycle\n";
   cout << "  metadata get               get metadata info\n";
@@ -6245,7 +6246,7 @@ next:
   }
 
   if (opt_cmd == OPT_GC_PROCESS) {
-    int ret = store->process_gc();
+    int ret = store->process_gc(!include_all);
     if (ret < 0) {
       cerr << "ERROR: gc processing returned error: " << cpp_strerror(-ret) << std::endl;
       return 1;
index 1abd8d798da7ad09c292cf1b1cd0f48dd72457f6..cf65e56c2ad9ab4a24250587412d2370dea1b9d1 100644 (file)
@@ -128,7 +128,7 @@ int RGWGC::list(int *index, string& marker, uint32_t max, bool expired_only, std
   return 0;
 }
 
-int RGWGC::process(int index, int max_secs)
+int RGWGC::process(int index, int max_secs, bool expired_only)
 {
   rados::cls::lock::Lock l(gc_index_lock_name);
   utime_t end = ceph_clock_now();
@@ -160,7 +160,7 @@ int RGWGC::process(int index, int max_secs)
   do {
     int max = 100;
     std::list<cls_rgw_gc_obj_info> entries;
-    ret = cls_rgw_gc_list(store->gc_pool_ctx, obj_names[index], marker, max, true, entries, &truncated, next_marker);
+    ret = cls_rgw_gc_list(store->gc_pool_ctx, obj_names[index], marker, max, expired_only, entries, &truncated, next_marker);
     if (ret == -ENOENT) {
       ret = 0;
       goto done;
@@ -237,7 +237,7 @@ done:
   return 0;
 }
 
-int RGWGC::process()
+int RGWGC::process(bool expired_only)
 {
   int max_secs = cct->_conf->rgw_gc_processor_max_time;
 
@@ -248,7 +248,7 @@ int RGWGC::process()
 
   for (int i = 0; i < max_objs; i++) {
     int index = (i + start) % max_objs;
-    ret = process(index, max_secs);
+    int ret = process(index, max_secs, expired_only);
     if (ret < 0)
       return ret;
   }
@@ -282,7 +282,7 @@ void *RGWGC::GCWorker::entry() {
   do {
     utime_t start = ceph_clock_now();
     dout(2) << "garbage collection: start" << dendl;
-    int r = gc->process();
+    int r = gc->process(true);
     if (r < 0) {
       dout(0) << "ERROR: garbage collection process() returned error r=" << r << dendl;
     }
index 491796b50e86d6dc1d876a3c173873f3274854dd..bab44b7fd34c9778e3e26542690e5d45a8fbe41c 100644 (file)
@@ -55,8 +55,8 @@ public:
 
   int list(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated);
   void list_init(int *index) { *index = 0; }
-  int process(int index, int process_max_secs);
-  int process();
+  int process(int index, int process_max_secs, bool expired_only);
+  int process(bool expired_only);
 
   bool going_down();
   void start_processor();
index 1eef4e53b6e932b5e47108ebfc0168846ec907cf..e578d7141fdb1f96b1eac662663d0b0465d755a1 100644 (file)
@@ -13212,9 +13212,9 @@ int RGWRados::list_gc_objs(int *index, string& marker, uint32_t max, bool expire
   return gc->list(index, marker, max, expired_only, result, truncated);
 }
 
-int RGWRados::process_gc()
+int RGWRados::process_gc(bool expired_only)
 {
-  return gc->process();
+  return gc->process(expired_only);
 }
 
 int RGWRados::list_lc_progress(const string& marker, uint32_t max_entries, map<string, int> *progress_map)
index 48081c6a73b442fabe3dd51bb80f1a54e7d9cb71..2fbb27c9fb10728e67a4ac39987ac33d10f06bb6 100644 (file)
@@ -3624,8 +3624,8 @@ public:
   int gc_operate(string& oid, librados::ObjectReadOperation *op, bufferlist *pbl);
 
   int list_gc_objs(int *index, string& marker, uint32_t max, bool expired_only, std::list<cls_rgw_gc_obj_info>& result, bool *truncated);
-  int process_gc();
-  bool process_expire_objects();
+  int process_gc(bool expired_only);
+  int process_expire_objects();
   int defer_gc(void *ctx, const RGWBucketInfo& bucket_info, const rgw_obj& obj);
 
   int process_lc();
index b2b60e9cb2b52185e8e1995d044fe9fbc27a6985..eeb39a9dfe681cf995847da36834c89674472184 100644 (file)
     usage trim                 trim usage (by user, date range)
     gc list                    dump expired garbage collection objects (specify
                                --include-all to list all entries, including unexpired)
-    gc process                 manually process garbage
+    gc process                 manually process garbage (specify
+                               --include-all to process all entries, including unexpired)
     lc list                    list all bucket lifecycle progress
     lc process                 manually process lifecycle
     metadata get               get metadata info