]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
osd: EC optimizations: add shard_versions to object_info_t
authorBill Scales <156200352+bill-scales@users.noreply.github.com>
Thu, 6 Mar 2025 09:44:00 +0000 (09:44 +0000)
committerBill Scales <bill_scales@uk.ibm.com>
Mon, 7 Apr 2025 14:00:55 +0000 (15:00 +0100)
EC optimized pools do not always update every shard for every write I/O,
this includes not updating the object_info_t (OI attribute). This means
different shards can have OI indicaiting the object is at different
versions. When an I/O updates a subset of the shards, the OI for the
updated shards will record the old version number for the unmodified
shards in the shard_versions map. The latest OI therefore has a record
of the expected version number for all the shards which can be used to
work out what needs to be backfilled.

An empty shard_versions map imples that the OI attribute should be the
same on all shards.

Signed-off-by: Bill Scales <bill_scales@uk.ibm.com>
src/osd/osd_types.cc
src/osd/osd_types.h

index 366d98a6c2de6fa4c411f768e1efb034f307a12b..6068e6a1b1f9f985b68639f50e91afa4622663e4 100644 (file)
@@ -6439,7 +6439,7 @@ void object_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
   for (auto i = watchers.cbegin(); i != watchers.cend(); ++i) {
     old_watchers.insert(make_pair(i->first.second, i->second));
   }
-  ENCODE_START(17, 8, bl);
+  ENCODE_START(18, 8, bl);
   encode(soid, bl);
   encode(myoloc, bl);  //Retained for compatibility
   encode((__u32)0, bl); // was category, no longer used
@@ -6473,13 +6473,14 @@ void object_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
   if (has_manifest()) {
     encode(manifest, bl);
   }
+  encode(shard_versions, bl);
   ENCODE_FINISH(bl);
 }
 
 void object_info_t::decode(ceph::buffer::list::const_iterator& bl)
 {
   object_locator_t myoloc;
-  DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl);
+  DECODE_START_LEGACY_COMPAT_LEN(18, 8, 8, bl);
   map<entity_name_t, watch_info_t> old_watchers;
   decode(soid, bl);
   decode(myoloc, bl);
@@ -6565,6 +6566,9 @@ void object_info_t::decode(ceph::buffer::list::const_iterator& bl)
       decode(manifest, bl);
     }
   }
+  if (struct_v >= 18) {
+    decode(shard_versions, bl);
+  }
   DECODE_FINISH(bl);
 }
 
@@ -6604,6 +6608,14 @@ void object_info_t::dump(Formatter *f) const
     f->close_section();
   }
   f->close_section();
+  f->open_array_section("shard_versions");
+  for (auto p = shard_versions.cbegin(); p != shard_versions.cend(); ++p) {
+    f->open_object_section("shard");
+    f->dump_int("id", int(p->first));
+    f->dump_stream("version") << p->second;
+    f->close_section();
+  }
+  f->close_section();
 }
 
 void object_info_t::generate_test_instances(list<object_info_t*>& o)
index c1786b56d7a4c0744ec60dbd3627a908bfc1b843..b521f82183b7602b38c9cdae5a1dffeceec2db91 100644 (file)
@@ -6088,6 +6088,8 @@ struct object_info_t {
 
   struct object_manifest_t manifest;
 
+  std::map<shard_id_t,eversion_t> shard_versions;
+
   void copy_user_bits(const object_info_t& other);
 
   bool test_flag(flag_t f) const {