summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSoumya Koduri <skoduri@redhat.com>2024-10-23 13:52:08 +0200
committerGitHub <noreply@github.com>2024-10-23 13:52:08 +0200
commit16b44ff67e82a1c8ba510a466e79050cc6370b79 (patch)
tree379818ab14993e06ed12cb34c5dbef646ec07a8c
parentMerge pull request #60258 from aclamk/wip-aclamk-cbt-improve-show-label (diff)
parentrgw/lc: Fix issues with non-current objects with instance empty (diff)
downloadceph-16b44ff67e82a1c8ba510a466e79050cc6370b79.tar.xz
ceph-16b44ff67e82a1c8ba510a466e79050cc6370b79.zip
Merge pull request #60157 from soumyakoduri/wip-skoduri-lc-nullinstance
rgw/lc: Fix issues with non-current objects with instance empty Reviewed-by: Casey Bodley <cbodley@redhat.com>
-rw-r--r--src/rgw/driver/rados/rgw_lc_tier.cc5
-rw-r--r--src/rgw/driver/rados/rgw_rados.cc7
-rw-r--r--src/rgw/driver/rados/rgw_rados.h2
-rw-r--r--src/rgw/driver/rados/rgw_sal_rados.cc7
-rw-r--r--src/rgw/rgw_lc.cc17
5 files changed, 30 insertions, 8 deletions
diff --git a/src/rgw/driver/rados/rgw_lc_tier.cc b/src/rgw/driver/rados/rgw_lc_tier.cc
index e932c997621..b153a7b4a42 100644
--- a/src/rgw/driver/rados/rgw_lc_tier.cc
+++ b/src/rgw/driver/rados/rgw_lc_tier.cc
@@ -77,8 +77,9 @@ WRITE_CLASS_ENCODER(rgw_lc_multipart_upload_info)
static inline string get_key_instance(const rgw_obj_key& key)
{
- if (!key.instance.empty() &&
- !key.have_null_instance()) {
+ // if non-current entry, add versionID to the
+ // transitioned object name including "null".
+ if (!key.instance.empty()) {
return "-" + key.instance;
}
return "";
diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc
index d154082994e..a133b54dc59 100644
--- a/src/rgw/driver/rados/rgw_rados.cc
+++ b/src/rgw/driver/rados/rgw_rados.cc
@@ -5089,7 +5089,7 @@ int RGWRados::copy_obj_data(RGWObjectCtx& obj_ctx,
int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
RGWBucketInfo& bucket_info,
- const rgw_obj& obj,
+ rgw_obj obj,
const rgw_placement_rule& placement_rule,
const real_time& mtime,
uint64_t olh_epoch,
@@ -5120,6 +5120,11 @@ int RGWRados::transition_obj(RGWObjectCtx& obj_ctx,
return -ECANCELED;
}
+ // bi expects empty instance for the entries created when bucket versioning
+ // is not enabled or suspended.
+ if (obj.key.instance == "null") {
+ obj.key.instance.clear();
+ }
attrs.erase(RGW_ATTR_ID_TAG);
attrs.erase(RGW_ATTR_TAIL_TAG);
diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h
index 9a2ba0af0e2..b24823b60dc 100644
--- a/src/rgw/driver/rados/rgw_rados.h
+++ b/src/rgw/driver/rados/rgw_rados.h
@@ -1234,7 +1234,7 @@ public:
int transition_obj(RGWObjectCtx& obj_ctx,
RGWBucketInfo& bucket_info,
- const rgw_obj& obj,
+ rgw_obj obj,
const rgw_placement_rule& placement_rule,
const real_time& mtime,
uint64_t olh_epoch,
diff --git a/src/rgw/driver/rados/rgw_sal_rados.cc b/src/rgw/driver/rados/rgw_sal_rados.cc
index bb416b0c2c3..11b86a25841 100644
--- a/src/rgw/driver/rados/rgw_sal_rados.cc
+++ b/src/rgw/driver/rados/rgw_sal_rados.cc
@@ -2792,6 +2792,13 @@ int RadosObject::write_cloud_tier(const DoutPrefixProvider* dpp,
{
rgw::sal::RadosPlacementTier* rtier = static_cast<rgw::sal::RadosPlacementTier*>(tier);
map<string, bufferlist> attrs = get_attrs();
+ rgw_obj_key& obj_key = get_key();
+ // bi expects empty instance for the entries created when bucket versioning
+ // is not enabled or suspended.
+ if (obj_key.instance == "null") {
+ obj_key.instance.clear();
+ }
+
RGWRados::Object op_target(store->getRados(), bucket->get_info(), *rados_ctx, get_obj());
RGWRados::Object::Write obj_op(&op_target);
diff --git a/src/rgw/rgw_lc.cc b/src/rgw/rgw_lc.cc
index 78807888dfd..a7f2ceabad3 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) {
@@ -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;