Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Move chainbase calls out of try-CATCH_AND_EXIT_DB_FAILURE block #9674

Merged
merged 3 commits into from
Nov 17, 2020

Conversation

linhuang-blockone
Copy link
Contributor

Change Description

In combined_database.cpp, when running with chainbase backing store, chainbase calls are outside the try-CATCH_AND_EXIT_DB_FAILUR,
while when running with rocksdb backing store, they are inside the try-CATCH_AND_EXIT_DB_FAILURE.

This PR makes exception handling consistent by moving the chainbase calls out of the try-CATCH_AND_EXIT_DB_FAILURE
when running with rocksdb backing store.

Change Type

Select ONE

  • Documentation
  • Stability bug fix
  • Other
  • Other - special case

Consensus Changes

  • Consensus Changes

API Changes

  • API Changes

Documentation Additions

  • Documentation Additions

libraries/chain/combined_database.cpp Outdated Show resolved Hide resolved
@@ -9,9 +9,9 @@
namespace eosio { namespace chain {
combined_session::combined_session(chainbase::database& cb_database, eosio::session::undo_stack<rocks_db_type>* undo_stack)
: kv_undo_stack{ undo_stack } {
cb_session = std::make_unique<chainbase::database::session>(cb_database.start_undo_session(true));
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems this would be better as a std::optional than a unique_ptr that way you avoid the dynamic memory alloc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changing cb_session to "std::optionalchainbase::database::session cb_session" involves multiple changes in combined_database.cpp and combined_database.cpp. Is it OK not to do it at this time?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yep

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks Kevin for all your help and insist on getting best possible code!

libraries/chain/combined_database.cpp Show resolved Hide resolved
@linhuang-blockone linhuang-blockone merged commit f3be1a2 into develop Nov 17, 2020
@linhuang-blockone linhuang-blockone deleted the move_cb_calls_out branch November 17, 2020 17:13
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants