Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor SnapshotReceiveHandler & Add UT #232

Merged
merged 5 commits into from
Nov 29, 2024

Conversation

koujl
Copy link

@koujl koujl commented Nov 26, 2024

  • Extract SnapshotContext from SnapshotReceiveHandler to split constant and mutable members
  • Add UT for SnapshotReceiveHandler and fix some bugs

@koujl koujl marked this pull request as ready for review November 26, 2024 10:18
Copy link
Collaborator

@xiaoxichen xiaoxichen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm aside from a few nit

There is a comment from Yaming to add flip points into each step, please create ticket to track that if we want to finish the code first

src/lib/homestore_backend/hs_homeobject.hpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/snapshot_receive_handler.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/replication_state_machine.cpp Outdated Show resolved Hide resolved
@@ -59,13 +58,14 @@ int HSHomeObject::SnapshotReceiveHandler::process_shard_snapshot_data(ResyncShar
shard_sb.chunk_id = chunk_id;

homestore::MultiBlkId blk_id;
const auto hints = home_obj_.chunk_selector()->chunk_to_hints(chunk_id);
const auto hints = home_obj_.chunk_selector()->chunk_to_hints(shard_sb.chunk_id);
auto status = homestore::data_service().alloc_blks(
sisl::round_up(sizeof(shard_sb), homestore::data_service().get_blk_size()), hints, blk_id);
if (status != homestore::BlkAllocStatus::SUCCESS) {
LOGE("Failed to allocate blocks for shard {}", shard_meta.shard_id());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not sure will we always baseline resync to a brand new member? if not, maybe we need to let emergency gc kick in here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We prefer to clean up all the existing data in the PG at the start of a snapshot resync to reduce complexity. The cleanup logic will be implemented later.

@codecov-commenter
Copy link

codecov-commenter commented Nov 28, 2024

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

Attention: Patch coverage is 64.06250% with 23 lines in your changes missing coverage. Please review.

Please upload report for BASE (baseline_resync@8344019). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...lib/homestore_backend/snapshot_receive_handler.cpp 74.07% 10 Missing and 4 partials ⚠️
...ib/homestore_backend/replication_state_machine.cpp 0.00% 9 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@                Coverage Diff                 @@
##             baseline_resync     #232   +/-   ##
==================================================
  Coverage                   ?   64.38%           
==================================================
  Files                      ?       33           
  Lines                      ?     2047           
  Branches                   ?      234           
==================================================
  Hits                       ?     1318           
  Misses                     ?      613           
  Partials                   ?      116           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@JacksonYao287 JacksonYao287 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@koujl koujl merged commit dac10d8 into eBay:baseline_resync Nov 29, 2024
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants