diff options
Diffstat (limited to 'src/rgw/rgw_lc.cc')
-rw-r--r-- | src/rgw/rgw_lc.cc | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc index 78807888dfd..c9fb4765d59 100644 --- a/src/rgw/rgw_lc.cc +++ b/src/rgw/rgw_lc.cc @@ -495,6 +495,14 @@ struct lc_op_ctx { octx(env.driver), dpp(dpp), wq(wq) { obj = bucket->get_object(o.key); + /* once bucket versioning is enabled, the non-current entries with + * instance empty should have instance set to "null" to be able + * to correctly read its olh version entry. + */ + if (o.key.instance.empty() && bucket->versioned() && !o.is_current()) { + rgw_obj_key& obj_key = obj->get_key(); + obj_key.instance = "null"; + } } bool next_has_same_name(const std::string& key_name) { @@ -1175,7 +1183,7 @@ public: << " " << oc.wq->thr_name() << dendl; } else { /* ! o.is_delete_marker() */ - r = remove_expired_obj(oc.dpp, oc, !oc.bucket->versioned(), + r = remove_expired_obj(oc.dpp, oc, !oc.bucket->versioning_enabled(), {rgw::notify::ObjectExpirationCurrent, rgw::notify::LifecycleExpirationDelete}); if (r < 0) { @@ -1355,9 +1363,9 @@ public: int delete_tier_obj(lc_op_ctx& oc) { int ret = 0; - /* If bucket is versioned, create delete_marker for current version + /* If bucket has versioning enabled, create delete_marker for current version */ - if (! oc.bucket->versioned()) { + if (! oc.bucket->versioning_enabled()) { ret = remove_expired_obj(oc.dpp, oc, true, {rgw::notify::ObjectTransition}); ldpp_dout(oc.dpp, 20) << "delete_tier_obj Object(key:" << oc.o.key @@ -1387,9 +1395,10 @@ public: int transition_obj_to_cloud(lc_op_ctx& oc) { int ret{0}; - /* If CurrentVersion object, remove it & create delete marker */ + /* If CurrentVersion object & bucket has versioning enabled, remove it & + * create delete marker */ bool delete_object = (!oc.tier->retain_head_object() || - (oc.o.is_current() && oc.bucket->versioned())); + (oc.o.is_current() && oc.bucket->versioning_enabled())); /* notifications */ auto& bucket = oc.bucket; |