@@ -149,7 +149,8 @@ void ReplicationStateMachine::on_error(ReplServiceError error, const sisl::blob&
149
149
}
150
150
151
151
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) {
153
154
const ReplicationMessageHeader* msg_header = r_cast< const ReplicationMessageHeader* >(header.cbytes ());
154
155
switch (msg_header->msg_type ) {
155
156
case ReplicationMessageType::CREATE_SHARD_MSG: {
@@ -546,9 +547,8 @@ folly::Future< std::error_code > ReplicationStateMachine::on_fetch_data(const in
546
547
// from Header.
547
548
auto sb =
548
549
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 ());
552
552
553
553
RELEASE_ASSERT (
554
554
sgs.size == expected_size,
@@ -557,7 +557,7 @@ folly::Future< std::error_code > ReplicationStateMachine::on_fetch_data(const in
557
557
558
558
// TODO::return error_code if assert fails, so it will not crash here because of the assert failure.
559
559
560
- std::memcpy (given_buffer, sb, total_size );
560
+ std::memcpy (given_buffer, sb, raw_size );
561
561
return folly::makeFuture< std::error_code >(std::error_code{});
562
562
}
563
563
0 commit comments