]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgwlc: try hard to get lc locks when saving policy
authorMatt Benjamin <mbenjamin@redhat.com>
Thu, 12 May 2022 16:38:59 +0000 (12:38 -0400)
committerMatt Benjamin <mbenjamin@redhat.com>
Fri, 29 Jul 2022 16:31:07 +0000 (12:31 -0400)
During active lifecycle processing, there can be high contention for
lifecycle shard locks.

Signed-off-by: Matt Benjamin <mbenjamin@redhat.com>
src/rgw/rgw_lc.cc

index 69c0e6c32457afa9b817d6d1c872975e0992c01c..ad0936612b4e5e3568834abb4917555987550f48 100644 (file)
@@ -2418,14 +2418,19 @@ static int guard_lc_modify(const DoutPrefixProvider *dpp,
   utime_t time(max_lock_secs, 0);
 
   int ret;
+  uint16_t retries{0};
 
+  // due to reports of starvation trying to save lifecycle policy, try hard
   do {
     ret = lock->try_lock(dpp, time, null_yield);
     if (ret == -EBUSY || ret == -EEXIST) {
       ldpp_dout(dpp, 0) << "RGWLC::RGWPutLC() failed to acquire lock on "
-          << oid << ", sleep 5, try again" << dendl;
-      sleep(5); // XXX: return retryable error
-      continue;
+                       << oid << ", retry in 100ms, ret=" << ret << dendl;
+      std::this_thread::sleep_for(std::chrono::milliseconds(100));
+      // the typical S3 client will time out in 60s
+      if(retries++ < 500) {
+       continue;
+      }
     }
     if (ret < 0) {
       ldpp_dout(dpp, 0) << "RGWLC::RGWPutLC() failed to acquire lock on "