]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: incremental bucket sync status stores timestamp
authorCasey Bodley <cbodley@redhat.com>
Tue, 31 Mar 2020 13:22:48 +0000 (09:22 -0400)
committerCasey Bodley <cbodley@redhat.com>
Mon, 13 Apr 2020 15:06:46 +0000 (11:06 -0400)
Signed-off-by: Casey Bodley <cbodley@redhat.com>
src/rgw/rgw_data_sync.cc
src/rgw/rgw_data_sync.h
src/rgw/rgw_json_enc.cc

index 64c6710d9bf1c80cbcc33ce5e75e6f0f50230e60..e11e7419d3455c0f63cfdb45bd67fa2b906719fb 100644 (file)
@@ -3408,11 +3408,12 @@ public:
 
   RGWCoroutine *store_marker(const string& new_marker, uint64_t index_pos, const real_time& timestamp) override {
     sync_marker.position = new_marker;
+    sync_marker.timestamp = timestamp;
 
     map<string, bufferlist> attrs;
     sync_marker.encode_attr(attrs);
 
-    tn->log(20, SSTR("updating marker marker_oid=" << marker_oid << " marker=" << new_marker));
+    tn->log(20, SSTR("updating marker marker_oid=" << marker_oid << " marker=" << new_marker << " timestamp=" << timestamp));
     return new RGWSimpleRadosWriteAttrsCR(sync_env->async_rados,
                                           sync_env->svc->sysobj,
                                           rgw_raw_obj(sync_env->svc->zone->get_zone_params().log_pool, marker_oid),
index 9a2174bed5c55f809531ad66a118e1e8386c42e4..2d472ba784f3440503cf289c03d9a83a1a373988 100644 (file)
@@ -474,29 +474,28 @@ WRITE_CLASS_ENCODER(rgw_bucket_shard_full_sync_marker)
 
 struct rgw_bucket_shard_inc_sync_marker {
   string position;
-
-  rgw_bucket_shard_inc_sync_marker() {}
+  ceph::real_time timestamp;
 
   void encode_attr(map<string, bufferlist>& attrs);
 
   void encode(bufferlist& bl) const {
-    ENCODE_START(1, 1, bl);
+    ENCODE_START(2, 1, bl);
     encode(position, bl);
+    encode(timestamp, bl);
     ENCODE_FINISH(bl);
   }
 
   void decode(bufferlist::const_iterator& bl) {
-     DECODE_START(1, bl);
+    DECODE_START(2, bl);
     decode(position, bl);
-     DECODE_FINISH(bl);
+    if (struct_v >= 2) {
+      decode(timestamp, bl);
+    }
+    DECODE_FINISH(bl);
   }
 
   void dump(Formatter *f) const;
   void decode_json(JSONObj *obj);
-
-  bool operator<(const rgw_bucket_shard_inc_sync_marker& m) const {
-    return (position < m.position);
-  }
 };
 WRITE_CLASS_ENCODER(rgw_bucket_shard_inc_sync_marker)
 
index 8083212e33b570f4f960c13df1751d1592d105da..ff5996b9bfaefa2d9768eef1a43a1b0890154746 100644 (file)
@@ -1768,11 +1768,13 @@ void rgw_bucket_shard_full_sync_marker::dump(Formatter *f) const
 void rgw_bucket_shard_inc_sync_marker::decode_json(JSONObj *obj)
 {
   JSONDecoder::decode_json("position", position, obj);
+  JSONDecoder::decode_json("timestamp", timestamp, obj);
 }
 
 void rgw_bucket_shard_inc_sync_marker::dump(Formatter *f) const
 {
   encode_json("position", position, f);
+  encode_json("timestamp", timestamp, f);
 }
 
 void rgw_bucket_shard_sync_info::decode_json(JSONObj *obj)