Skip to content

Commit 482e5b8

Browse files
committed
test/store_test: get rid off explicit offset specifications in shared
blob repair test case. Signed-off-by: Igor Fedotov <[email protected]>
1 parent 1e6d555 commit 482e5b8

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
@@ -10815,6 +10815,12 @@ int BlueStore::_fsck_on_open(BlueStore::FSCKDepth depth, bool repair)
1081510815
return repair ? errors + warnings - (int)repaired : errors;
1081610816
}
1081710817

10818+
int BlueStore::get_shared_blob(const string& key,
10819+
bufferlist& bl)
10820+
{
10821+
return db->get(PREFIX_SHARED_BLOB, key, &bl);
10822+
};
10823+
1081810824
/// methods to inject various errors fsck can repair
1081910825
void BlueStore::inject_broken_shared_blob_key(const string& key,
1082010826
const bufferlist& bl)

src/os/bluestore/BlueStore.h

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

33473347
/// methods to inject various errors fsck can repair
3348+
int get_shared_blob(const std::string& key,
3349+
ceph::buffer::list& bl);
33483350
void inject_broken_shared_blob_key(const std::string& key,
33493351
const ceph::buffer::list& bl);
33503352
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
@@ -9670,13 +9670,26 @@ TEST_P(StoreTestSpecificAUSize, BluestoreRepairSharedBlobTest) {
96709670
bstore->umount();
96719671
bstore->mount();
96729672
{
9673+
bufferlist bl;
96739674
string key;
96749675
_key_encode_u64(1, &key);
96759676
bluestore_shared_blob_t sb(1);
9676-
sb.ref_map.get(0x822000, block_size);
9677-
sb.ref_map.get(0x824000, block_size);
9678-
sb.ref_map.get(0x824000, block_size);
9679-
bufferlist bl;
9677+
int r = bstore->get_shared_blob(key, bl);
9678+
ASSERT_EQ(r, 0);
9679+
decode(sb, bl);
9680+
cout << sb.ref_map << std::endl;
9681+
ASSERT_EQ(sb.ref_map.ref_map.size(), 2);
9682+
auto it = sb.ref_map.ref_map.begin();
9683+
ASSERT_EQ(it->second.refs, 1);
9684+
ASSERT_EQ(it->second.length, block_size);
9685+
it++;
9686+
ASSERT_EQ(it->second.refs, 1);
9687+
ASSERT_EQ(it->second.length, block_size);
9688+
9689+
sb.ref_map.get(it->first, block_size);
9690+
cout << sb.ref_map << std::endl;
9691+
9692+
bl.clear();
96809693
encode(sb, bl);
96819694
bstore->inject_broken_shared_blob_key(key, bl);
96829695
}

0 commit comments

Comments
 (0)