Skip to content

Commit 71702bf

Browse files
committed
osd: EC optimizations: add written and present shard sets to pg_log_enty_t
Add two new sets to the pg_log_entry for use by EC optimization pools. The written shards set tracks which shards were written to, the present shards set tracks which shards were in the acting set at the time of the write. An empty set (default) is used to indicate all shards. For pools without allow_ec_optimizations the written set is empty (indicating all shards are written) and the present set is empty and unused. Signed-off-by: Bill Scales <[email protected]>
1 parent 42dc7bb commit 71702bf

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/osd/osd_types.cc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4954,7 +4954,7 @@ void pg_log_entry_t::decode_with_checksum(ceph::buffer::list::const_iterator& p)
49544954

49554955
void pg_log_entry_t::encode(ceph::buffer::list &bl) const
49564956
{
4957-
ENCODE_START(14, 4, bl);
4957+
ENCODE_START(15, 4, bl);
49584958
encode(op, bl);
49594959
encode(soid, bl);
49604960
encode(version, bl);
@@ -4987,12 +4987,14 @@ void pg_log_entry_t::encode(ceph::buffer::list &bl) const
49874987
if (op != ERROR)
49884988
encode(return_code, bl);
49894989
encode(op_returns, bl);
4990+
encode(written_shards, bl);
4991+
encode(present_shards, bl);
49904992
ENCODE_FINISH(bl);
49914993
}
49924994

49934995
void pg_log_entry_t::decode(ceph::buffer::list::const_iterator &bl)
49944996
{
4995-
DECODE_START_LEGACY_COMPAT_LEN(14, 4, 4, bl);
4997+
DECODE_START_LEGACY_COMPAT_LEN(15, 4, 4, bl);
49964998
decode(op, bl);
49974999
if (struct_v < 2) {
49985000
sobject_t old_soid;
@@ -5058,6 +5060,10 @@ void pg_log_entry_t::decode(ceph::buffer::list::const_iterator &bl)
50585060
}
50595061
decode(op_returns, bl);
50605062
}
5063+
if (struct_v >= 15) {
5064+
decode(written_shards, bl);
5065+
decode(present_shards, bl);
5066+
}
50615067
DECODE_FINISH(bl);
50625068
}
50635069

@@ -5107,6 +5113,8 @@ void pg_log_entry_t::dump(Formatter *f) const
51075113
f->dump_unsigned("snap", *p);
51085114
f->close_section();
51095115
}
5116+
f->dump_stream("written_shards") << written_shards;
5117+
f->dump_stream("present_shards") << present_shards;
51105118
{
51115119
f->open_object_section("mod_desc");
51125120
mod_desc.dump(f);

src/osd/osd_types.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4463,6 +4463,9 @@ struct pg_log_entry_t {
44634463
bool invalid_pool; // only when decoding pool-less hobject based entries
44644464
ObjectCleanRegions clean_regions;
44654465

4466+
shard_id_set written_shards; // EC partial writes do not update every shard
4467+
shard_id_set present_shards; // EC partial writes need to know set of present shards
4468+
44664469
pg_log_entry_t()
44674470
: user_version(0), return_code(0), op(0),
44684471
invalid_hash(false), invalid_pool(false) {
@@ -4531,6 +4534,15 @@ struct pg_log_entry_t {
45314534
}
45324535

45334536
std::string get_key_name() const;
4537+
4538+
/// EC partial writes: test if a shard was written
4539+
bool is_written_shard(const shard_id_t shard) const {
4540+
return written_shards.empty() || written_shards.contains(shard);
4541+
}
4542+
bool is_present_shard(const shard_id_t shard) const {
4543+
return present_shards.empty() || present_shards.contains(shard);
4544+
}
4545+
45344546
void encode_with_checksum(ceph::buffer::list& bl) const;
45354547
void decode_with_checksum(ceph::buffer::list::const_iterator& p);
45364548

0 commit comments

Comments
 (0)