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

add genesis data to es_objects #1717

Merged
merged 7 commits into from Apr 23, 2019

Conversation

Projects
3 participants
@oxarbitrage
Copy link
Member

commented Apr 12, 2019

For issue #1652

Provides option es-objects-load-genesis enabled by default to save accounts, assets and balances from the genesis file to ES.

1652

@abitmore abitmore added this to In development in Feature Release (3.1.0) via automation Apr 12, 2019

@abitmore abitmore added this to the 3.1.0 - Feature Release milestone Apr 12, 2019


block_number = 1;
auto block1 = db.fetch_block_by_number(1);
if(block1.valid())

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 13, 2019

Contributor

Better always use head_block_num and head_block_time

@@ -260,6 +316,7 @@ void es_objects_plugin::plugin_set_program_options(
("es-objects-index-prefix", boost::program_options::value<std::string>(), "Add a prefix to the index(objects-)")
("es-objects-keep-only-current", boost::program_options::value<bool>(), "Keep only current state of the objects(true)")
("es-objects-start-es-after-block", boost::program_options::value<uint32_t>(), "Start doing ES job after block(0)")
("es-objects-load-genesis", boost::program_options::value<bool>(), "Load genesis data to ES(true)")

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 13, 2019

Contributor

The documentation string is misleading. The option will index whatever is in the database on startup.
Also, genesis() is called after the first change, which includes changes that were applied after genesis.

@pmconrad

This comment has been minimized.

Copy link
Contributor

commented Apr 17, 2019

How about connecting database::applied_block to genesis()? You could use block number 1 as the trigger, which is almost identical to genesis state. It is also triggered during replay, unlike new/changed/removed_objects .

@oxarbitrage

This comment has been minimized.

Copy link
Member Author

commented Apr 17, 2019

Good idea, i think there is going to be less problems that way as we make sure genesis is only done at block 1.

Applied at 5c2692d

FC_THROW_EXCEPTION(graphene::chain::plugin_exception, "Error inserting genesis data.");
else {
bulk.clear();
return true;

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 18, 2019

Contributor

This return is superfluous

@@ -260,12 +313,21 @@ void es_objects_plugin::plugin_set_program_options(
("es-objects-index-prefix", boost::program_options::value<std::string>(), "Add a prefix to the index(objects-)")
("es-objects-keep-only-current", boost::program_options::value<bool>(), "Keep only current state of the objects(true)")
("es-objects-start-es-after-block", boost::program_options::value<uint32_t>(), "Start doing ES job after block(0)")
("es-objects-load-genesis", boost::program_options::value<bool>(), "Index whatever is in the database on startup."

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 18, 2019

Contributor

Does this option make much sense? Under which circumstances would you want to turn that off?

This comment has been minimized.

Copy link
@oxarbitrage

oxarbitrage Apr 18, 2019

Author Member

Not needed, removed.

@@ -266,6 +315,13 @@ void es_objects_plugin::plugin_set_program_options(

void es_objects_plugin::plugin_initialize(const boost::program_options::variables_map& options)
{
database().applied_block.connect([&](const signed_block &b) {

This comment has been minimized.

Copy link
@pmconrad

pmconrad Apr 20, 2019

Contributor

Please capture only what's required.

@pmconrad
Copy link
Contributor

left a comment

Looks good. Haven't tested.

@oxarbitrage oxarbitrage merged commit 47b4082 into bitshares:develop Apr 23, 2019

2 checks passed

ci/dockercloud Your tests passed in Docker Cloud
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

Feature Release (3.1.0) automation moved this from In development to Done Apr 23, 2019

@oxarbitrage oxarbitrage referenced this pull request Apr 23, 2019

Closed

es-objects plugin does not load genesis data. #1652

1 of 17 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.