Skip to content

Commit d5af663

Browse files
authored
Merge pull request ceph#55130 from ifed01/wip-ifed-better-shared-blob-repair
test/store_test: get rid off explicit offset specifications in shared Reviewed-by: Pere Diaz Bou <[email protected]>
2 parents 815fd8c + 482e5b8 commit d5af663

File tree

3 files changed

+25
-4
lines changed

3 files changed

+25
-4
lines changed

src/os/bluestore/BlueStore.cc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11042,6 +11042,12 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
1104211042
return repair ? errors + warnings - (int)repaired : errors;
1104311043
}
1104411044

11045+
int BlueStore::get_shared_blob(const string& key,
11046+
bufferlist& bl)
11047+
{
11048+
return db->get(PREFIX_SHARED_BLOB, key, &bl);
11049+
};
11050+
1104511051
/// methods to inject various errors fsck can repair
1104611052
void BlueStore::inject_broken_shared_blob_key(const string& key,
1104711053
const bufferlist& bl)

src/os/bluestore/BlueStore.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3374,6 +3374,8 @@ class BlueStore : public ObjectStore,
33743374
}
33753375

33763376
/// methods to inject various errors fsck can repair
3377+
int get_shared_blob(const std::string& key,
3378+
ceph::buffer::list& bl);
33773379
void inject_broken_shared_blob_key(const std::string& key,
33783380
const ceph::buffer::list& bl);
33793381
void inject_no_shared_blob_key();

src/test/objectstore/store_test.cc

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10191,13 +10191,26 @@ TEST_P(StoreTestSpecificAUSize, BluestoreRepairSharedBlobTest) {
1019110191
bstore->umount();
1019210192
bstore->mount();
1019310193
{
10194+
bufferlist bl;
1019410195
string key;
1019510196
_key_encode_u64(1, &key);
1019610197
bluestore_shared_blob_t sb(1);
10197-
sb.ref_map.get(0x822000, block_size);
10198-
sb.ref_map.get(0x824000, block_size);
10199-
sb.ref_map.get(0x824000, block_size);
10200-
bufferlist bl;
10198+
int r = bstore->get_shared_blob(key, bl);
10199+
ASSERT_EQ(r, 0);
10200+
decode(sb, bl);
10201+
cout << sb.ref_map << std::endl;
10202+
ASSERT_EQ(sb.ref_map.ref_map.size(), 2);
10203+
auto it = sb.ref_map.ref_map.begin();
10204+
ASSERT_EQ(it->second.refs, 1);
10205+
ASSERT_EQ(it->second.length, block_size);
10206+
it++;
10207+
ASSERT_EQ(it->second.refs, 1);
10208+
ASSERT_EQ(it->second.length, block_size);
10209+
10210+
sb.ref_map.get(it->first, block_size);
10211+
cout << sb.ref_map << std::endl;
10212+
10213+
bl.clear();
1020110214
encode(sb, bl);
1020210215
bstore->inject_broken_shared_blob_key(key, bl);
1020310216
}

0 commit comments

Comments
 (0)