]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: Add gen_id to rgw_data_change
authorAdam C. Emerson <aemerson@redhat.com>
Mon, 14 Dec 2020 01:30:52 +0000 (20:30 -0500)
committerCasey Bodley <cbodley@redhat.com>
Fri, 27 May 2022 19:47:32 +0000 (15:47 -0400)
Signed-off-by: Adam C. Emerson <aemerson@redhat.com>
src/rgw/rgw_datalog.cc
src/rgw/rgw_datalog.h

index 7b4cd29afb8b582b811d65ebdc59165b18dc25c6..5ef5d502c768aae22b282918dfa5f60ee606f458 100644 (file)
@@ -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
index 85ce61b8112bfa71619d69960e8c73c1b5f67d8a..7df3be937cd1d067943fb71693fd80b49f4cfa56 100644 (file)
@@ -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);
   }