Skip to content

Commit 88ac6d9

Browse files
committed
osd: EC optimizations: add shard_versions to object_info_t
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 <[email protected]>
1 parent 71702bf commit 88ac6d9

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/osd/osd_types.cc

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6439,7 +6439,7 @@ void object_info_t::encode(ceph::buffer::list& bl, uint64_t features) const
64396439
for (auto i = watchers.cbegin(); i != watchers.cend(); ++i) {
64406440
old_watchers.insert(make_pair(i->first.second, i->second));
64416441
}
6442-
ENCODE_START(17, 8, bl);
6442+
ENCODE_START(18, 8, bl);
64436443
encode(soid, bl);
64446444
encode(myoloc, bl); //Retained for compatibility
64456445
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
64736473
if (has_manifest()) {
64746474
encode(manifest, bl);
64756475
}
6476+
encode(shard_versions, bl);
64766477
ENCODE_FINISH(bl);
64776478
}
64786479

64796480
void object_info_t::decode(ceph::buffer::list::const_iterator& bl)
64806481
{
64816482
object_locator_t myoloc;
6482-
DECODE_START_LEGACY_COMPAT_LEN(17, 8, 8, bl);
6483+
DECODE_START_LEGACY_COMPAT_LEN(18, 8, 8, bl);
64836484
map<entity_name_t, watch_info_t> old_watchers;
64846485
decode(soid, bl);
64856486
decode(myoloc, bl);
@@ -6565,6 +6566,9 @@ void object_info_t::decode(ceph::buffer::list::const_iterator& bl)
65656566
decode(manifest, bl);
65666567
}
65676568
}
6569+
if (struct_v >= 18) {
6570+
decode(shard_versions, bl);
6571+
}
65686572
DECODE_FINISH(bl);
65696573
}
65706574

@@ -6604,6 +6608,14 @@ void object_info_t::dump(Formatter *f) const
66046608
f->close_section();
66056609
}
66066610
f->close_section();
6611+
f->open_array_section("shard_versions");
6612+
for (auto p = shard_versions.cbegin(); p != shard_versions.cend(); ++p) {
6613+
f->open_object_section("shard");
6614+
f->dump_int("id", int(p->first));
6615+
f->dump_stream("version") << p->second;
6616+
f->close_section();
6617+
}
6618+
f->close_section();
66076619
}
66086620

66096621
void object_info_t::generate_test_instances(list<object_info_t*>& o)

src/osd/osd_types.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6088,6 +6088,8 @@ struct object_info_t {
60886088

60896089
struct object_manifest_t manifest;
60906090

6091+
std::map<shard_id_t,eversion_t> shard_versions;
6092+
60916093
void copy_user_bits(const object_info_t& other);
60926094

60936095
bool test_flag(flag_t f) const {

0 commit comments

Comments
 (0)