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

implement fix pg size #220

Merged
merged 1 commit into from
Nov 6, 2024
Merged

Conversation

Hooper9973
Copy link
Contributor

@Hooper9973 Hooper9973 commented Oct 29, 2024

Description:

This pull request introduces the initial draft for fixing the PG size. The main work includes:

  • Creating PGs based on a specified size.
  • Selecting chunks from the PG's chunk heap when creating a shard.
  • Related to recovery: Adapting pg_info_superblk to recover the state of chunkselector and the state of pg.

@Hooper9973 Hooper9973 force-pushed the implement_fix_pg_size branch from 77e4908 to 823e1ff Compare October 29, 2024 14:32
src/lib/homestore_backend/heap_chunk_selector.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/heap_chunk_selector.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/heap_chunk_selector.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/heap_chunk_selector.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/hs_homeobject.hpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/hs_pg_manager.cpp Outdated Show resolved Hide resolved
@@ -127,12 +136,19 @@ void HSHomeObject::on_create_pg_message_commit(int64_t lsn, sisl::blob const& he
return;
}

// select chunks for pg
const auto chunk_size = chunk_selector()->get_chunk_size();
const chunk_num_t num_chunk = sisl::round_up(pg_info.size, chunk_size) / chunk_size;
Copy link
Collaborator

Choose a reason for hiding this comment

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

as a preparation of identical_shard_layout we need to ensure PG has same identical chunks layout( same number of chunks and same chunk size across replicas), should we include this in PGInfo (maybe HS_PGInfo) so the decision of leaders can be send to follower?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The same chunk size is already ensured by homogeneous disks, the same number of chunks is ensured by fixed pg size, and an identical layout will be guaranteed during the create shard process by writing v_chunk_id into shard_info_superblk to ensure followers select the same v_chunk.

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah I am concerning about the chunk size ---- if mistaken was made, surface it up earlier.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

More comprehensive error handling and security defense code will be proposed in the Identical layout pr.

src/lib/homestore_backend/hs_pg_manager.cpp Outdated Show resolved Hide resolved
@Hooper9973 Hooper9973 force-pushed the implement_fix_pg_size branch from 823e1ff to 260d687 Compare October 31, 2024 09:19
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.

in general LGTM

src/lib/homestore_backend/heap_chunk_selector.cpp Outdated Show resolved Hide resolved
@Hooper9973 Hooper9973 force-pushed the implement_fix_pg_size branch 2 times, most recently from c86f5e8 to 8514e23 Compare November 3, 2024 11:17
@Hooper9973 Hooper9973 changed the title [WIP]implement fix pg size implement fix pg size Nov 4, 2024
@codecov-commenter
Copy link

codecov-commenter commented Nov 4, 2024

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

Codecov Report

Attention: Patch coverage is 73.29545% with 47 lines in your changes missing coverage. Please review.

Project coverage is 63.15%. Comparing base (acb04e8) to head (1746bcc).
Report is 27 commits behind head on main.

Files with missing lines Patch % Lines
src/lib/homestore_backend/heap_chunk_selector.cpp 71.31% 20 Missing and 15 partials ⚠️
src/lib/homestore_backend/hs_pg_manager.cpp 69.23% 10 Missing and 2 partials ⚠️

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

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #220      +/-   ##
==========================================
- Coverage   68.69%   63.15%   -5.54%     
==========================================
  Files          30       32       +2     
  Lines        1581     1900     +319     
  Branches      163      204      +41     
==========================================
+ Hits         1086     1200     +114     
- Misses        408      600     +192     
- Partials       87      100      +13     

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

@Hooper9973 Hooper9973 marked this pull request as ready for review November 4, 2024 03:05
src/lib/homestore_backend/hs_homeobject.hpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/hs_homeobject.hpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/hs_homeobject.hpp Show resolved Hide resolved
src/lib/homestore_backend/hs_pg_manager.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/heap_chunk_selector.cpp Outdated Show resolved Hide resolved
src/lib/homestore_backend/heap_chunk_selector.h Outdated Show resolved Hide resolved
src/lib/homestore_backend/heap_chunk_selector.h Outdated Show resolved Hide resolved
@Hooper9973 Hooper9973 force-pushed the implement_fix_pg_size branch 2 times, most recently from 40930ce to bf0f88b Compare November 4, 2024 10:08
@Hooper9973 Hooper9973 force-pushed the implement_fix_pg_size branch 3 times, most recently from 44720fc to 99c21b7 Compare November 5, 2024 08:20
@Hooper9973 Hooper9973 force-pushed the implement_fix_pg_size branch from 99c21b7 to 1746bcc Compare November 5, 2024 09:13
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.

I think it will be nice to have a create_pg test that consumes all ( left_chunk < pg_size) chunks. That might surfaces some issue.

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.

generally looks good. I have a final question.

m_per_dev_heap is now a heap to maintain all chunks of a pdev , right?
in our implementation, what we want is to identify whether a chunk has been assigned to any pg or not, so do we still need a heap here? maybe we can used a simpler data structure?

if I miss something, pls correct me

@Hooper9973 Hooper9973 merged commit 49b1b0c into eBay:main Nov 6, 2024
25 checks passed
@Hooper9973 Hooper9973 deleted the implement_fix_pg_size branch November 6, 2024 02:13
@Hooper9973
Copy link
Contributor Author

Hooper9973 commented Nov 6, 2024

@JacksonYao287

m_per_dev_heap is now a heap to maintain all chunks of a pdev , right?

Thanks for bringing this up! Just to clarify a bit more: m_chunks holds all the chunks. m_per_dev_heap specifically manages only the empty chunks, and m_per_pg_heap takes care of the chunks used for specific page groups.

It's important to note that m_per_dev_heap and m_per_pg_heap are mutually exclusive - a chunk will only exist in one or the other, never both. Together, the total number of chunks in m_per_dev_heap and m_per_pg_heap matches exactly with the total in m_chunks.

Hope this makes things clearer~

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.

4 participants