-
Notifications
You must be signed in to change notification settings - Fork 795
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
1952 unique index2 #2228
1952 unique index2 #2228
Conversation
@theoreticalbts The changes to the indices seems reasonable to me. I want your opinion on them as well. Currently, |
So about the last item, I didn't go through the code in detail. (It is quite complicated and uses template magic.) But I suspect it narrows down the set of objects as much as possible using an index, then sorts all the objects in the set into an in-memory structure. The problem with this approach is it defeats the purpose of pagination. The purpose of pagination is, by limiting the number of requested objects to Since we're breaking API's with |
I am fine removing unused indices from |
6090e6d
to
3e70491
Compare
In fact if we want to retrieve N records, now we have to retrieve N + K additional information to close actual subset. |
I agree that using a |
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 am in agreement with @theoreticalbts regarding the database_api
implementation. The purpose of the API is to return objects with the indices that we need for consensus. If we find a way to eliminate a consensus index, by definition of database_api
, it does not need to be returned. Instead of a complicated reconstruction of the sort order in the API, let's simply eliminate it from the API. The API is WIP. If we don't ship it with the sort order, then it won't be used and we won't have to maintain a complicated implementation.
@@ -37,17 +37,30 @@ DEFINE_API_IMPL( account_history_api_chainbase_impl, get_ops_in_block ) | |||
{ | |||
return _db.with_read_lock( [&]() | |||
{ | |||
std::multiset< api_operation_object > tmp_result; |
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.
FC has multiset serialization. Let's change the returned type in get_ops_in_block_return
to the multiset type to eliminate copying to a vector. When we implement this for rocksdb account history plugin, we can override the comparator to always return true so that it behaves as a queue.
3e70491
to
65b72ae
Compare
@mvandeberg It was made changes according to your tips. |
#1952
short description
It has been made 2 changes:
by_location
inoperation_object
before:
ordered_unique( block, trx_in_block, op_in_trx, virtual_op, id )
after:
ordered_non_unique( block )
This index doesn't attend in consensus, therefore there is't any problem with potential incorrect working. This index is used only during API call.
comment_vote_object
before:
by_comment_voter
,by_voter_comment
,by_voter_last_update
,by_comment_weight_voter
after:
by_comment_voter
,by_voter_comment
Missing indexed are simulated by algorithm.
correctness tests
During 1 week were made hundred of thousands API calls to builds:
develop
,1952-unique-index2
( usingpyresttest
tool ).Comparision showed, that result from above servers are identical.
performance tests
reindex(
develop
branch vs1952-unique-index2
branch ): branch1952-unique-index2
faster 10 minutesTime of 5000 different calls[ s ]( local machine, 1 thread, used tool
pyresttest
)list_votes;by_voter_last_update
(12min. 23 sec
develop ) (12min. 20 sec.
1952-unique-index2 )Time of 4000 different calls[ s ]( local machine, 1 thread, used tool
pyresttest
)get_ops_in_block
(435s
develop ) (435s
1952-unique-index2 )Memory consumption