Closed linh2931 closed 1 year ago
To help identify where to disable chainbase state modification while executing readonly transactions, below is a list of locations that modify chainbase state:
resource_limits_manager::update_account_usage
. Modify resource_limits_config_object
to set initial CPU and NET usage by an account. Called by transaction_context::init()
, in turn by transaction_context::init_for_input_trx()
transaction_context::record_transaction
. Create transaction_object
for checks for dups. Called by transaction_context::init_for_input_trx()
global_action_sequence
in dynamic_global_property_object
. Called by apply_context::next_global_sequence()
, in turn by apply_context::exec_one()
recv_sequence
in account_metadata_object
. Called by apply_context::next_recv_sequence()
, in turn by apply_context::exec_one()
auth_sequence
in account_metadata_object
. Called by apply_context::next_auth_sequence()
, in turn by apply_context::exec_one()
resource_limits_manager::add_transaction_usage
. Modify resource_usage_object
to set actual CPU and NET usage by an account. Called by transaction_context::finalize()
authorization_manager::update_permission_usage
. Modify permission_usage_object
to update permission usage. Called by transaction_context::finalize()
This is the first of the three phases of implementing parallel readonly transaction execution. The task is to make sure readonly transactions to be handled correctly without multithreading involved. After this is done, move to parallelizing readonly transactions and necessary configuration changes.
send_readonly_transaction
.resource_limits_config_object
from updated.transaction_object
, as duplicate transaction checking is not needed for readonly transactions.account_metadata_object
), auth sequence (account_metadata_object
) at the end of transaction execution. Readonly transactions should be a no-op on those sequences.resource_usage_object
) at the end of transaction execution.permission_usage_object
is not updated.db_store_i64
,db_update_i64
, anddb_remove_i64
inchain/apply_context.cpp
,store
,update
, andremove
ingeneric_index
class inapply_context.hpp
.eosio_contract.cpp
which modifies DB states.chainbase
mode toassert_on_wirte
. Assert if any ofcreate
,modify
,remove
is called. This is intended to be a safety net. Any assert inassert_on_wirte
mode is a bug which requires a fix.See also https://github.com/eosnetworkfoundation/product/issues/95 https://github.com/AntelopeIO/leap/issues/364