From: Adam C. Emerson Date: Mon, 14 Dec 2020 01:30:52 +0000 (-0500) Subject: rgw: Add gen_id to rgw_data_change X-Git-Tag: v18.0.0~787^2~123 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=2c94978c29afb4f76adf50016bf69e258496c9db;p=ceph.git rgw: Add gen_id to rgw_data_change Signed-off-by: Adam C. Emerson --- diff --git a/src/rgw/rgw_datalog.cc b/src/rgw/rgw_datalog.cc index 7b4cd29afb8b..5ef5d502c768 100644 --- a/src/rgw/rgw_datalog.cc +++ b/src/rgw/rgw_datalog.cc @@ -41,6 +41,7 @@ void rgw_data_change::dump(ceph::Formatter *f) const encode_json("key", key, f); utime_t ut(timestamp); encode_json("timestamp", ut, f); + encode_json("gen_id", gen_id, f); } void rgw_data_change::decode_json(JSONObj *obj) { @@ -55,6 +56,7 @@ void rgw_data_change::decode_json(JSONObj *obj) { utime_t ut; JSONDecoder::decode_json("timestamp", ut, obj); timestamp = ut.to_real_time(); + JSONDecoder::decode_json("gen_id", gen_id, obj); } void rgw_data_change_log_entry::dump(Formatter *f) const diff --git a/src/rgw/rgw_datalog.h b/src/rgw/rgw_datalog.h index 85ce61b8112b..7df3be937cd1 100644 --- a/src/rgw/rgw_datalog.h +++ b/src/rgw/rgw_datalog.h @@ -52,23 +52,29 @@ struct rgw_data_change { DataLogEntityType entity_type; std::string key; ceph::real_time timestamp; + uint64_t gen_id; void encode(ceph::buffer::list& bl) const { - ENCODE_START(1, 1, bl); + ENCODE_START(2, 2, bl); auto t = std::uint8_t(entity_type); encode(t, bl); encode(key, bl); encode(timestamp, bl); + encode(gen_id, bl); ENCODE_FINISH(bl); } void decode(bufferlist::const_iterator& bl) { - DECODE_START(1, bl); + DECODE_START(2, bl); std::uint8_t t; decode(t, bl); entity_type = DataLogEntityType(t); decode(key, bl); decode(timestamp, bl); + if (struct_v < 2) + gen_id = 0; + else + decode(gen_id, bl); DECODE_FINISH(bl); }