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

feat(store/v2): RootStore Implementation #17577

Merged
merged 54 commits into from
Sep 28, 2023

Conversation

alexanderbez
Copy link
Contributor

@alexanderbez alexanderbez commented Aug 29, 2023

Description

closes: #17629
ref: #17314

Doc/Changelog

  • Added README stubs to SS and SC
  • Defined initial RootStore and supplementary interfaces
  • Implemented MVP scaffold of a RootStore
  • Implemented MVP scaffold of a KVStore
    • A few notes on this implementation:
      • It uses SC as the backing persistent store to perform reads off of since not all SS backends support reverse iteration
      • It's branched by default

Note:

  • For now we have SS writes flushed synchronously just so we can get a baseline in benchmarks.
  • Some methods are not implemented and/or tested yet; I want preliminary feedback prior to proceeding with in-depth tests and implementation

Author Checklist

All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.

I have...

  • included the correct type prefix in the PR title
  • added ! to the type prefix if API or client breaking change
  • targeted the correct branch (see PR Targeting)
  • provided a link to the relevant issue or specification
  • followed the guidelines for building modules
  • included the necessary unit and integration tests
  • added a changelog entry to CHANGELOG.md
  • included comments for documenting Go code
  • updated the relevant documentation or specification
  • reviewed "Files changed" and left comments if necessary
  • run make lint and make test
  • confirmed all CI checks have passed

Reviewers Checklist

All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.

I have...

  • confirmed the correct type prefix in the PR title
  • confirmed ! in the type prefix if API or client breaking change
  • confirmed all author checklist items have been addressed
  • reviewed state machine logic
  • reviewed API design and naming
  • reviewed documentation is accurate
  • reviewed tests and test coverage
  • manually tested (if applicable)

@alexanderbez alexanderbez linked an issue Sep 5, 2023 that may be closed by this pull request
Copy link
Collaborator

@odeke-em odeke-em left a comment

Choose a reason for hiding this comment

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

Howdy howdy @alexanderbez? Just some drive-by code review comments, please take a look and anyways your PR is currently a draft. Thank you!

store/multistore/store.go Outdated Show resolved Hide resolved

// Close closes the store and resets all internal fields. Note, Close() is NOT
// idempotent and should only be called once.
func (s *Store) Close() (err error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

In that case why not just add a sync.Once called closeOnce and invoke it like this

func (s *Store) Close() (err error) {
    s.closeOnce.Do(func() {
        err = errors.Join(err, s.ss.Close())
        ...
    })
    return
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this would make it idempotent which is not consistent with the rest of the store code. In fact, this was a comment you made previously (to make it not idempotent).

store/multistore/store.go Outdated Show resolved Hide resolved
store/multistore/store.go Outdated Show resolved Hide resolved
store/internal/conv/string.go Fixed Show fixed Hide fixed
store/internal/conv/string.go Fixed Show fixed Hide fixed
store/internal/conv/string.go Fixed Show fixed Hide fixed
@alexanderbez
Copy link
Contributor Author

@odeke-em please refrain from reviews till the PR is marked R4R -- it makes my life more challenging because it's always going to be in flux until it's marked ready (e.g. some of the code you review might even be gone by the time it's ready). Thanks for the review though!

@alexanderbez alexanderbez changed the title feat: Multi-Store PoC feat: RootStore PoC Sep 12, 2023
@alexanderbez alexanderbez marked this pull request as ready for review September 12, 2023 18:50
@alexanderbez alexanderbez requested a review from a team as a code owner September 12, 2023 18:50
@github-actions
Copy link
Contributor

@alexanderbez your pull request is missing a changelog!

store/root/store.go Outdated Show resolved Hide resolved
store/root/store.go Outdated Show resolved Hide resolved
}

// commit SC
commitInfo, err := s.commitSC(version, changeSet)
Copy link
Contributor

Choose a reason for hiding this comment

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

it seems like the finalizeBlock step is missing, the current BaseApp flow looks like WriteBatch->WorkingHash->Commit. Maybe we need to separate the writing from Commit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@cool-develope
Copy link
Contributor

overall, LGTM!

store/root/store.go Outdated Show resolved Hide resolved
@alexanderbez alexanderbez merged commit 81cd74d into feature/store-v2 Sep 28, 2023
47 of 49 checks passed
@alexanderbez alexanderbez deleted the bez/multi-store-poc branch September 28, 2023 16:29
@alexanderbez alexanderbez changed the title feat: RootStore PoC feat(store/v2): RootStore Implementation Nov 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multistore POC
5 participants