@@ -3055,7 +3055,7 @@ int RGWRados::swift_versioning_restore(RGWObjectCtx& obj_ctx,
30553055
30563056 /* Need to remove the archived copy. */
30573057 ret = delete_obj (dpp, obj_ctx, archive_binfo, archive_obj,
3058- archive_binfo.versioning_status (), y);
3058+ archive_binfo.versioning_status (), y, false );
30593059
30603060 return ret;
30613061 };
@@ -5738,7 +5738,7 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, const DoutPrefixProvi
57385738 }
57395739 result.delete_marker = dirent.is_delete_marker ();
57405740 r = store->unlink_obj_instance (dpp, target->get_ctx (), target->get_bucket_info (), obj, params.olh_epoch ,
5741- y, params.zones_trace , add_log);
5741+ y, params.bilog_flags , params. null_verid , params. zones_trace , add_log);
57425742 if (r < 0 ) {
57435743 return r;
57445744 }
@@ -5834,6 +5834,11 @@ int RGWRados::Object::Delete::delete_obj(optional_yield y, const DoutPrefixProvi
58345834 index_op.set_zones_trace (params.zones_trace );
58355835 index_op.set_bilog_flags (params.bilog_flags );
58365836
5837+ if (params.null_verid ) {
5838+ index_op.set_bilog_flags (params.bilog_flags | RGW_BILOG_NULL_VERSION);
5839+ }
5840+
5841+
58375842 r = index_op.prepare (dpp, CLS_RGW_OP_DEL, &state->write_tag , y, log_op);
58385843 if (r < 0 )
58395844 return r;
@@ -5885,6 +5890,7 @@ int RGWRados::delete_obj(const DoutPrefixProvider *dpp,
58855890 const RGWBucketInfo& bucket_info,
58865891 const rgw_obj& obj,
58875892 int versioning_status, optional_yield y,// versioning flags defined in enum RGWBucketFlags
5893+ bool null_verid,
58885894 uint16_t bilog_flags,
58895895 const real_time& expiration_time,
58905896 rgw_zone_set *zones_trace,
@@ -5898,6 +5904,7 @@ int RGWRados::delete_obj(const DoutPrefixProvider *dpp,
58985904 del_op.params .bilog_flags = bilog_flags;
58995905 del_op.params .expiration_time = expiration_time;
59005906 del_op.params .zones_trace = zones_trace;
5907+ del_op.params .null_verid = null_verid;
59015908
59025909 return del_op.delete_obj (y, dpp, log_op ? rgw::sal::FLAG_LOG_OP : 0 );
59035910}
@@ -7841,6 +7848,7 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp,
78417848 const rgw_obj& obj_instance,
78427849 const string& op_tag, const string& olh_tag,
78437850 uint64_t olh_epoch, optional_yield y,
7851+ uint16_t bilog_flags,
78447852 rgw_zone_set *_zones_trace, bool log_op)
78457853{
78467854 rgw_rados_ref ref;
@@ -7865,7 +7873,7 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp,
78657873 op.assert_exists (); // bucket index shard must exist
78667874 cls_rgw_guard_bucket_resharding (op, -ERR_BUSY_RESHARDING);
78677875 cls_rgw_bucket_unlink_instance (op, key, op_tag,
7868- olh_tag, olh_epoch, log_op, zones_trace);
7876+ olh_tag, olh_epoch, log_op, bilog_flags, zones_trace);
78697877 return rgw_rados_operate (dpp, ref.ioctx , ref.obj .oid , &op, y);
78707878 }, y);
78717879 if (r < 0 ) {
@@ -8068,8 +8076,10 @@ int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp,
80688076 bufferlist& olh_tag,
80698077 std::map<uint64_t , std::vector<rgw_bucket_olh_log_entry> >& log,
80708078 uint64_t *plast_ver,
8071- optional_yield y, rgw_zone_set* zones_trace,
8072- bool log_op)
8079+ optional_yield y,
8080+ bool null_verid,
8081+ rgw_zone_set* zones_trace,
8082+ bool log_op)
80738083{
80748084 if (log.empty ()) {
80758085 return 0 ;
@@ -8182,7 +8192,7 @@ int RGWRados::apply_olh_log(const DoutPrefixProvider *dpp,
81828192 liter != remove_instances.end (); ++liter) {
81838193 cls_rgw_obj_key& key = *liter;
81848194 rgw_obj obj_instance (bucket, key);
8185- int ret = delete_obj (dpp, obj_ctx, bucket_info, obj_instance, 0 , y, RGW_BILOG_FLAG_VERSIONED_OP, ceph::real_time (), zones_trace, log_op);
8195+ int ret = delete_obj (dpp, obj_ctx, bucket_info, obj_instance, 0 , y, null_verid, RGW_BILOG_FLAG_VERSIONED_OP, ceph::real_time (), zones_trace, log_op);
81868196 if (ret < 0 && ret != -ENOENT) {
81878197 ldpp_dout (dpp, 0 ) << " ERROR: delete_obj() returned " << ret << " obj_instance=" << obj_instance << dendl;
81888198 return ret;
@@ -8286,7 +8296,7 @@ int RGWRados::clear_olh(const DoutPrefixProvider *dpp,
82868296/*
82878297 * read olh log and apply it
82888298 */
8289- int RGWRados::update_olh (const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y, rgw_zone_set *zones_trace, bool log_op)
8299+ int RGWRados::update_olh (const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWObjState *state, RGWBucketInfo& bucket_info, const rgw_obj& obj, optional_yield y, rgw_zone_set *zones_trace, bool null_verid, bool log_op)
82908300{
82918301 map<uint64_t , vector<rgw_bucket_olh_log_entry> > log;
82928302 bool is_truncated;
@@ -8297,7 +8307,7 @@ int RGWRados::update_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, R
82978307 if (ret < 0 ) {
82988308 return ret;
82998309 }
8300- ret = apply_olh_log (dpp, obj_ctx, *state, bucket_info, obj, state->olh_tag , log, &ver_marker, y, zones_trace, log_op);
8310+ ret = apply_olh_log (dpp, obj_ctx, *state, bucket_info, obj, state->olh_tag , log, &ver_marker, y, null_verid, zones_trace, log_op);
83018311 if (ret < 0 ) {
83028312 return ret;
83038313 }
@@ -8399,7 +8409,7 @@ int RGWRados::set_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx,
83998409}
84008410
84018411int RGWRados::unlink_obj_instance (const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
8402- uint64_t olh_epoch, optional_yield y, rgw_zone_set *zones_trace, bool log_op)
8412+ uint64_t olh_epoch, optional_yield y, uint16_t bilog_flags, bool null_verid, rgw_zone_set *zones_trace, bool log_op)
84038413{
84048414 string op_tag;
84058415
@@ -8438,7 +8448,13 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& o
84388448 std::this_thread::sleep_for (cct->_conf ->rgw_debug_inject_latency_bi_unlink * std::chrono::seconds{1 });
84398449 }
84408450
8441- ret = bucket_index_unlink_instance (dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, zones_trace, log_op);
8451+ if (null_verid) {
8452+ bilog_flags = bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP | RGW_BILOG_NULL_VERSION;
8453+ } else {
8454+ bilog_flags = bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP;
8455+ }
8456+
8457+ ret = bucket_index_unlink_instance (dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, bilog_flags, zones_trace, log_op);
84428458 if (ret < 0 ) {
84438459 olh_cancel_modification (dpp, bucket_info, *state, olh_obj, op_tag, y);
84448460 ldpp_dout (dpp, 20 ) << " bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl;
@@ -8448,7 +8464,7 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& o
84488464 // it's possible that the pending xattr from this op prevented the olh
84498465 // object from being cleaned by another thread that was deleting the last
84508466 // existing version. We invoke a best-effort update_olh here to handle this case.
8451- int r = update_olh (dpp, obj_ctx, state, bucket_info, olh_obj, y, zones_trace, log_op);
8467+ int r = update_olh (dpp, obj_ctx, state, bucket_info, olh_obj, y, zones_trace, null_verid, log_op);
84528468 if (r < 0 && r != -ECANCELED) {
84538469 ldpp_dout (dpp, 20 ) << " update_olh() target_obj=" << olh_obj << " returned " << r << dendl;
84548470 }
@@ -8462,7 +8478,7 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& o
84628478 return -EIO;
84638479 }
84648480
8465- ret = update_olh (dpp, obj_ctx, state, bucket_info, olh_obj, y, zones_trace, log_op);
8481+ ret = update_olh (dpp, obj_ctx, state, bucket_info, olh_obj, y, zones_trace, null_verid, log_op);
84668482 if (ret == -ECANCELED) { /* already did what we needed, no need to retry, raced with another user */
84678483 return 0 ;
84688484 }
0 commit comments