op_ret.is_truncated = (iter != log.end());
}
+ // this is for backward compatibility
+ if (!op.get_stales) {
+ auto iter = op_ret.log.begin();
+ while (iter != op_ret.log.end()) {
+ std::erase_if(iter->second, [](const auto& e) { return e.op == CLS_RGW_OLH_OP_STALE; });
+ if (iter->second.empty()) {
+ iter = op_ret.log.erase(iter);
+ } else {
+ ++iter;
+ }
+ }
+ }
+
encode(op_ret, *out);
return 0;
call.olh = olh;
call.ver_marker = ver_marker;
call.olh_tag = olh_tag;
+ call.get_stales = true;
encode(call, in);
op.exec(RGW_CLASS, RGW_BUCKET_READ_OLH_LOG, in, new ClsBucketIndexOpCtx<rgw_cls_read_olh_log_ret>(&log_ret, &op_ret));
}
op.olh.name = "name";
op.ver_marker = 123;
op.olh_tag = "olh_tag";
+ op.get_stales = true;
o.push_back(std::move(op));
o.emplace_back();
encode_json("olh", olh, f);
encode_json("ver_marker", ver_marker, f);
encode_json("olh_tag", olh_tag, f);
+ encode_json("get_stales", get_stales, f);
}
list<rgw_cls_read_olh_log_ret> rgw_cls_read_olh_log_ret::generate_test_instances()
cls_rgw_obj_key olh;
uint64_t ver_marker;
std::string olh_tag;
+ bool get_stales;
- rgw_cls_read_olh_log_op() : ver_marker(0) {}
+ rgw_cls_read_olh_log_op() : ver_marker(0), get_stales(false) {}
void encode(ceph::buffer::list &bl) const {
- ENCODE_START(1, 1, bl);
+ ENCODE_START(2, 1, bl);
encode(olh, bl);
encode(ver_marker, bl);
encode(olh_tag, bl);
+ encode(get_stales, bl);
ENCODE_FINISH(bl);
}
void decode(ceph::buffer::list::const_iterator &bl) {
- DECODE_START(1, bl);
+ DECODE_START(2, bl);
decode(olh, bl);
decode(ver_marker, bl);
decode(olh_tag, bl);
+ if (struct_v >= 2) {
+ decode(get_stales, bl);
+ }
DECODE_FINISH(bl);
}
static std::list<rgw_cls_read_olh_log_op> generate_test_instances();