From 2c94978c29afb4f76adf50016bf69e258496c9db Mon Sep 17 00:00:00 2001 From: "Adam C. Emerson" Date: Sun, 13 Dec 2020 20:30:52 -0500 Subject: [PATCH] rgw: Add gen_id to rgw_data_change Signed-off-by: Adam C. Emerson --- src/rgw/rgw_datalog.cc | 2 ++ src/rgw/rgw_datalog.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/rgw/rgw_datalog.cc b/src/rgw/rgw_datalog.cc index 7b4cd29afb8..5ef5d502c76 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 85ce61b8112..7df3be937cd 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); } -- 2.47.3