Project

General

Profile

Actions

Bug #49446

closed
JC MB

rgw: RGWLC::process() may starve some bucket LCs at the end of a lc.N

Bug #49446: rgw: RGWLC::process() may starve some bucket LCs at the end of a lc.N

Added by Jeegn Chen almost 6 years ago. Updated over 1 year ago.

Status:
Resolved
Priority:
High
Assignee:
Target version:
-
Due date:
% Done:

100%

Source:
Community (user)
Backport:
quincy, pacific
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Pull request ID:
Tags (freeform):
Fixed In:
v17.0.0-11154-g73ef518b2b
Released In:
v18.2.0~2548
Upkeep Timestamp:
2025-07-14T18:00:34+00:00

Description

Current implementation of RGWLC::process() implicitly assumes that all
the buckets in one lc.N can be processed within one day.
So the following snippet will always reset the marker to the beginning
of a lc.N when the lc.N is processed for the first time in a day.

    if(!if_already_run_today(head.start_date)) {
      head.start_date = now;
      head.marker.clear();
      ret = bucket_lc_prepare(index);
      if (ret < 0) {
      ldpp_dout(this, 0) << "RGWLC::process() failed to update lc object " 
          << obj_names[index] << ", ret=" << ret << dendl;
      goto exit;
      }
    }

However, this assumption may not be true, when the number of bucket
lifecycle configurations or the number of objects within buckets became
large enough. In these scenarios, the logic above may reset the marker
to the beginning when it was just pointing to some key in the middle of
lc.N. As a result, the bucket lifecycles after that key will get
no chance to be processed.

Maybe a more reasonable logic is that we should check whether the marker
is pointing to the end of a lc.N first. If yes, it is OK to reset.
But if it is not, the marker should be reserved.


Related issues 2 (0 open — 2 closed)

Copied to rgw - Backport #55246: pacific: rgw: RGWLC::process() may starve some bucket LCs at the end of a lc.NRejectedMatt Benjamin

Actions
Copied to rgw - Backport #58329: quincy: rgw: RGWLC::process() may starve some bucket LCs at the end of a lc.NRejectedMatt Benjamin

Actions

JC Updated by Jeegn Chen almost 6 years ago Actions #1

It seems that lastest implmentation use this snippet to address the issue, which assumes that a bucket should take less than 2 days to complete a lifecycle processing.

    if (! (cct->_conf->rgw_lc_lock_max_time == 9969)) {
      ret = sal_lc->get_entry(obj_names[index], head.marker, entry);
      if (ret >= 0) {
    if (entry.status == lc_processing) {
      if (expired_session(entry.start_time)) {
        dout(5) << "RGWLC::process(): STALE lc session found for: " << entry
            << " index: " << index << " worker ix: " << worker->ix
            << " (clearing)" 
            << dendl;
      } else {
        dout(5) << "RGWLC::process(): ACTIVE entry: " << entry
            << " index: " << index << " worker ix: " << worker->ix
          << dendl;
        goto exit;
      }
    }
      }
    }

    if(!if_already_run_today(head.start_date) ||
       once) {
      head.start_date = now;
      head.marker.clear();
      ret = bucket_lc_prepare(index, worker);
      if (ret < 0) {
      ldpp_dout(this, 0) << "RGWLC::process() failed to update lc object " 
             << obj_names[index]
             << ", ret=" << ret
             << dendl;
      goto exit;
      }
    }
bool RGWLC::expired_session(time_t started)
{
  time_t interval = (cct->_conf->rgw_lc_debug_interval > 0)
    ? cct->_conf->rgw_lc_debug_interval
    : 24*60*60;

  auto now = time(nullptr);

  dout(16) << "RGWLC::expired_session" 
       << " started: " << started
       << " interval: " << interval << "(*2==" << 2*interval << ")" 
       << " now: " << now
       << dendl;

  return (started + 2*interval < now);
}

MB Updated by Matt Benjamin almost 6 years ago Actions #2

Hi,

I agree with your analysis overall. Wrt your comment #1, the current 2*interval logic is arbitrary and fine to change--but we need to preserve the invariant that only one LC.n process will be running at any time.

regards,

Matt

CB Updated by Casey Bodley almost 6 years ago Actions #3

  • Status changed from New to Triaged

CB Updated by Casey Bodley about 5 years ago Actions #5

  • Status changed from Triaged to Fix Under Review
  • Assignee set to Matt Benjamin

MB Updated by Matt Benjamin almost 5 years ago Actions #6

  • Backport set to pacific

MB Updated by Matt Benjamin almost 5 years ago Actions #7

  • Priority changed from Normal to High

MB Updated by Matt Benjamin over 4 years ago Actions #8

  • Pull request ID set to 40703

MB Updated by Matt Benjamin over 4 years ago Actions #9

  • Status changed from Fix Under Review to Pending Backport

UB Updated by Upkeep Bot over 4 years ago Actions #10

  • Copied to Backport #55246: pacific: rgw: RGWLC::process() may starve some bucket LCs at the end of a lc.N added

MB Updated by Matt Benjamin almost 4 years ago Actions #12

  • Backport changed from pacific to quincy, pacific

MB Updated by Matt Benjamin almost 4 years ago Actions #13

  • Copied to Backport #58329: quincy: rgw: RGWLC::process() may starve some bucket LCs at the end of a lc.N added

KS Updated by Konstantin Shalygin over 2 years ago Actions #15

  • Status changed from Pending Backport to Resolved
  • % Done changed from 0 to 100
  • Source set to Community (user)

UB Updated by Upkeep Bot over 1 year ago Actions #16

  • Merge Commit set to 73ef518b2b889c65df97e9a77365f68363469bec
  • Fixed In set to v17.0.0-11154-g73ef518b2b
  • Released In set to v18.2.0~2548
  • Upkeep Timestamp set to 2025-07-14T18:00:34+00:00
Actions

Also available in: PDF Atom