Skip to content

Commit 92002be

Browse files
author
Shilpa Jagannath
committed
rgw/multisite: use bilog_flags in cls_rgw_bucket_unlink_instance as well.
Signed-off-by: Shilpa Jagannath <[email protected]>
1 parent 7103b31 commit 92002be

File tree

8 files changed

+26
-33
lines changed

8 files changed

+26
-33
lines changed

src/cls/rgw/cls_rgw.cc

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2011,18 +2011,12 @@ static int rgw_bucket_unlink_instance(cls_method_context_t hctx, bufferlist *in,
20112011
rgw_bucket_entry_ver ver;
20122012
ver.epoch = (op.olh_epoch ? op.olh_epoch : olh.get_epoch());
20132013

2014-
if (op.null_verid) {
2015-
op.bilog_flags = op.bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP | RGW_BILOG_NULL_VERSION;
2016-
} else {
2017-
op.bilog_flags = op.bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP;
2018-
}
2019-
20202014
real_time mtime = obj.mtime(); /* mtime has no real meaning in
20212015
* instance removal context */
20222016
ret = log_index_operation(hctx, op.key, CLS_RGW_OP_UNLINK_INSTANCE, op.op_tag,
20232017
mtime, ver,
20242018
CLS_RGW_STATE_COMPLETE, header.ver, header.max_marker,
2025-
op.bilog_flags, NULL, NULL, &op.zones_trace);
2019+
op.bilog_flags | RGW_BILOG_FLAG_VERSIONED_OP, NULL, NULL, &op.zones_trace);
20262020
if (ret < 0)
20272021
return ret;
20282022

src/cls/rgw/cls_rgw_client.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -536,10 +536,10 @@ void cls_rgw_bucket_link_olh(librados::ObjectWriteOperation& op, const cls_rgw_o
536536
int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const string& oid,
537537
const cls_rgw_obj_key& key, const string& op_tag,
538538
const string& olh_tag, uint64_t olh_epoch, bool log_op,
539-
bool null_verid, const rgw_zone_set& zones_trace)
539+
uint16_t bilog_flags, const rgw_zone_set& zones_trace)
540540
{
541541
librados::ObjectWriteOperation op;
542-
cls_rgw_bucket_unlink_instance(op, key, op_tag, olh_tag, olh_epoch, log_op, null_verid, zones_trace);
542+
cls_rgw_bucket_unlink_instance(op, key, op_tag, olh_tag, olh_epoch, log_op, bilog_flags, zones_trace);
543543
int r = io_ctx.operate(oid, &op);
544544
if (r < 0)
545545
return r;
@@ -550,7 +550,7 @@ int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const string& oid,
550550
void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op,
551551
const cls_rgw_obj_key& key, const string& op_tag,
552552
const string& olh_tag, uint64_t olh_epoch, bool log_op,
553-
bool null_verid, const rgw_zone_set& zones_trace)
553+
uint16_t bilog_flags, const rgw_zone_set& zones_trace)
554554
{
555555
bufferlist in, out;
556556
rgw_cls_unlink_instance_op call;
@@ -560,7 +560,7 @@ void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op,
560560
call.olh_tag = olh_tag;
561561
call.log_op = log_op;
562562
call.zones_trace = zones_trace;
563-
call.null_verid = null_verid;
563+
call.bilog_flags = bilog_flags;
564564
encode(call, in);
565565
op.exec(RGW_CLASS, RGW_BUCKET_UNLINK_INSTANCE, in);
566566
}

src/cls/rgw/cls_rgw_client.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ void cls_rgw_bucket_link_olh(librados::ObjectWriteOperation& op,
381381
uint64_t olh_epoch, ceph::real_time unmod_since, bool high_precision_time, bool log_op, const rgw_zone_set& zones_trace);
382382
void cls_rgw_bucket_unlink_instance(librados::ObjectWriteOperation& op,
383383
const cls_rgw_obj_key& key, const std::string& op_tag,
384-
const std::string& olh_tag, uint64_t olh_epoch, bool log_op, bool null_verid, const rgw_zone_set& zones_trace);
384+
const std::string& olh_tag, uint64_t olh_epoch, bool log_op, uint16_t bilog_flags, const rgw_zone_set& zones_trace);
385385
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);
386386
void cls_rgw_trim_olh_log(librados::ObjectWriteOperation& op, const cls_rgw_obj_key& olh, uint64_t ver, const std::string& olh_tag);
387387
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,
396396
int cls_rgw_bucket_unlink_instance(librados::IoCtx& io_ctx, const std::string& oid,
397397
const cls_rgw_obj_key& key, const std::string& op_tag,
398398
const std::string& olh_tag, uint64_t olh_epoch, bool log_op,
399-
bool null_verid, const rgw_zone_set& zones_trace);
399+
uint16_t bilog_flags, const rgw_zone_set& zones_trace);
400400
int cls_rgw_get_olh_log(librados::IoCtx& io_ctx, std::string& oid, const cls_rgw_obj_key& olh, uint64_t ver_marker,
401401
const std::string& olh_tag, rgw_cls_read_olh_log_ret& log_ret);
402402
int cls_rgw_clear_olh(librados::IoCtx& io_ctx, std::string& oid, const cls_rgw_obj_key& olh, const std::string& olh_tag);

src/cls/rgw/cls_rgw_ops.h

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -239,25 +239,23 @@ struct rgw_cls_unlink_instance_op {
239239
uint16_t bilog_flags;
240240
std::string olh_tag;
241241
rgw_zone_set zones_trace;
242-
bool null_verid;
243242

244243
rgw_cls_unlink_instance_op() : olh_epoch(0), log_op(false), bilog_flags(0) {}
245244

246245
void encode(ceph::buffer::list& bl) const {
247-
ENCODE_START(4, 1, bl);
246+
ENCODE_START(3, 1, bl);
248247
encode(key, bl);
249248
encode(op_tag, bl);
250249
encode(olh_epoch, bl);
251250
encode(log_op, bl);
252251
encode(bilog_flags, bl);
253252
encode(olh_tag, bl);
254253
encode(zones_trace, bl);
255-
encode(null_verid, bl);
256254
ENCODE_FINISH(bl);
257255
}
258256

259257
void decode(ceph::buffer::list::const_iterator& bl) {
260-
DECODE_START(4, bl);
258+
DECODE_START(3, bl);
261259
decode(key, bl);
262260
decode(op_tag, bl);
263261
decode(olh_epoch, bl);
@@ -269,9 +267,6 @@ struct rgw_cls_unlink_instance_op {
269267
if (struct_v >= 3) {
270268
decode(zones_trace, bl);
271269
}
272-
if (struct_v >= 4) {
273-
decode(null_verid, bl);
274-
}
275270
DECODE_FINISH(bl);
276271
}
277272

src/rgw/driver/rados/rgw_rados.cc

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -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.null_verid, 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
}
@@ -7847,7 +7847,8 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp,
78477847
RGWBucketInfo& bucket_info,
78487848
const rgw_obj& obj_instance,
78497849
const string& op_tag, const string& olh_tag,
7850-
uint64_t olh_epoch, optional_yield y, bool null_verid,
7850+
uint64_t olh_epoch, optional_yield y,
7851+
uint16_t bilog_flags,
78517852
rgw_zone_set *_zones_trace, bool log_op)
78527853
{
78537854
rgw_rados_ref ref;
@@ -7872,7 +7873,7 @@ int RGWRados::bucket_index_unlink_instance(const DoutPrefixProvider *dpp,
78727873
op.assert_exists(); // bucket index shard must exist
78737874
cls_rgw_guard_bucket_resharding(op, -ERR_BUSY_RESHARDING);
78747875
cls_rgw_bucket_unlink_instance(op, key, op_tag,
7875-
olh_tag, olh_epoch, log_op, null_verid, zones_trace);
7876+
olh_tag, olh_epoch, log_op, bilog_flags, zones_trace);
78767877
return rgw_rados_operate(dpp, ref.ioctx, ref.obj.oid, &op, y);
78777878
}, y);
78787879
if (r < 0) {
@@ -8408,7 +8409,7 @@ int RGWRados::set_olh(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx,
84088409
}
84098410

84108411
int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
8411-
uint64_t olh_epoch, optional_yield y, bool null_verid, 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)
84128413
{
84138414
string op_tag;
84148415

@@ -8447,7 +8448,13 @@ int RGWRados::unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& o
84478448
std::this_thread::sleep_for(cct->_conf->rgw_debug_inject_latency_bi_unlink * std::chrono::seconds{1});
84488449
}
84498450

8450-
ret = bucket_index_unlink_instance(dpp, bucket_info, target_obj, op_tag, olh_tag, olh_epoch, y, null_verid, 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);
84518458
if (ret < 0) {
84528459
olh_cancel_modification(dpp, bucket_info, *state, olh_obj, op_tag, y);
84538460
ldpp_dout(dpp, 20) << "bucket_index_unlink_instance() target_obj=" << target_obj << " returned " << ret << dendl;

src/rgw/driver/rados/rgw_rados.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1359,7 +1359,7 @@ class RGWRados
13591359
const rgw_obj& obj_instance,
13601360
const std::string& op_tag, const std::string& olh_tag,
13611361
uint64_t olh_epoch, optional_yield y,
1362-
bool null_verid,
1362+
uint16_t bilog_flags,
13631363
rgw_zone_set *zones_trace = nullptr,
13641364
bool log_op = true);
13651365
int bucket_index_read_olh_log(const DoutPrefixProvider *dpp,
@@ -1396,7 +1396,7 @@ class RGWRados
13961396
int repair_olh(const DoutPrefixProvider *dpp, RGWObjState* state, const RGWBucketInfo& bucket_info,
13971397
const rgw_obj& obj, optional_yield y);
13981398
int unlink_obj_instance(const DoutPrefixProvider *dpp, RGWObjectCtx& obj_ctx, RGWBucketInfo& bucket_info, const rgw_obj& target_obj,
1399-
uint64_t olh_epoch, optional_yield y, bool null_verid, rgw_zone_set *zones_trace = nullptr, bool log_op = true);
1399+
uint64_t olh_epoch, optional_yield y, uint16_t bilog_flags, bool null_verid, rgw_zone_set *zones_trace = nullptr, bool log_op = true);
14001400

14011401
void check_pending_olh_entries(const DoutPrefixProvider *dpp, std::map<std::string, bufferlist>& pending_entries, std::map<std::string, bufferlist> *rm_pending_entries);
14021402
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);

src/rgw/rgw_op.cc

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5123,11 +5123,7 @@ void RGWDeleteObj::execute(optional_yield y)
51235123
{
51245124
int state_loaded = -1;
51255125
bool check_obj_lock = s->object->have_instance() && s->bucket->get_info().obj_lock_enabled();
5126-
if (s->object->get_instance() == "null") {
5127-
null_verid = 1;
5128-
} else {
5129-
null_verid = 0;
5130-
}
5126+
null_verid = (s->object->get_instance() == "null");
51315127

51325128
op_ret = state_loaded = s->object->load_obj_state(this, s->yield, true);
51335129
if (op_ret < 0) {
@@ -5227,7 +5223,6 @@ void RGWDeleteObj::execute(optional_yield y)
52275223
del_op->params.marker_version_id = version_id;
52285224
del_op->params.null_verid = null_verid;
52295225

5230-
ldpp_dout(this, 1) << "del_op->params.null_verid " << del_op->params.null_verid << dendl;
52315226
op_ret = del_op->delete_obj(this, y, rgw::sal::FLAG_LOG_OP);
52325227
if (op_ret >= 0) {
52335228
delete_marker = del_op->result.delete_marker;

src/test/rgw/rgw_multi/tests.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,8 @@ def test_null_version_id_delete():
949949

950950
bucket.delete_key(obj, version_id='null')
951951

952+
bucket.delete_key(obj, version_id=key2.version_id)
953+
952954
zonegroup_bucket_checkpoint(zonegroup_conns, bucket.name)
953955

954956
def test_concurrent_versioned_object_incremental_sync():

0 commit comments

Comments
 (0)