This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Unapplied transaction queue performance #7686
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…in aborted that are applied can be removed from unapplied_transactions avoiding having to determine they are a duplicate later.
heifner
commented
Jul 25, 2019
libraries/chain/controller.cpp
Outdated
unapplied_branch = std::move( branches.second ); | ||
if ( read_mode == db_read_mode::SPECULATIVE ) { | ||
unapplied_branch = std::move( branches.second ); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not ideal in that we add forked branches after applying the new branch which might have many of the same transactions.
…ied_transaction_queue will determine if they should be used or not
…iously applied transactions can be added to the unapplied_transaction_queue as they are popped. This allows the transactions to be removed from the unapplied_transaction_queue as they are applied in apply_block. Before they were added after the apply which would require re-attempting to apply them when processing unapplied_tranactions
…ead of a branch_type since each forked block is added individually now
arhag
suggested changes
Jul 26, 2019
libraries/chain/include/eosio/chain/unapplied_transaction_queue.hpp
Outdated
Show resolved
Hide resolved
libraries/chain/include/eosio/chain/unapplied_transaction_queue.hpp
Outdated
Show resolved
Hide resolved
…eing responsible for processing it in the correct order
…ode from producer_plugin.
arhag
suggested changes
Jul 26, 2019
(chain.get_read_mode() != chain::db_read_mode::SPECULATIVE) ? unapplied_transaction_queue::process_mode::non_speculative : | ||
my->_producers.empty() ? unapplied_transaction_queue::process_mode::speculative_non_producer : | ||
unapplied_transaction_queue::process_mode::speculative_producer; | ||
my->_unapplied_transactions.set_mode( unapplied_mode ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do this in producer_plugin::plugin_initiailize
. Since producer_plugin depends on chain_plugin, it is safe to get the read_mode from the controller at that point.
kevandjeann
approved these changes
Jul 27, 2019
kevandjeann
approved these changes
Jul 27, 2019
kevandjeann
approved these changes
Jul 27, 2019
kevandjeann
approved these changes
Jul 27, 2019
kevandjeann
approved these changes
Jul 27, 2019
…ted so it will be the first one next time around
arhag
suggested changes
Jul 29, 2019
arhag
approved these changes
Jul 29, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Change Description
controller::push_transaction
. The removal of these applied transactions was moved into theproducer_plugin
during the processing of unapplied transactions. See Refactor unapplied transaction queue #7453. However,push_block
transactions from other producers were not removed causing theunapplied_transaction_queue
to grow with transactions that were already applied. This slowed down block production as all these transactions had to be processed to determine that they were duplicates (already applied).Modifications:
unapplied_transaction_queue
all applied transactions when signaled viaaccepted_block
.unapplied_transaction_queue
before processing the nextpush_block
so that applied transactions can be removed viaaccepted_block
. Otherwise, If aborted transactions are added into theunapplied_transaction_queue
afterpush_block
many/most of these transactions are actually already applied as they came in via thepush_block
.unapplied_transaction_queue
before applying new branch so that applied transactions can be removed as applying new branch.unapplied_transaction_queue
to not store any transactions when not in speculative mode.unapplied_transaction_queue
.Consensus Changes
API Changes
Documentation Additions