diff options
-rw-r--r-- | src/cls/rgw/cls_rgw.cc | 8 | ||||
-rw-r--r-- | src/cls/rgw/cls_rgw_client.cc | 8 | ||||
-rw-r--r-- | src/cls/rgw/cls_rgw_client.h | 4 | ||||
-rw-r--r-- | src/cls/rgw/cls_rgw_ops.h | 9 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_rados.cc | 17 | ||||
-rw-r--r-- | src/rgw/driver/rados/rgw_rados.h | 4 | ||||
-rw-r--r-- | src/rgw/rgw_op.cc | 7 | ||||
-rw-r--r-- | src/test/rgw/rgw_multi/tests.py | 2 |
8 files changed, 26 insertions, 33 deletions
diff --git a/src/cls/rgw/cls_rgw.cc b/src/cls/rgw/cls_rgw.cc index 4b9fe1838fc..27a484dd51e 100644 --- a/src/cls/rgw/cls_rgw.cc +++ b/src/cls/rgw/cls_rgw.cc @@ -2011,18 +2011,12 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in, rgw_bucket_entry_ver ver; ver.epoch = (op.olh_epoch ? op.olh_epoch : olh.get_epoch()); - if (op.null_verid) { - op.bilog_flags = op.bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP | RGW_BILOG_NULL_VERSION; - } else { - op.bilog_flags = op.bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP; - } - real_time mtime = obj.mtime(); /* mtime has no real meaning in * instance removal context */ ret = log_index_operation(hctx, op.key, CLS_RGW_OP_UNLINK_INSTANCE, op.op_tag, mtime, ver, CLS_RGW_STATE_COMPLETE, header.ver, header.max_marker, - op.bilog_flags, NULL, NULL, &op.zones_trace); + op.bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP, NULL, NULL, &op.zones_trace); if (ret < 0) return ret; diff --git a/src/cls/rgw/cls_rgw_client.cc b/src/cls/rgw/cls_rgw_client.cc index c36d9c232a0..e65dedf14e4 100644 --- a/src/cls/rgw/cls_rgw_client.cc +++ b/src/cls/rgw/cls_rgw_client.cc @@ -536,10 +536,10 @@ void cls_rgw_bucket_link_olh(librados::ObjectWriteOperation& op, const cls_rgw_o int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const string& oid, const cls_rgw_obj_key& key, const string& op_tag, const string& olh_tag, uint64_t olh_epoch, bool log_op, - bool null_verid, const rgw_zone_set& zones_trace) + uint16_t bilog_flags, const rgw_zone_set& zones_trace) { librados::ObjectWriteOperation op; - cls_rgw_bucket_unlink_instance(op, key, op_tag, olh_tag, olh_epoch, log_op, null_verid, zones_trace); + cls_rgw_bucket_unlink_instance(op, key, op_tag, olh_tag, olh_epoch, log_op, bilog_flags, zones_trace); int r = io_ctx.operate(oid, &op); if (r < 0) return r; @@ -550,7 +550,7 @@ int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const string& oid, void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& key, const string& op_tag, const string& olh_tag, uint64_t olh_epoch, bool log_op, - bool null_verid, const rgw_zone_set& zones_trace) + uint16_t bilog_flags, const rgw_zone_set& zones_trace) { bufferlist in, out; rgw_cls_unlink_instance_op call; @@ -560,7 +560,7 @@ void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op, call.olh_tag = olh_tag; call.log_op = log_op; call.zones_trace = zones_trace; - call.null_verid = null_verid; + call.bilog_flags = bilog_flags; encode(call, in); op.exec(RGW_CLASS, RGW_BUCKET_UNLINK_INSTANCE, in); } diff --git a/src/cls/rgw/cls_rgw_client.h b/src/cls/rgw/cls_rgw_client.h index c3dec6932e0..365a51fb5d5 100644 --- a/src/cls/rgw/cls_rgw_client.h +++ b/src/cls/rgw/cls_rgw_client.h @@ -381,7 +381,7 @@ void cls_rgw_bucket_link_olh(librados::ObjectWriteOperation& op, uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time, bool log_op, const rgw_zone_set& zones_trace); void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& key, const std::string& op_tag, - const std::string& olh_tag, uint64_t olh_epoch, bool log_op, bool null_verid, const rgw_zone_set& zones_trace); + const std::string& olh_tag, uint64_t olh_epoch, bool log_op, uint16_t bilog_flags, const rgw_zone_set& zones_trace); void cls_rgw_get_olh_log(librados::ObjectReadOperation& op, const cls_rgw_obj_key& olh, uint64_t ver_marker, const std::string& olh_tag, rgw_cls_read_olh_log_ret& log_ret, int& op_ret); void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, uint64_t ver, const std::string& olh_tag); void cls_rgw_clear_olh(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, const std::string& olh_tag); @@ -396,7 +396,7 @@ int cls_rgw_bucket_link_olh(librados::IoCtx& io_ctx, const std::string& oid, int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const std::string& oid, const cls_rgw_obj_key& key, const std::string& op_tag, const std::string& olh_tag, uint64_t olh_epoch, bool log_op, - bool null_verid, const rgw_zone_set& zones_trace); + uint16_t bilog_flags, const rgw_zone_set& zones_trace); int cls_rgw_get_olh_log(librados::IoCtx& io_ctx, std::string& oid, const cls_rgw_obj_key& olh, uint64_t ver_marker, const std::string& olh_tag, rgw_cls_read_olh_log_ret& log_ret); int cls_rgw_clear_olh(librados::IoCtx& io_ctx, std::string& oid, const cls_rgw_obj_key& olh, const std::string& olh_tag); diff --git a/src/cls/rgw/cls_rgw_ops.h b/src/cls/rgw/cls_rgw_ops.h index f6ae362f5da..b824c73d3d0 100644 --- a/src/cls/rgw/cls_rgw_ops.h +++ b/src/cls/rgw/cls_rgw_ops.h @@ -239,12 +239,11 @@ struct rgw_cls_unlink_instance_op { uint16_t bilog_flags; std::string olh_tag; rgw_zone_set zones_trace; - bool null_verid; rgw_cls_unlink_instance_op() : olh_epoch(0), log_op(false), bilog_flags(0) {} void encode(ceph::buffer::list& bl) const { - ENCODE_START(4, 1, bl); + ENCODE_START(3, 1, bl); encode(key, bl); encode(op_tag, bl); encode(olh_epoch, bl); @@ -252,12 +251,11 @@ struct rgw_cls_unlink_instance_op { encode(bilog_flags, bl); encode(olh_tag, bl); encode(zones_trace, bl); - encode(null_verid, bl); ENCODE_FINISH(bl); } void decode(ceph::buffer::list::const_iterator& bl) { - DECODE_START(4, bl); + DECODE_START(3, bl); decode(key, bl); decode(op_tag, bl); decode(olh_epoch, bl); @@ -269,9 +267,6 @@ struct rgw_cls_unlink_instance_op { if (struct_v >= 3) { decode(zones_trace, bl); } - if (struct_v >= 4) { - decode(null_verid, bl); - } DECODE_FINISH(bl); } diff --git a/src/rgw/driver/rados/rgw_rados.cc b/src/rgw/driver/rados/rgw_rados.cc index 793e1729049..ce35ed20be4 100644 --- a/src/rgw/driver/rados/rgw_rados.cc +++ b/src/rgw/driver/rados/rgw_rados.cc @@ -5738,7 +5738,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, const DoutPrefixProvi } result.delete_marker = dirent.is_delete_marker(); r = store->unlink_obj_instance(dpp, target->get_ctx(), target->get_bucket_info(), obj, params.olh_epoch, - y, params.null_verid, params.zones_trace, add_log); + y, params.bilog_flags, params.null_verid, params.zones_trace, add_log); if (r < 0) { return r; } @@ -7847,7 +7847,8 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp, RGWBucketInfo& bucket_info, const rgw_obj& obj_instance, const string& op_tag, const string& olh_tag, - uint64_t olh_epoch, optional_yield y, bool null_verid, + uint64_t olh_epoch, optional_yield y, + uint16_t bilog_flags, rgw_zone_set *_zones_trace, bool log_op) { rgw_rados_ref ref; @@ -7872,7 +7873,7 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp, op.assert_exists(); // bucket index shard must exist cls_rgw_guard_bucket_resharding(op, -ERR_BUSY_RESHARDING); cls_rgw_bucket_unlink_instance(op, key, op_tag, - olh_tag, olh_epoch, log_op, null_verid, zones_trace); + olh_tag, olh_epoch, log_op, bilog_flags, zones_trace); return rgw_rados_operate(dpp, ref.ioctx, ref.obj.oid, &op, y); }, y); if (r < 0) { @@ -8408,7 +8409,7 @@ int RGWRados::set_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, } int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, - uint64_t olh_epoch, optional_yield y, bool null_verid, rgw_zone_set *zones_trace, bool log_op) + uint64_t olh_epoch, optional_yield y, uint16_t bilog_flags, bool null_verid, rgw_zone_set *zones_trace, bool log_op) { string op_tag; @@ -8447,7 +8448,13 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& o std::this_thread::sleep_for(cct->_conf->rgw_debug_inject_latency_bi_unlink * std::chrono::seconds{1}); } - ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, null_verid, zones_trace, log_op); + if (null_verid) { + bilog_flags = bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP | RGW_BILOG_NULL_VERSION; + } else { + bilog_flags = bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP; + } + + ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, bilog_flags, zones_trace, log_op); if (ret < 0) { olh_cancel_modification(dpp, bucket_info, *state, olh_obj, op_tag, y); ldpp_dout(dpp, 20) << "bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl; diff --git a/src/rgw/driver/rados/rgw_rados.h b/src/rgw/driver/rados/rgw_rados.h index e405afbf3a2..7ff15a2cae2 100644 --- a/src/rgw/driver/rados/rgw_rados.h +++ b/src/rgw/driver/rados/rgw_rados.h @@ -1359,7 +1359,7 @@ public: const rgw_obj& obj_instance, const std::string& op_tag, const std::string& olh_tag, uint64_t olh_epoch, optional_yield y, - bool null_verid, + uint16_t bilog_flags, rgw_zone_set *zones_trace = nullptr, bool log_op = true); int bucket_index_read_olh_log(const DoutPrefixProvider *dpp, @@ -1396,7 +1396,7 @@ public: int repair_olh(const DoutPrefixProvider *dpp, RGWObjState* state, const RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y); int unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj, - uint64_t olh_epoch, optional_yield y, bool null_verid, rgw_zone_set *zones_trace = nullptr, bool log_op = true); + uint64_t olh_epoch, optional_yield y, uint16_t bilog_flags, bool null_verid, rgw_zone_set *zones_trace = nullptr, bool log_op = true); void check_pending_olh_entries(const DoutPrefixProvider *dpp, std::map<std::string, bufferlist>& pending_entries, std::map<std::string, bufferlist> *rm_pending_entries); int remove_olh_pending_entries(const DoutPrefixProvider *dpp, const RGWBucketInfo& bucket_info, RGWObjState& state, const rgw_obj& olh_obj, std::map<std::string, bufferlist>& pending_attrs, optional_yield y); diff --git a/src/rgw/rgw_op.cc b/src/rgw/rgw_op.cc index 39633a899ea..e9247847705 100644 --- a/src/rgw/rgw_op.cc +++ b/src/rgw/rgw_op.cc @@ -5123,11 +5123,7 @@ void RGWDeleteObj::execute(optional_yield y) { int state_loaded = -1; bool check_obj_lock = s->object->have_instance() && s->bucket->get_info().obj_lock_enabled(); - if (s->object->get_instance() == "null") { - null_verid = 1; - } else { - null_verid = 0; - } + null_verid = (s->object->get_instance() == "null"); op_ret = state_loaded = s->object->load_obj_state(this, s->yield, true); if (op_ret < 0) { @@ -5227,7 +5223,6 @@ void RGWDeleteObj::execute(optional_yield y) del_op->params.marker_version_id = version_id; del_op->params.null_verid = null_verid; - ldpp_dout(this, 1) << "del_op->params.null_verid " << del_op->params.null_verid << dendl; op_ret = del_op->delete_obj(this, y, rgw::sal::FLAG_LOG_OP); if (op_ret >= 0) { delete_marker = del_op->result.delete_marker; diff --git a/src/test/rgw/rgw_multi/tests.py b/src/test/rgw/rgw_multi/tests.py index ec79027f95e..734336510d0 100644 --- a/src/test/rgw/rgw_multi/tests.py +++ b/src/test/rgw/rgw_multi/tests.py @@ -949,6 +949,8 @@ def test_null_version_id_delete(): bucket.delete_key(obj, version_id='null') + bucket.delete_key(obj, version_id=key2.version_id) + zonegroup_bucket_checkpoint(zonegroup_conns, bucket.name) def test_concurrent_versioned_object_incremental_sync(): |