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

[4.0] Restore read-mode=speculative #986

Merged
merged 3 commits into from
Apr 8, 2023

Conversation

heifner
Copy link
Member

@heifner heifner commented Apr 6, 2023

Restore deprecated read-mode=speculative that was removed in #414. read-mode=head remains the default.

Although, read-mode=speculative can cause confusion to users, this PR restores the option as an alternative non-default read-mode. This does not restore persisted trxs. Persisted trxs were API trxs re-applied for each block. This new restored speculative mode therefore will not have the state of API trxs auto applied at the start of each speculative block. It is up to the user to re-apply any transactions at each speculative block in order to observe their side-effects.

Also the restored read-mode=speculative does not, unlike the old removed read-mode=speculative, apply schedule changes, protocol activations, or onblock trxs for a speculative mode into the speculative block which will be aborted when a new block is received from the network. This is in alignment with read-mode=head.

  --read-mode arg (=head)               Database read mode ("head",
                                        "irreversible", "speculative").
                                        In "head" mode: database contains state
                                        changes up to the head block;
                                        transactions received by the node are
                                        relayed if valid.
                                        In "irreversible" mode: database
                                        contains state changes up to the last
                                        irreversible block; transactions
                                        received via the P2P network are not
                                        relayed and transactions cannot be
                                        pushed via the chain API.
                                        In "speculative" mode: (DEPRECATED:
                                        head mode recommended) database
                                        contains state changes by transactions
                                        in the blockchain up to the head block
                                        as well as some transactions not yet
                                        included in the blockchain;
                                        transactions received by the node are
                                        relayed if valid.

Resolves #980

@heifner heifner requested review from arhag and linh2931 April 6, 2023 15:23
if ( read_mode == db_read_mode::HEAD ) {
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
}
EOS_ASSERT( head->block, block_validate_exception, "attempting to pop a block that was sparsely loaded from a snapshot");
Copy link
Member Author

Choose a reason for hiding this comment

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

Seems like this should always be asserted even for IRREVERSIBLE mode.

@arhag arhag linked an issue Apr 6, 2023 that may be closed by this pull request
@heifner heifner added the OCI Work exclusive to OCI team label Apr 7, 2023
@@ -120,11 +120,17 @@ Config Options for eosio::chain_plugin:
applied to them (may specify multiple
times)
--read-mode arg (=head) Database read mode ("head",
"irreversible").
"speculative", "irreversible").
Copy link
Member

Choose a reason for hiding this comment

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

As speculative is deprecated, place it after irreversible

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

contains state changes by transactions
in the blockchain up to the head block
as well as some transactions not yet
included in the blockchain.
Copy link
Member

Choose a reason for hiding this comment

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

Can you specify if a transaction will be replayed, to be consistent with the other two's description?

"In \"head\" mode: database contains state changes up to the head block; transactions received by the node are relayed if valid.\n"
"In \"speculative\" mode: (DEPRECATED: head mode recommended) database contains state changes by transactions in the blockchain up to the head block as well as some transactions not yet included in the blockchain.\n"
Copy link
Member

Choose a reason for hiding this comment

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

place it after irreversible

@heifner heifner merged commit de1c1c2 into release/4.0 Apr 8, 2023
@heifner heifner deleted the GH-980-restore-read-mode-speculative-4.0 branch April 8, 2023 13:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
OCI Work exclusive to OCI team
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Restore deprecated read-mode=speculative
3 participants