From d83540235e315be4c12ced8cbccd79f81e10b7bd Mon Sep 17 00:00:00 2001 From: Matt Benjamin Date: Fri, 18 Feb 2022 09:31:06 -0500 Subject: [PATCH] rgwlc: avoid front() on empty lc entry vector Conveniently, this arose after removing all lifecycle shards from RADOS, proving it could be done safely. A restart is currently needed to recognize new lifecycle shards, if rgw_gc_max_objs also changed. Signed-off-by: Matt Benjamin --- src/rgw/rgw_lc.cc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index e1fbe374e8fb5..620576a9a496c 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -2155,9 +2155,11 @@ int RGWLC::process(int index, int max_lock_secs, LCWorker* worker, << "entries) returned error ret==" << ret << dendl; goto exit; } - entry = entries.front(); - head.marker = entry.bucket; - head.start_date = now; + if (entries.size() > 0) { + entry = entries.front(); + head.marker = entry.bucket; + head.start_date = now; + } } else { ldpp_dout(this, 0) << "RGWLC::process() head.marker !empty() at START for shard==" << lc_shard << " head last stored at " -- 2.39.5