Repository navigation
ADR-104: Out-of-band state sync support - #801
Conversation
commented
May 8, 2023
This is a work in progress. The above content should go into "Detailed Design" section. In general terms, the operation should be the one described on the "Decision" section. |
commented
May 8, 2023
I agree we can have multiple designs for the user interfaces, but I think that this ADR (with its current content) reasonably covers the possible solutions. |
| application snapshots to install or restore; | ||
| 1. Operators should be able to instruct the server side of State sync on a | ||
| running node to export application snapshots, when they are available, | ||
| to a given location (e.g., at the local file system); |
There was a problem hiding this comment.
Is it like a standalone command that'll connect to the p2p network and download a snapshot?
There was a problem hiding this comment.
No p2p, no network, no download. You instruct the node (e.g., via CLI command) to save a snapshot to disk.
There was a problem hiding this comment.
Of course, you can save it to a NFS mount point, so you have network and a form of upload.
There was a problem hiding this comment.
do you mean export a snapshot from the state in the local node, not discover and download a snapshot from the network?
There was a problem hiding this comment.
Discovering and fetching snapshots is what the existing State sync does.
The proposed extension assumes that the node operator will discover and fetch the snapshot in some way and just point to the bootstrapping node (see item 1.) where to find the snapshot data.
There was a problem hiding this comment.
this is already how state sync works for the sdk. Def adding support for some of the items here makes sense, but we would only need a way to bootstrap the node, like huang yi did. I think the app should control exports and imports of snapshots for local state sync. There isnt really a need to complicate comet with this functionality imo
Makes sense to rely on the app-side for fulfilling this requirement! Is there already app-side support for it?
we are merging the prs to make it work. they are all open and approved
There was a problem hiding this comment.
we are merging the prs to make it work. they are all open and approved
There was a problem hiding this comment.
we are merging the prs to make it work. they are all open and approved
| State sync should support the bootstrap of new nodes from application snapshots | ||
| obtained out-of-band by node operators. |
There was a problem hiding this comment.
Note that the snapshot might also be obtained locally (i.e., an old, local snapshot present on the node already).
| State sync should support the bootstrap of new nodes from application snapshots | |
| obtained out-of-band by node operators. | |
| State sync should support the bootstrap of new nodes from application snapshots. This ADR does not cover the mechanism for obtaining snapshots, and we assume node operators obtain this for example through an out-of-band mechanism. |
There was a problem hiding this comment.
State sync should support the bootstrap of new nodes from application snapshots
I would add "local" to this sentence? Otherwise, it is what State sync already does...
There was a problem hiding this comment.
Is out of band the same as local though? Local to me would mean the node had a snapshot it itself stored before. Out of band can mean it was just copied or obtanined in another manner.
There was a problem hiding this comment.
I would say snapshots are local, for the sake of this definition. In general, I would say, from point 2. below, that they are local because obtained out-of-band?
There was a problem hiding this comment.
So local in this terminology is that the snapshots are applied from something eventually present on the node. Even though it originated from somewhere else. Sorry, this is just nit picking, nothing major :D
There was a problem hiding this comment.
No, that's important. Recall that we should still pick a name for the PR :)
| application snapshots to install or restore; | ||
| 1. Operators should be able to instruct the server side of State sync on a | ||
| running node to export application snapshots, when they are available, | ||
| to a given location (e.g., at the local file system); |
There was a problem hiding this comment.
Makes sense to rely on the app-side for fulfilling this requirement! Is there already app-side support for it?
Co-authored-by: Adi Seredinschi <[email protected]>
| 1. Operators should be able to instruct the server side of state sync on a | ||
| running node to export application snapshots, when they are available, | ||
| to a given location (e.g., at the local file system); | ||
| 1. It is up to node operators to transfer application snapshots produced by the |
There was a problem hiding this comment.
| 1. It is up to node operators to transfer application snapshots produced by the | |
| 3. It is up to node operators to transfer application snapshots produced by the |
left a comment
There was a problem hiding this comment.
Good additions.
I think the second part of the detailed design, from line 234, is a little speculative and dives into too much detail. My opinion is that this section should essentially tell the reader how the SDK commands can be implemented using ABCI calls (step by step), leaving out details on how and where we store stuff, for instance.
|
|
||
| The ADR presents two solutions: | ||
|
|
||
| > 1. The first solution is implemented by the application and was proposed and |
There was a problem hiding this comment.
I would remove this > and render it a normal text block
| The ADR presents two solutions: | ||
|
|
||
| > 1. The first solution is implemented by the application and was proposed and | ||
| implemented by the SDK (PR #16067 and #16061). This ADR describes the solution |
|
|
||
| ## Alternative Approaches | ||
|
|
||
| > This section contains information around alternative options that are considered |
There was a problem hiding this comment.
This text is from the ADR template, we can remove in the final version.
| Thus application developers have to, within their bootstraping command: | ||
|
|
||
| - Create a state and block store | ||
| - Launch a light client to verify the snapshot headers |
There was a problem hiding this comment.
Not the headers. The light client is launched to learn the block header for the height of the snapshot.
|
|
||
| - Create a state and block store | ||
| - Launch a light client to verify the snapshot headers | ||
| - Use the light client's `State` and `Commit` functions to |
There was a problem hiding this comment.
The light-client provided state is used to check the appHash retrieved from the application via Info ABCI call.
| - Create a state and block store | ||
| - Launch a light client to verify the snapshot headers | ||
| - Use the light client's `State` and `Commit` functions to | ||
| retrieve the proper state, verify the `AppHash` and retrieve the `LastCommit`. |
There was a problem hiding this comment.
It is commit, not last commit. The only point of it is to bootstrap the block store.
There was a problem hiding this comment.
You are right the type is not LastCommit, but that is the last commit for the given height. Thanks for catching this.
Co-authored-by: Adi Seredinschi <[email protected]> Co-authored-by: Daniel <[email protected]>
| 2. Introduce a CLI command that can explicitly tell the application to create a snapshot export, in case | ||
| operators decide not to generate periodical exports. | ||
| 3. Extract a snapshot from the exported format. | ||
| 4. Alter existing ABCI calls to signal to the application that we want to create a snapshot export periodically. |
There was a problem hiding this comment.
If we require that the app is configured for snapshot (something that exists today), when we don't need ABCI changes, we can just call ListSnapshots and (a sequence of) LoadSnapshotChunk.
IOW, we wouldn't need to modify ABCI in an MVP
There was a problem hiding this comment.
(I realize this is explained later on in the text)
left a comment
•
There was a problem hiding this comment.
Nice writing up, I think this document is covering almost every possible solution for the discussed problem, while providing an overview of the specifics that would have to be taken into consideration by any implementation.
P.S.: GitHub doesn't allow me to approve it because I've originally created the PR.
|
|
||
| If CometBFT is not the one who created the exported file, we introduce a new ABCI call `UnpackSnapshot` | ||
| to send the exported snapshot as a blob of bytes to the application, which uncompresses it, installs it | ||
| and responds whether the snapshot is accepted and the chunk application has passed. |
There was a problem hiding this comment.
| and responds whether the snapshot is accepted and the chunk application has passed. | |
| and responds whether the snapshot is accepted (as in `OfferSnapshot`) and the chunks application has passed (as in `LoadChunk`). |
| } | ||
| ``` | ||
|
|
||
| Unlike networked statesync, we do not refetch individual chunks, thus if the chunk application of the exported snapshot fails, snapshot application fails. |
There was a problem hiding this comment.
| Unlike networked statesync, we do not refetch individual chunks, thus if the chunk application of the exported snapshot fails, snapshot application fails. | |
| Unlike networked state sync, we do not re-fetch individual chunks, thus if the application of a chunk fails, then the application of the whole snapshot fails. |
Closes #28.
This should be a replacement for #729.
Rendered ADR