Skip to content

Commit 7fab6b8

Browse files
fix fetch data bug (#284)
fix a memcpy issuse when create/seal shard, where we should cp the shard_super_blk. we need copy the exact size of shard_super_blk,not the whole blk size
1 parent 1a73a58 commit 7fab6b8

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

conanfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
class HomeObjectConan(ConanFile):
1111
name = "homeobject"
12-
version = "2.3.10"
12+
version = "2.3.11"
1313

1414
homepage = "https://github.com/eBay/HomeObject"
1515
description = "Blob Store built on HomeReplication"

src/lib/homestore_backend/replication_state_machine.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,8 @@ void ReplicationStateMachine::on_error(ReplServiceError error, const sisl::blob&
149149
}
150150

151151
homestore::ReplResult< homestore::blk_alloc_hints >
152-
ReplicationStateMachine::get_blk_alloc_hints(sisl::blob const& header, uint32_t data_size, cintrusive< homestore::repl_req_ctx >& hs_ctx) {
152+
ReplicationStateMachine::get_blk_alloc_hints(sisl::blob const& header, uint32_t data_size,
153+
cintrusive< homestore::repl_req_ctx >& hs_ctx) {
153154
const ReplicationMessageHeader* msg_header = r_cast< const ReplicationMessageHeader* >(header.cbytes());
154155
switch (msg_header->msg_type) {
155156
case ReplicationMessageType::CREATE_SHARD_MSG: {
@@ -546,9 +547,8 @@ folly::Future< std::error_code > ReplicationStateMachine::on_fetch_data(const in
546547
// from Header.
547548
auto sb =
548549
r_cast< HSHomeObject::shard_info_superblk const* >(header.cbytes() + sizeof(ReplicationMessageHeader));
549-
550-
auto const expected_size =
551-
sisl::round_up(sizeof(HSHomeObject::shard_info_superblk), repl_dev()->get_blk_size());
550+
auto const raw_size = sizeof(HSHomeObject::shard_info_superblk);
551+
auto const expected_size = sisl::round_up(raw_size, repl_dev()->get_blk_size());
552552

553553
RELEASE_ASSERT(
554554
sgs.size == expected_size,
@@ -557,7 +557,7 @@ folly::Future< std::error_code > ReplicationStateMachine::on_fetch_data(const in
557557

558558
// TODO::return error_code if assert fails, so it will not crash here because of the assert failure.
559559

560-
std::memcpy(given_buffer, sb, total_size);
560+
std::memcpy(given_buffer, sb, raw_size);
561561
return folly::makeFuture< std::error_code >(std::error_code{});
562562
}
563563

0 commit comments

Comments
 (0)