Skip to content
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

Merged
merged 5 commits into from
Oct 2, 2018

Conversation

cogutvalera
Copy link
Member

PR for "Change replay percentage to total block size processed #1289"

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();
Copy link
Contributor

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.

@@ -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
Copy link
Contributor

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.

return (uint64_t)_blocks.tellg();
}

uint64_t block_database::total_block_size()const
Copy link
Contributor

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.

@@ -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 );
Copy link
Contributor

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.

@cogutvalera
Copy link
Member Author

Thanks @pmconrad soon will push changes required.

@cogutvalera
Copy link
Member Author

Pushed commit with required changes (just for the info)

total_processed_block_size = _block_id_to_block.blocks_current_position();

std::cerr << " "
<< double(total_processed_block_size*100) / total_block_size << "% "
Copy link
Member

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?

@cogutvalera
Copy link
Member Author

pushed new commit "added percents by num and fixed possible overflow"

pmconrad
pmconrad previously approved these changes Sep 21, 2018
@cogutvalera
Copy link
Member Author

cogutvalera commented Sep 21, 2018

pushed new commit "added replay percents to the log" (see comment #985 (comment))

Copy link
Contributor

@pmconrad pmconrad left a comment

Choose a reason for hiding this comment

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

Thanks!

@pmconrad
Copy link
Contributor

I'd suggest to wait for bitshares/bitshares-fc#76, then bump fc before merging this one.

@cogutvalera
Copy link
Member Author

@pmconrad Thanks !

@cogutvalera
Copy link
Member Author

Can we merge this PR ?

@cogutvalera
Copy link
Member Author

@pmconrad fc bumped in #985 (bitshares/bitshares-fc#76)

@abitmore abitmore added this to the 201810 - Feature Release milestone Oct 1, 2018
@cogutvalera
Copy link
Member Author

@pmconrad can we merge it too ?

Thanks !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants