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
Conversation
|
||
block_number = 1; | ||
auto block1 = db.fetch_block_by_number(1); | ||
if(block1.valid()) |
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.
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)") |
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 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.
How about connecting |
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; |
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.
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." |
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.
Does this option make much sense? Under which circumstances would you want to turn that off?
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.
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) { |
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.
Please capture only what's required.
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.
Looks good. Haven't tested.
For issue #1652
Provides option
es-objects-load-genesis
enabled by default to save accounts, assets and balances from the genesis file to ES.