-
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
Changes from 2 commits
c99aef9
f2daea9
4f21829
beef041
83a66c8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. I think this is superfluous. |
||
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 commentThe reason will be displayed to describe this comment to others. Learn more. Both these methods should return size_t. |
||
{ | ||
_blocks.seekg( 0, _blocks.end ); | ||
return (uint64_t)_blocks.tellg(); | ||
} | ||
|
||
} } |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,9 +81,20 @@ void database::reindex( fc::path data_dir ) | |
skip_tapos_check | | ||
skip_witness_schedule_check | | ||
skip_authority_check; | ||
|
||
uint64_t total_processed_block_size; | ||
uint64_t total_block_size; | ||
for( uint32_t i = head_block_num() + 1; i <= last_block_num; ++i ) | ||
{ | ||
if( i % 10000 == 0 ) std::cerr << " " << double(i*100)/last_block_num << "% "<<i << " of " <<last_block_num<<" \n"; | ||
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 commentThe 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. |
||
|
||
std::cerr << " " | ||
<< double(total_processed_block_size*100) / total_block_size << "% " | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? |
||
<< total_processed_block_size << " of " << total_block_size << " \n"; | ||
} | ||
if( i == flush_point ) | ||
{ | ||
ilog( "Writing database to disk at block ${i}", ("i",i) ); | ||
|
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.