Skip to content

Commit 880a17e

Browse files
bill-scalesaainscow
authored andcommitted
osd: Optimized EC present_shards no longer needed
present_shards is no longer needed in the PG log entry, this has been replaced with code in proc_master_log that calculates which shards were in the last epoch started and are still present. Signed-off-by: Bill Scales <[email protected]>
1 parent bc3c9d1 commit 880a17e

File tree

6 files changed

+9
-24
lines changed

6 files changed

+9
-24
lines changed

src/osd/ECTransaction.cc

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ ECTransaction::Generate::Generate(PGTransaction &t,
588588
shard_written(shard_id_t(0));
589589
}
590590

591-
written_and_present_shards();
591+
written_shards();
592592

593593
if (!op.attr_updates.empty()) {
594594
attr_updates();
@@ -855,7 +855,7 @@ void ECTransaction::Generate::appends_and_clone_ranges() {
855855
}
856856
}
857857

858-
void ECTransaction::Generate::written_and_present_shards() {
858+
void ECTransaction::Generate::written_shards() {
859859
if (entry) {
860860
if (!rollback_extents.empty()) {
861861
entry->mod_desc.rollback_extents(
@@ -869,14 +869,6 @@ void ECTransaction::Generate::written_and_present_shards() {
869869
entry->written_shards.clear();
870870
written_shards_final = true;
871871
}
872-
// Calculate set of present shards
873-
for (auto &&[shard, t]: transactions) {
874-
entry->present_shards.insert(shard);
875-
}
876-
if (entry->present_shards.size() == sinfo.get_k_plus_m()) {
877-
// More efficient to encode an empty set for all shards
878-
entry->present_shards.clear();
879-
}
880872

881873
// Update shard_versions in object_info to record which shards are being
882874
// written
@@ -932,7 +924,6 @@ void ECTransaction::Generate::written_and_present_shards() {
932924
}
933925
ldpp_dout(dpp, 20) << __func__ << " shard_info: oid=" << oid
934926
<< " version=" << entry->version
935-
<< " present=" << entry->present_shards
936927
<< " written=" << entry->written_shards
937928
<< " shard_versions=" << oi.shard_versions << dendl;
938929
}

src/osd/ECTransaction.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ class Generate {
106106
void truncate();
107107
void overlay_writes();
108108
void appends_and_clone_ranges();
109-
void written_and_present_shards();
109+
void written_shards();
110110
void attr_updates();
111111

112112
public:

src/osd/PGBackend.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,6 @@ void PGBackend::partial_write(
423423
auto dpp = get_parent()->get_dpp();
424424
ldpp_dout(dpp, 20) << __func__ << " version=" << entry.version
425425
<< " written_shards=" << entry.written_shards
426-
<< " present_shards=" << entry.present_shards
427426
<< " pwlc=" << info->partial_writes_last_complete
428427
<< " previous_version=" << previous_version
429428
<< dendl;

src/osd/PeeringState.cc

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,10 +3428,8 @@ void PeeringState::proc_master_log(
34283428
for (auto&& [pg_shard, pi] : all_info) {
34293429
psdout(20) << "version " << p->version
34303430
<< " testing osd " << pg_shard
3431-
<< " written=" << p->written_shards
3432-
<< " present=" << p->present_shards << dendl;
3433-
if (p->is_present_shard(pg_shard.shard) &&
3434-
p->is_written_shard(pg_shard.shard)) {
3431+
<< " written=" << p->written_shards << dendl;
3432+
if (p->is_written_shard(pg_shard.shard)) {
34353433
if (pi.last_update < p->version) {
34363434
if (!shards_with_update.contains(pg_shard.shard)) {
34373435
shards_without_update.insert(pg_shard.shard);

src/osd/osd_types.cc

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5064,7 +5064,8 @@ void pg_log_entry_t::encode(ceph::buffer::list &bl) const
50645064
encode(return_code, bl);
50655065
encode(op_returns, bl);
50665066
encode(written_shards, bl);
5067-
encode(present_shards, bl);
5067+
shard_id_set unused;
5068+
encode(unused, bl);
50685069
ENCODE_FINISH(bl);
50695070
}
50705071

@@ -5138,7 +5139,8 @@ void pg_log_entry_t::decode(ceph::buffer::list::const_iterator &bl)
51385139
}
51395140
if (struct_v >= 15) {
51405141
decode(written_shards, bl);
5141-
decode(present_shards, bl);
5142+
shard_id_set unused;
5143+
decode(unused, bl);
51425144
}
51435145
DECODE_FINISH(bl);
51445146
}
@@ -5190,7 +5192,6 @@ void pg_log_entry_t::dump(Formatter *f) const
51905192
f->close_section();
51915193
}
51925194
f->dump_stream("written_shards") << written_shards;
5193-
f->dump_stream("present_shards") << present_shards;
51945195
{
51955196
f->open_object_section("mod_desc");
51965197
mod_desc.dump(f);

src/osd/osd_types.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4517,7 +4517,6 @@ struct pg_log_entry_t {
45174517
ObjectCleanRegions clean_regions;
45184518

45194519
shard_id_set written_shards; // EC partial writes do not update every shard
4520-
shard_id_set present_shards; // EC partial writes need to know set of present shards
45214520

45224521
pg_log_entry_t()
45234522
: user_version(0), return_code(0), op(0),
@@ -4592,9 +4591,6 @@ struct pg_log_entry_t {
45924591
bool is_written_shard(const shard_id_t shard) const {
45934592
return written_shards.empty() || written_shards.contains(shard);
45944593
}
4595-
bool is_present_shard(const shard_id_t shard) const {
4596-
return present_shards.empty() || present_shards.contains(shard);
4597-
}
45984594

45994595
void encode_with_checksum(ceph::buffer::list& bl) const;
46004596
void decode_with_checksum(ceph::buffer::list::const_iterator& p);

0 commit comments

Comments
 (0)