std::unique_ptr<rgw::sal::Bucket> all_buckets; // empty restriction
utime_t start = ceph_clock_now();
if (should_work(start)) {
+ lc_start_time = time(nullptr);
ldpp_dout(dpp, 2) << "life cycle: start worker=" << ix << dendl;
int r = lc->process(this, all_buckets, false /* once */);
if (r < 0) {
return 0;
}
-bool RGWLC::expired_session(time_t started)
-{
+bool RGWLC::expired_session(time_t started, time_t lc_start_time) {
if (! cct->_conf->rgwlc_auto_session_clear) {
return false;
}
-
- time_t interval = (cct->_conf->rgw_lc_debug_interval > 0)
- ? cct->_conf->rgw_lc_debug_interval : secs_in_a_day;
+ // lc_start_time is greater than last time when bucket was updated, then
+ // session is confirmed expired
+ if (cct->_conf->rgw_lc_debug_interval <= 0) {
+ if (lc_start_time > started) {
+ return true;
+ }
+ return false;
+ }
+ time_t interval = cct->_conf->rgw_lc_debug_interval;
auto now = time(nullptr);
bucket_entry_marker, entry);
if (ret >= 0) {
if (entry.status == lc_processing) {
- if (expired_session(entry.start_time)) {
- ldpp_dout(this, 5) << "RGWLC::process_bucket(): STALE lc session found for: " << entry
+ if (expired_session(entry.start_time, worker->lc_start_time)) {
+ ldpp_dout(this, 5) << "RGWLC::process_bucket(): STALE lc session found for: " << entry
<< " index: " << index << " worker ix: " << worker->ix
<< " (clearing)"
<< dendl;
if (!entry.bucket.empty()) {
if (entry.status == lc_processing) {
- if (expired_session(entry.start_time)) {
+ if (expired_session(entry.start_time, worker->lc_start_time)) {
ldpp_dout(this, 5)
<< "RGWLC::process(): STALE lc session found for: " << entry
<< " index: " << index << " worker ix: " << worker->ix
* to cloud. This list is maintained for the duration of each RGWLC::process()
* post which it is discarded. */
std::set<std::string> cloud_targets;
+ time_t lc_start_time;
- public:
-
+ public:
using lock_guard = std::lock_guard<std::mutex>;
using unique_lock = std::unique_lock<std::mutex>;
int process(int index, int max_lock_secs, LCWorker* worker, bool once);
int process_bucket(int index, int max_lock_secs, LCWorker* worker,
const std::string& bucket_entry_marker, bool once);
- bool expired_session(time_t started);
+ bool expired_session(time_t started, time_t lc_start_time);
time_t thread_stop_at();
int list_lc_progress(std::string& marker, uint32_t max_entries,
std::vector<rgw::sal::LCEntry>&,