Skip to content

crimson/os/seastore: lba pointer consolidation - #55831

Merged
cyx1231st merged 9 commits into
ceph:mainfrom
xxhdx1985126:wip-seastore-lba-pointer-consolidation
May 21, 2024
Merged

cyx1231st merged 9 commits into
ceph:mainfrom
xxhdx1985126:wip-seastore-lba-pointer-consolidation

Conversation

@xxhdx1985126

@xxhdx1985126 xxhdx1985126 commented Feb 29, 2024 •

Copy link
Copy Markdown
Member

Signed-off-by: Xuehan Xu [email protected]

Contribution Guidelines

  • To sign and title your commits, please refer to Submitting Patches to Ceph.

  • If you are submitting a fix for a stable branch (e.g. "quincy"), please refer to Submitting Patches to Ceph - Backports for the proper workflow.

  • When filling out the below checklist, you may click boxes directly in the GitHub web UI. When entering or editing the entire PR message in the GitHub web UI editor, you may also select a checklist item by adding an x between the brackets: [x]. Spaces and capitalization matter when checking off items this way.

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
Show available Jenkins commands
  • jenkins retest this please
  • jenkins test classic perf
  • jenkins test crimson perf
  • jenkins test signed
  • jenkins test make check
  • jenkins test make check arm64
  • jenkins test submodules
  • jenkins test dashboard
  • jenkins test dashboard cephadm
  • jenkins test api
  • jenkins test docs
  • jenkins render docs
  • jenkins test ceph-volume all
  • jenkins test ceph-volume tox
  • jenkins test windows
  • jenkins test rook e2e

@xxhdx1985126
xxhdx1985126 requested a review from a team as a code owner February 29, 2024 06:39
@cyx1231st
cyx1231st self-requested a review March 5, 2024 06:58

@cyx1231st cyx1231st left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'll try to summarize from #47749 about what comment might still be valid and worth doing, and move the "crimson-has-followup" label here to reflect our latest consensus.

Comment thread src/crimson/os/seastore/cached_extent.h Resolved
Comment thread src/crimson/os/seastore/cached_extent.h Resolved
Comment thread src/crimson/os/seastore/cached_extent.h Resolved
@cyx1231st

Copy link
Copy Markdown
Member

I'll try to summarize from #47749 about what comment might still be valid and worth doing, and move the "crimson-has-followup" label here to reflect our latest consensus.

I'm working on some other simple cleanups based on the previous comments, will summarize after that.

@cyx1231st

cyx1231st commented Mar 8, 2024 •

Copy link
Copy Markdown
Member

@xxhdx1985126

Regarding to

/*
*
* Nodes of fixed-kv-btree connect to their child nodes by pointers following
* invariants below:
*
* 1. if nodes are stable:
* a. parent points at the node's stable parent
* b. prior_instance is empty
* c. child pointers point at stable children. Child resolution is done
* directly via this array.
* c. copy_sources is empty
* 2. if nodes are mutation_pending:
* a. parent is empty and needs to be fixed upon commit
* b. prior_instance points to its stable version
* c. child pointers are null except for initial_pending() children of
* this transaction. Child resolution is done by first checking this
* array, and then recursively resolving via the parent. We copy child
* pointers from parent on commit.
* c. copy_sources is empty
* 3. if nodes are initial_pending
* a. parent points at its pending parent on this transaction (must exist)
* b. prior_instance is empty or, if it's the result of rewrite, points to
* its stable predecessor
* c. child pointers are null except for initial_pending() children of
* this transaction (live due to 3a below). Child resolution is done
* by first checking this array, and then recursively resolving via
* the correct copy_sources entry. We copy child pointers from copy_sources
* on commit.
* d. copy_sources contains the set of stable nodes at the same tree-level(only
* its "prior_instance" if the node is the result of a rewrite), with which
* the lba range of this node overlaps.
*/

The comment seems insufficient and I'm not sure about how the current implementation is supposed to handle the other cases, for example:

  • How is exist_clean is supposed to be handled?
  • How is exist_mutation_pending is supposed to be handled?
  • In case of inplace-rewrite @myoungwon, seems to me it is not the exact case to 3. if nodes are initial_pending because its parent won't become pending.
  • I suppose exist_clean can also be special if its parent doesn't need to become pending.

I understand that these features were introduced after the lba-pointer PR, but it doesn't seem that we have discussed about them very carefully.

They are passing our unit tests, but the tests may be insufficient in case of transaction conflicts and the potential issues cannot be revealed very easy but possible.

@xxhdx1985126

xxhdx1985126 commented Mar 8, 2024 •

Copy link
Copy Markdown
Member Author

@xxhdx1985126

Regarding to

/*
*
* Nodes of fixed-kv-btree connect to their child nodes by pointers following
* invariants below:
*
* 1. if nodes are stable:
* a. parent points at the node's stable parent
* b. prior_instance is empty
* c. child pointers point at stable children. Child resolution is done
* directly via this array.
* c. copy_sources is empty
* 2. if nodes are mutation_pending:
* a. parent is empty and needs to be fixed upon commit
* b. prior_instance points to its stable version
* c. child pointers are null except for initial_pending() children of
* this transaction. Child resolution is done by first checking this
* array, and then recursively resolving via the parent. We copy child
* pointers from parent on commit.
* c. copy_sources is empty
* 3. if nodes are initial_pending
* a. parent points at its pending parent on this transaction (must exist)
* b. prior_instance is empty or, if it's the result of rewrite, points to
* its stable predecessor
* c. child pointers are null except for initial_pending() children of
* this transaction (live due to 3a below). Child resolution is done
* by first checking this array, and then recursively resolving via
* the correct copy_sources entry. We copy child pointers from copy_sources
* on commit.
* d. copy_sources contains the set of stable nodes at the same tree-level(only
* its "prior_instance" if the node is the result of a rewrite), with which
* the lba range of this node overlaps.
*/

The comment seems insufficient and I'm not sure about how the current implementation is supposed to handle the other cases, for example:

  • How is exist_clean is supposed to be handled?
  • How is exist_mutation_pending is supposed to be handled?
  • In case of inplace-rewrite @myoungwon, seems to me it is not the exact case to 3. if nodes are initial_pending because its parent won't become pending.
  • I suppose exist_clean can also be special if its parent doesn't need to become pending.

IIUC, EXIST_CLEAN extents are created by extent remappings, so they must corresponds to lba mapping changes, which means their parents will be pending. EXIST_MUTATION_PENDING extents come from EXIST_CLEAN extents, so their parents are also pending. Am I missing something?

On the other hand, it seems that inplace-rewrite doesn't actually create new extents like other rewriting process, so the pointer links between them and their parents don't need to be touched, which means it's ok no to make their parents pending or modify the pointers in their parents. Am I right?

if (epm->can_inplace_rewrite(t, extent)) {
DEBUGT("delta overwriting extent -- {}", t, *extent);
t.add_inplace_rewrite_extent(extent);
extent->set_inplace_rewrite_generation();
return rewrite_extent_iertr::now();

I understand that these features were introduced after the lba-pointer PR, but it doesn't seem that we have discussed about them very carefully. They are passing our unit tests, but the tests may be insufficient in case of transaction conflicts.

@cyx1231st

Copy link
Copy Markdown
Member

IIUC, EXIST_CLEAN extents are created by extent remappings, so they must corresponds to lba mapping changes, which means their parents will be pending.

So it should be correct to replace initial_pending by initial_pending or exist_clean in the above comment?

If that's correct, I'm still wondering why there are many related logic only under the condition is_initial_pending(), instead of both is_initial_pending() || is_exist_clean() ?

@cyx1231st

Copy link
Copy Markdown
Member

EXIST_MUTATION_PENDING extents come from EXIST_CLEAN extents, so their parents are also pending.

So does it mean EXIST_MUTATION_PENDING should also belong to the category 3 (initial_pending) as well ? Or is it actually better to discuss it separately in the comment ?

@cyx1231st

Copy link
Copy Markdown
Member

On the other hand, it seems that inplace-rewrite doesn't actually create new extents like other rewriting process, so the pointer links between them and their parents don't need to be touched, which means it's ok no to make their parents pending or modify the pointers in their parents. Am I right?

Reasonable to me. Hm, probably good to mention this in the comment.

@cyx1231st

Copy link
Copy Markdown
Member

I suppose exist_clean can also be special if its parent doesn't need to become pending.

Ah, it's not true, because the length in the parent entry must be changed at the same time.

(Unrelated, but probably it worths to ensure that we don't remap an extent to another extent with the same length)

@xxhdx1985126

xxhdx1985126 commented Mar 8, 2024 •

Copy link
Copy Markdown
Member Author

IIUC, EXIST_CLEAN extents are created by extent remappings, so they must corresponds to lba mapping changes, which means their parents will be pending.

So it should be correct to replace initial_pending by initial_pending or exist_clean in the above comment?

If that's correct, I'm still wondering why there are many related logic only under the condition is_initial_pending(), instead of both is_initial_pending() || is_exist_clean() ?

Just scanned the code, it seems that almost all of the checks against is_initial_pending() happen on non-object-data extents which are not to be remapped, the rest happen in cases where EXIST_CLEAN extents don't need to be considered:

src/crimson/os/seastore/transaction.h:    } else if (ref->is_initial_pending()) {
src/crimson/os/seastore/btree/fixed_kv_node.h:    ceph_assert(dest.is_initial_pending());
src/crimson/os/seastore/btree/fixed_kv_node.h:      ceph_assert(src.is_initial_pending());
src/crimson/os/seastore/btree/fixed_kv_node.h:    return is_initial_pending() && get_prior_instance();
src/crimson/os/seastore/btree/fixed_kv_node.h:    if (this->is_initial_pending()) {
src/crimson/os/seastore/btree/fixed_kv_node.h:   * physical node is is_initial_pending() or just is_mutable().
src/crimson/os/seastore/btree/fixed_kv_node.h:    if (this->is_initial_pending()) {
src/crimson/os/seastore/btree/fixed_kv_node.h:    if (this->is_initial_pending()) {
src/crimson/os/seastore/btree/fixed_kv_node.h:      if (this->is_initial_pending()) {
src/crimson/os/seastore/btree/fixed_kv_node.h:    assert(this->is_initial_pending()
src/crimson/os/seastore/extent_placement_manager.cc:      if (ex->is_initial_pending()) {
src/crimson/os/seastore/cached_extent.h:  bool is_initial_pending() const {
src/crimson/os/seastore/cached_extent.h:   * Returns current address of extent.  If is_initial_pending(), address will
src/crimson/os/seastore/cached_extent.h:  /// address of original block -- record relative iff is_initial_pending()
src/crimson/os/seastore/cached_extent.h:    if (is_initial_pending() && addr.is_record_relative()) {
src/crimson/os/seastore/backref/btree_backref_manager.cc:    ceph_assert(backref_root->is_initial_pending()
src/crimson/os/seastore/onode_manager/staged-fltree/node_layout.h:      assert(extent->is_initial_pending());
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_manager/seastore.h:      if (!extent->is_initial_pending()) {
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_accessor.h:    if (extent->is_initial_pending()) {
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_accessor.h:      assert(extent->is_initial_pending());
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_accessor.h:    assert(!extent->is_initial_pending());
src/crimson/os/seastore/onode_manager/staged-fltree/node_extent_accessor.h:      assert(fresh_extent->is_initial_pending());
src/crimson/os/seastore/lba_manager/btree/btree_lba_manager.cc:    ceph_assert(lba_root->is_initial_pending()
src/crimson/os/seastore/lba_manager/btree/lba_btree_node.h:    if (this->is_initial_pending()) {
src/crimson/os/seastore/lba_manager/btree/lba_btree_node.h:    if (this->is_initial_pending()) {
src/crimson/os/seastore/transaction_manager.cc:  assert(extent->is_valid() && !extent->is_initial_pending());

@xxhdx1985126

Copy link
Copy Markdown
Member Author

EXIST_MUTATION_PENDING extents come from EXIST_CLEAN extents, so their parents are also pending.

So does it mean EXIST_MUTATION_PENDING should also belong to the category 3 (initial_pending) as well ?

For lba pointers yes, but I think it would be better to distinguish it in the comment, will change it.

Or is it actually better to discuss it separately in the comment ?

@cyx1231st

Copy link
Copy Markdown
Member
* 2. if nodes are mutation_pending: 
*   a. parent is empty and needs to be fixed upon commit 

Is it possible that the parent is initial-pending, and the child is mutation-pending ? (I don't see how it's impossible.)

If that's possible, how does the bi-directional parent-child lookup works if there is no parent-child link in this case ?

Or does this comment actually inaccurate ?

@xxhdx1985126

xxhdx1985126 commented Mar 12, 2024 •

Copy link
Copy Markdown
Member Author
* 2. if nodes are mutation_pending: 
*   a. parent is empty and needs to be fixed upon commit 

Is it possible that the parent is initial-pending, and the child is mutation-pending ? (I don't see how it's impossible.)

Yes, it's possible.

If that's possible, how does the bi-directional parent-child lookup works if there is no parent-child link in this case ?

IIRC, at present, the lookup of lba/backref tree is a top-down process and doesn't involve the parent link. On the other hand, the maintenance of the corrent link between initial_pending parent and mutation_pending children works as follows:

  1. mutation_pending extents always take their prior_instance's parent on committing;
  2. initial_pending lba/backref extents always adjust their stable sources' children's parent links;
  3. if the mutation_pending extents are committed first, their parent pointer will point to their prior_instances' parents after committing; and the initial_pending parents will adjust those once-mutation-pending children's parent pointers so that they point to the new parents;
  4. if the initial_pending parents are committed first, they will adjust their stable children's parent pointers; and then when the mutation_pending children take their prior_instances' parent pointers, they will see parent pointers pointing to the new parents.

In the current Cache::prepare_record implemention, I think mutation_pending extents are always committed first, so 3 should always be the case.

In the future, when optimizing the lba mapping updates, like discussed in #55449 (comment), we might need to add copy_sources -> initial_pending nodes links, so that mutation_pending extents can follow the prior -> prior's stable parent -> initial_pending parent path to find the correct parent.

Or does this comment actually inaccurate ?

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cyx1231st

Copy link
Copy Markdown
Member
* 2. if nodes are mutation_pending: 
*   a. parent is empty and needs to be fixed upon commit 

Is it possible that the parent is initial-pending, and the child is mutation-pending ? (I don't see how it's impossible.)

Yes, it's possible.

Sorry my question above might be confusing. From the standup, if the parent is initial-pending and the child is mutation-pending, their parent/child pointers should be empty, so the referred comment is accurate.

@cyx1231st

Copy link
Copy Markdown
Member

I'll try to summarize from #47749 about what comment might still be valid and worth doing, and move the "crimson-has-followup" label here to reflect our latest consensus.

Summarized in #47749 (comment) to remember.

@xxhdx1985126
xxhdx1985126 force-pushed the wip-seastore-lba-pointer-consolidation branch from 1963045 to 4d49ece Compare April 10, 2024 02:10
@cyx1231st

Copy link
Copy Markdown
Member

Not sure if the latest change is ready refering to the unaddressed comments, let me know if needs review.

@xxhdx1985126
xxhdx1985126 force-pushed the wip-seastore-lba-pointer-consolidation branch from 4d49ece to 6eeed2a Compare April 11, 2024 06:23
@xxhdx1985126

Copy link
Copy Markdown
Member Author

@cyx1231st I think this pr is good to take another round of review, please take a look again, thanks:-)

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test api

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@xxhdx1985126
xxhdx1985126 force-pushed the wip-seastore-lba-pointer-consolidation branch 2 times, most recently from dec0013 to 54a296a Compare May 15, 2024 09:29
@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test api

@github-actions

Copy link
Copy Markdown

This pull request can no longer be automatically merged: a rebase is needed and changes have to be manually resolved

@cyx1231st cyx1231st left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM except 1 comment above.

@xxhdx1985126
xxhdx1985126 force-pushed the wip-seastore-lba-pointer-consolidation branch from cfbb675 to bfc2aba Compare May 20, 2024 03:20
@xxhdx1985126

Copy link
Copy Markdown
Member Author

LGTM except 1 comment above.

Done:-)

@xxhdx1985126

Copy link
Copy Markdown
Member Author

/home/jenkins-build/build/workspace/ceph-pull-requests/src/common/options/legacy_config_opts.h:1:10: fatal error: 'global_legacy_options.h' file not found
#include "global_legacy_options.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test make check

@xxhdx1985126

Copy link
Copy Markdown
Member Author

jenkins test windows

1 similar comment
@cyx1231st

Copy link
Copy Markdown
Member

jenkins test windows

@cyx1231st

Copy link
Copy Markdown
Member

@cyx1231st
cyx1231st merged commit 681c4c5 into ceph:main May 21, 2024
@tchaikov

Copy link
Copy Markdown
Contributor

/home/jenkins-build/build/workspace/ceph-pull-requests/src/common/options/legacy_config_opts.h:1:10: fatal error: 'global_legacy_options.h' file not found
#include "global_legacy_options.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

@xxhdx1985126 if we spot a similar case, could you please paste the link to the jenkins job, and at me? i'd like to fix it.

@xxhdx1985126

xxhdx1985126 commented May 21, 2024 •

Copy link
Copy Markdown
Member Author

/home/jenkins-build/build/workspace/ceph-pull-requests/src/common/options/legacy_config_opts.h:1:10: fatal error: 'global_legacy_options.h' file not found
#include "global_legacy_options.h"
^~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

@xxhdx1985126 if we spot a similar case, could you please paste the link to the jenkins job, and at me? i'd like to fix it.

@tchaikov Hi, here's the jenkins job: https://jenkins.ceph.com/job/ceph-pull-requests/135238/consoleFull

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants