Skip to content

Commit

Permalink
Fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
koujl committed Nov 20, 2024
1 parent 133fe0b commit f96844f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/lib/homestore_backend/hs_homeobject.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,6 @@ class HSHomeObject : public HomeObjectImpl {
shard_id_t get_next_shard() const;

shard_id_t shard_cursor_{invalid_shard_id};
blob_id_t blob_cursor_{0};
snp_batch_id_t cur_batch_num_{0};
std::vector< shard_id_t > shard_list_;

Expand Down
1 change: 0 additions & 1 deletion src/lib/homestore_backend/hs_pg_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ HSHomeObject::HS_PG* HSHomeObject::local_create_pg(shared< ReplDev > repl_dev, P
}

// create index table and pg
// TODO create index table during create shard.
auto index_table = create_index_table();
auto uuid_str = boost::uuids::to_string(index_table->uuid());

Expand Down
21 changes: 9 additions & 12 deletions src/lib/homestore_backend/snapshot_receive_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ void HSHomeObject::SnapshotReceiveHandler::process_pg_snapshot_data(ResyncPGMeta
// Create local PG
PGInfo pg_info(pg_meta.pg_id());
std::copy_n(pg_meta.replica_set_uuid()->data(), 16, pg_info.replica_set_uuid.begin());
pg_info.size = pg_meta.members()->size();
for (unsigned int i = 0; i < pg_meta.members()->size(); i++) {
const auto member = pg_meta.members()->Get(i);
uuids::uuid id{};
Expand Down Expand Up @@ -88,7 +87,6 @@ int HSHomeObject::SnapshotReceiveHandler::process_shard_snapshot_data(ResyncShar
// Now let's create local shard
home_obj_.local_create_shard(shard_sb.info, chunk_id, blk_id.blk_count());
shard_cursor_ = shard_meta.shard_id();
blob_cursor_ = 0;
cur_batch_num_ = 0;
return 0;
}
Expand Down Expand Up @@ -120,17 +118,18 @@ int HSHomeObject::SnapshotReceiveHandler::process_blobs_snapshot_data(ResyncBlob
}

auto blob_data = blob->data()->Data();
auto header = r_cast< BlobHeader const* >(blob_data);
if (header->valid()) {
LOGE("Invalid header found for blob_id {}: [header={}]", blob->blob_id(), header->to_string());
return INVALID_BLOB_HEADER;
}
std::string user_key = header->user_key_size
? std::string(r_cast< const char* >(blob_data + sizeof(BlobHeader)), header->user_key_size)
: std::string{};

// Check integrity of normal blobs
if (blob->state() != static_cast< uint8_t >(ResyncBlobState::CORRUPTED)) {
auto header = r_cast< BlobHeader const* >(blob_data);
if (!header->valid()) {
LOGE("Invalid header found for blob_id {}: [header={}]", blob->blob_id(), header->to_string());
return INVALID_BLOB_HEADER;
}
std::string user_key = header->user_key_size
? std::string(r_cast< const char* >(blob_data + sizeof(BlobHeader)), header->user_key_size)
: std::string{};

uint8_t computed_hash[BlobHeader::blob_max_hash_len]{};
home_obj_.compute_blob_payload_hash(header->hash_algorithm, blob_data + header->data_offset,
header->blob_size, uintptr_cast(user_key.data()), header->user_key_size,
Expand Down Expand Up @@ -189,8 +188,6 @@ int HSHomeObject::SnapshotReceiveHandler::process_blobs_snapshot_data(ResyncBlob
free_allocated_blks();
return ADD_BLOB_INDEX_ERR;
}

blob_cursor_ = blob->blob_id();
}

return 0;
Expand Down
2 changes: 2 additions & 0 deletions src/lib/homestore_backend/tests/hs_blob_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,3 +207,5 @@ TEST_F(HomeObjectFixture, PGBlobIterator) {
// EXPECT_EQ(result.object_off, b.blob.object_off);
// }
}

TEST_F(HomeObjectFixture, SnapshotReceiveHandler) {}

0 comments on commit f96844f

Please sign in to comment.