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

State sync support #5803

Closed
wants to merge 79 commits into from
Closed

State sync support #5803

wants to merge 79 commits into from

Conversation

erikgrinaker
Copy link
Contributor

@erikgrinaker erikgrinaker commented Mar 13, 2020

Description

Fixes #5689, fixes #5690. Adds support for taking, restoring, and serving snapshots for state sync, as outlined in ADR-053 and the ABCI reference.

  • rootmulti.Store now implements a new snapshots.Snapshotter interface, which can take and restore binary state snapshots at a given height. Snapshots are built as follows:

    1. rootmulti.Store iterates over all iavl.Store stores, and for each one emits a delimited Protobuf SnapshotStoreItem message with store metadata

    2. For each iavl.Store, export iavl.ExportNode nodes via Export() at the given height and emit a delimited Protobuf SnapshotIAVLItem message for each node

    3. The delimited Protobuf message stream is zlib-compressed

    4. The zlib-compressed stream is chunked naïvely into 10 MB chunks

  • snapshots.Store stores snapshot metadata in a separate database and chunks in a filesystem directory

  • BaseApp takes asynchronous snapshots after Commit() in regular height intervals given by the config option state-sync.snapshot-interval (default 0, i.e. disabled). It also prunes old snapshots, and keeps the most recent snapshots given by the option state-sync.snapshot-keep-recent (default 2).

  • BaseApp implements the upcoming state sync ABCI interface from Tendermint, for fetching and applying state snapshots.

  • SimApp has been updated to enable and initialize state sync snapshots.

baseapp/abci.go Outdated Show resolved Hide resolved
server/constructors.go Outdated Show resolved Hide resolved
store/rootmulti/store.go Show resolved Hide resolved
store/snapshot/store.go Outdated Show resolved Hide resolved
store/rootmulti/utils.go Outdated Show resolved Hide resolved
erikgrinaker added a commit to tendermint/tendermint that referenced this pull request Apr 29, 2020
Adds the ABCI interface for [state sync](#828) as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md), and bumps ABCIVersion to `0.17.0`.

The interface adds a new ABCI connection which Tendermint can use to query and load snapshots from the app (for serving snapshots to other nodes), and to offer and apply snapshots to the app (for state syncing a local node from peers).

Split out from the original PR in #4645, state sync reactor will be submitted as a separate PR. The interface is implemented by the Cosmos SDK in cosmos/cosmos-sdk#5803.
erikgrinaker added a commit to tendermint/tendermint that referenced this pull request Apr 29, 2020
Fixes #828. Adds state sync, as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md). See related PRs in Cosmos SDK (cosmos/cosmos-sdk#5803) and Gaia (cosmos/gaia#327).

This is split out of the previous PR #4645, and branched off of the ABCI interface in #4704. 

* Adds a new P2P reactor which exchanges snapshots with peers, and bootstraps an empty local node from remote snapshots when requested.

* Adds a new configuration section `[statesync]` that enables state sync and configures the light client. Also enables `statesync:info` logging by default.

* Integrates state sync into node startup. Does not support the v2 blockchain reactor, since it needs some reorganization to defer startup.
tac0turtle pushed a commit to tendermint/tendermint that referenced this pull request Apr 29, 2020
Adds the ABCI interface for [state sync](#828) as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md), and bumps ABCIVersion to `0.17.0`.

The interface adds a new ABCI connection which Tendermint can use to query and load snapshots from the app (for serving snapshots to other nodes), and to offer and apply snapshots to the app (for state syncing a local node from peers).

Split out from the original PR in #4645, state sync reactor will be submitted as a separate PR. The interface is implemented by the Cosmos SDK in cosmos/cosmos-sdk#5803.
tac0turtle pushed a commit to tendermint/tendermint that referenced this pull request Apr 29, 2020
Fixes #828. Adds state sync, as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md). See related PRs in Cosmos SDK (cosmos/cosmos-sdk#5803) and Gaia (cosmos/gaia#327).

This is split out of the previous PR #4645, and branched off of the ABCI interface in #4704.

* Adds a new P2P reactor which exchanges snapshots with peers, and bootstraps an empty local node from remote snapshots when requested.

* Adds a new configuration section `[statesync]` that enables state sync and configures the light client. Also enables `statesync:info` logging by default.

* Integrates state sync into node startup. Does not support the v2 blockchain reactor, since it needs some reorganization to defer startup.
@stale
Copy link

stale bot commented Jun 6, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 6, 2020
@tac0turtle
Copy link
Member

leave it open

@stale stale bot removed the stale label Jun 6, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Jul 5, 2020

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@erikgrinaker
Copy link
Contributor Author

I've ported this to the latest SDK+Tendermint target in the marko/tm_update branch as erik/state-sync.

@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@erikgrinaker
Copy link
Contributor Author

Superseded by #7166.

@tac0turtle tac0turtle deleted the erik/snapshot branch March 4, 2021 15:55
NexZhu pushed a commit to daotl/go-acei that referenced this pull request Oct 27, 2021
Adds the ABCI interface for [state sync](tendermint/tendermint#828) as outlined in [ADR-053](https://github.com/tendermint/tendermint/blob/master/docs/architecture/adr-053-state-sync-prototype.md), and bumps ABCIVersion to `0.17.0`.

The interface adds a new ABCI connection which Tendermint can use to query and load snapshots from the app (for serving snapshots to other nodes), and to offer and apply snapshots to the app (for state syncing a local node from peers).

Split out from the original PR in #4645, state sync reactor will be submitted as a separate PR. The interface is implemented by the Cosmos SDK in cosmos/cosmos-sdk#5803.
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.

State sync ABCI support State sync snapshotting
4 participants