-
Notifications
You must be signed in to change notification settings - Fork 648
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
Change replay percentage to total block size processed #1289 #1335
Conversation
libraries/chain/db_management.cpp
Outdated
if( i % 10000 == 0 ) | ||
{ | ||
total_processed_block_size = _block_id_to_block.total_processed_block_size(); | ||
total_block_size = _block_id_to_block.total_block_size(); |
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.
total_block_size doesn't change during replay, you should fetch that once before entering the loop.
libraries/chain/block_database.cpp
Outdated
@@ -271,4 +271,16 @@ optional<block_id_type> block_database::last_id()const | |||
return optional<block_id_type>(); | |||
} | |||
|
|||
uint64_t block_database::total_processed_block_size()const |
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.
The name is misleading. The method returns the current position in the file. During replay, this is in fact what we interpret as total_processed_block_size, but during normal operation it isn't.
libraries/chain/block_database.cpp
Outdated
return (uint64_t)_blocks.tellg(); | ||
} | ||
|
||
uint64_t block_database::total_block_size()const |
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.
Both these methods should return size_t.
libraries/chain/block_database.cpp
Outdated
@@ -271,4 +271,16 @@ optional<block_id_type> block_database::last_id()const | |||
return optional<block_id_type>(); | |||
} | |||
|
|||
uint64_t block_database::total_processed_block_size()const | |||
{ | |||
_blocks.seekg( 0, _blocks.cur ); |
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.
I think this is superfluous.
Thanks @pmconrad soon will push changes required. |
Pushed commit with required changes (just for the info) |
libraries/chain/db_management.cpp
Outdated
total_processed_block_size = _block_id_to_block.blocks_current_position(); | ||
|
||
std::cerr << " " | ||
<< double(total_processed_block_size*100) / total_block_size << "% " |
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.
I guess this won't overflow? Still a bit uncomfortable with it.
By the way, perhaps better to show the block number as well?
pushed new commit "added percents by num and fixed possible overflow" |
pushed new commit "added replay percents to the log" (see comment #985 (comment)) |
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.
Thanks!
I'd suggest to wait for bitshares/bitshares-fc#76, then bump fc before merging this one. |
@pmconrad Thanks ! |
Can we merge this PR ? |
@pmconrad |
@pmconrad can we merge it too ? Thanks ! |
PR for "Change replay percentage to total block size processed #1289"