Skip to content

Commit 2ab45a2

Browse files
committed
osd: Fix decode for some extent cache reads.
The extent cache in EC can cause the backend to perform some surprising reads. Some of the patterns were discovered in test that caused the decode to attempt to decode more data than was anticipated during the read planning, leading to an assert. This simple fix reduces the scope of the decode to the minimum. Signed-off-by: Alex Ainscow <[email protected]>
1 parent 72d55ee commit 2ab45a2

File tree

2 files changed

+26
-1
lines changed

2 files changed

+26
-1
lines changed

src/osd/ECUtil.cc

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,11 @@ int shard_extent_map_t::decode(const ErasureCodeInterfaceRef &ec_impl,
674674
*/
675675
decode_set.insert(decode_for_parity_shards);
676676
need_set.insert(decode_for_parity_shards);
677-
extent_set decode_for_parity = get_extent_superset();
677+
extent_set decode_for_parity;
678+
679+
for (auto shard : encode_set) {
680+
decode_for_parity.insert(want.at(shard));
681+
}
678682

679683
for (auto shard : decode_for_parity_shards) {
680684
extent_set parity_pad;

src/test/osd/TestECBackend.cc

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,3 +1481,24 @@ TEST(ECCommon, decode7) {
14811481

14821482
test_decode(k, m, chunk_size, object_size, want, acting_set);
14831483
}
1484+
1485+
TEST(ECCommon, decode8) {
1486+
const unsigned int k = 3;
1487+
const unsigned int m = 2;
1488+
const uint64_t chunk_size = 64 * 1024;
1489+
const uint64_t object_size = 672 * 1024;
1490+
1491+
1492+
ECUtil::shard_extent_set_t want(k+m);
1493+
shard_id_set acting_set;
1494+
want[shard_id_t(0)].insert(64 * 1024, 64 * 1024);
1495+
want[shard_id_t(2)].insert(32 * 1024, 32 * 1024);
1496+
want[shard_id_t(3)].insert(32 * 1024, 64 * 1024);
1497+
want[shard_id_t(4)].insert(32 * 1024, 64 * 1024);
1498+
1499+
1500+
acting_set.insert(shard_id_t(0));
1501+
acting_set.insert_range(shard_id_t(2), 2);
1502+
1503+
test_decode(k, m, chunk_size, object_size, want, acting_set);
1504+
}

0 commit comments

Comments
 (0)