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

segregate chain and state blockstores #5695

Merged
merged 6 commits into from
Mar 3, 2021
Merged

Conversation

raulk
Copy link
Member

@raulk raulk commented Feb 28, 2021

Builds on #5484.


This paves the way for better object lifetime management.

Concretely, it makes it possible to:

  • have different stores backing chain and state data.
  • having the same datastore library, but using different parameters.
  • attach different caching layers/policies to each class of data, e.g. sizing caches differently.
  • specifying different retention policies for chain and state data.

This separation is important because:

  • access patterns/frequency of chain and state data are different.
  • state is derivable from chain, so one could never expunge the chain store, and only retain state objects reachable from the last finality in the state store.

I originally submitted this in #4771, but we @vyzo and I decided to do away with the caching for now. That was in the context of LMDB experiments (which uses the page cache aggressively). It may make sense to reintroduce Freecache on top of the hot badger store.

This paves the way for better object lifetime management.

Concretely, it makes it possible to:
- have different stores backing chain and state data.
- having the same datastore library, but using different parameters.
- attach different caching layers/policies to each class of data, e.g.
  sizing caches differently.
- specifying different retention policies for chain and state data.

This separation is important because:
- access patterns/frequency of chain and state data are different.
- state is derivable from chain, so one could never expunge the chain
  store, and only retain state objects reachable from the last finality
  in the state store.
@raulk raulk requested review from vyzo and magik6k February 28, 2021 22:58
@raulk raulk changed the title consolidate all blockstores in blockstore package. segregate chain and state blockstores Feb 28, 2021
Copy link
Contributor

@Kubuxu Kubuxu left a comment

Choose a reason for hiding this comment

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

SGWM

Base automatically changed from refactor/lib/blockstore to next March 1, 2021 18:37
chain/store/store.go Outdated Show resolved Hide resolved
chain/store/store.go Outdated Show resolved Hide resolved
chain/store/store.go Outdated Show resolved Hide resolved
chain/sync.go Show resolved Hide resolved
chain/stmgr/stmgr.go Outdated Show resolved Hide resolved
The union blockstore takes a list of blockstores. It returns the first
satisfying read, and broadcasts writes to all stores.

It can be used for operations that require reading from any two blockstores,
for example WalkSnapshot.
blockstore/union.go Outdated Show resolved Hide resolved
chain/store/store.go Show resolved Hide resolved
chain/sync.go Show resolved Hide resolved
@travisperson
Copy link
Contributor

Is there a migration path for existing datastores to splitstore?

@vyzo
Copy link
Contributor

vyzo commented Mar 2, 2021

It should happen automagically; on first run with the splistore, it will warm the hotstore by fetching all reachable objects from the old blockstore, which becomes the coldstore.

The directory structure looks like this:

.lotus
  datastore
    chain -- the old blockstore, now coldstore.
    splitstore
      hot.badger -- the hot blockstore, badger.
      tracker.bolt -- the tracking db, which is a BoltDB file.

@raulk raulk requested a review from magik6k March 2, 2021 21:29
@raulk
Copy link
Member Author

raulk commented Mar 2, 2021

@magik6k ready again.

@magik6k magik6k merged commit 448813d into next Mar 3, 2021
@magik6k magik6k deleted the feat/segregate-blockstores branch March 3, 2021 09:53
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