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 extended history tracking for select accounts #2259

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

christophersanborn
Copy link
Member

@christophersanborn christophersanborn commented Sep 14, 2020

Addresses #2258 - "Extended operation history for accounts selected by ID or by registrar".

Adds the following options to account_history plugin:

  --extended-max-ops-per-account arg    Maximum number of operations to keep 
                                        for accounts for which extended history is kept
  --extended-history-by-account arg     Track longer history for these accounts
                                        (may specify multiple times)
  --extended-history-by-registrar arg   Track longer history for accounts with 
                                        this registrar (may specify multiple times)

This PR may also add a partial, if imperfect, solution to #2117 "Track accounts using wildcards".

Note by @abitmore: check this comment for limitation of current implementation: #2259 (review)

@christophersanborn
Copy link
Member Author

Note: code compiles and starts up, but I haven't done a full replay yet to confirm that it is indeed tracking extended history for my accounts. So this code is still in "testing".

@abitmore — I assume this will need to be rebased onto another branch — let me know if develop, hardfork, or elsewhere.

@abitmore
Copy link
Member

Please rebase onto develop branch. Thanks.

@abitmore abitmore linked an issue Sep 14, 2020 that may be closed by this pull request
17 tasks
@christophersanborn christophersanborn changed the base branch from master to develop September 16, 2020 14:18
@christophersanborn
Copy link
Member Author

@abitmore wrote:

Please rebase onto develop branch. Thanks.

Done.

Also my node finished replay and I confirmed it is tracking extended history for the named accounts/registrars and regular (short) history for all other accounts. Looks to be working. (Although my hopes for extended history in the Reference GUI did not pan out — but this seems to be a limitation of the UI, not the API node. Uptick was able to pull all the extended history.)

@abitmore
Copy link
Member

Thanks. I'll review soon.

@abitmore abitmore self-requested a review September 16, 2020 18:29
Copy link
Member

@abitmore abitmore left a comment

Choose a reason for hiding this comment

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

Thanks for the efforts.

The implementation would work for typical use cases. However,

extended_hist |= (account_id == eh_account_id);
}
if ( _extended_history_registrars.size() > 0 ) {
const account_id_type registrar_id = account_id(db).registrar;
Copy link
Member

Choose a reason for hiding this comment

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

Querying DB once on every operation is a bit inefficient. Perhaps better create a new index in the plugin to save the tracked accounts. Why a new index? Because the list is dynamic and grows over time.

Copy link
Member

Choose a reason for hiding this comment

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

Although the account_index is big, the complexity of querying it by ID is linear, so the performance hit is probably not significant. Best if we can have some data to show the differences E.G. time spent for replaying with the old code v.s. the new code.

@abitmore
Copy link
Member

I will decide later whether to merge it as is.

@BhuzOr
Copy link
Contributor

BhuzOr commented Sep 17, 2020

What about something more flexible and powerful like this?

--extended-history-by-account account, max_ops, whitelisted_ops, blacklisted_ops

may specify multiple times

--extended-history-by-account account1, max_ops_1, whitelisted_ops_1, blacklisted_ops_1
--extended-history-by-account account2, max_ops_2, whitelisted_ops_2, blacklisted_ops_2

or as a list of lists

--extended-history-by-account [[account1, max_ops_1, whitelisted_ops_1, blacklisted_ops_1], [account2, max_ops_2, whitelisted_ops_2, blacklisted_ops_2]]

You have specific max_ops per single account/registrar instead of a single global value for everything.
You can also apply a filter, specifying what type of ops to keep OR what type of ops to discard, for that specific account/registrar

Copy link
Member

@abitmore abitmore left a comment

Choose a reason for hiding this comment

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

Approving and merging so far. We can improve later.

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.

Extended operation history for accounts selected by ID or by registrar
3 participants