-
Notifications
You must be signed in to change notification settings - Fork 366
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
INDY-2262: Implementing NodeRegHandler #1397
Conversation
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
Signed-off-by: ashcherbakov <alexander.sherbakov@dsr-corporation.com>
This pull request introduces 2 alerts and fixes 1 when merging 8371cad into 2043fa6 - view on LGTM.com new alerts:
fixed alerts:
|
This pull request introduces 1 alert and fixes 1 when merging 22e7b4a into 2043fa6 - view on LGTM.com new alerts:
fixed alerts:
|
This pull request introduces 1 alert and fixes 1 when merging b28a8a9 into 2043fa6 - view on LGTM.com new alerts:
fixed alerts:
|
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 looks good overall. Things I would consider changing in future PRs are:
- intention behind
on_catchup_finished
hook looks sensible, however name is a bit misleading IMHO. I'd consider naming it likeinitialize
,reset
orsync_from_ledgers
(or maybe there is better name) - we implement same encoding algorithm for different fields in audit ledger again and again, probably it's time to move it into separate set of helper functions?
- now that node reg is stored in audit ledger - can we remove primaries from audit ledger?
txn[AUDIT_TXN_NODE_REG] = current_node_reg | ||
|
||
# 3. Previous primaries field is delta | ||
elif isinstance(last_audit_node_reg, int) and last_audit_node_reg < self.ledger.uncommitted_size: |
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.
Probably it makes sense to move check last_audit_node_reg < self.ledger.uncommitted_size
inside this brach and throw LogicError
if it doesn't hold
|
||
if node_name not in self.uncommitted_node_reg and VALIDATOR in services: | ||
# new node added or old one promoted | ||
self.uncommitted_node_reg.append(node_name) |
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.
It seems like this code relies on uncommitted_node_reg
always being initialized. Is it always the case?
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.
Yes. It's called every time a NODE txn is being applied.
Thanks for review!
I agree that the current name is not perfect. However, I believe that our general name convention in BatchHandlers is a callback on some system events (on batch created, on batch reverted, etc.), so on catchup finished looks fine, and it makes clear that this is not an abstract initialization, but the one that needs to be done after catchup is finished.
Fully agree, And there is a TODO comment for this (as well as for other improvements I would like to have). The PR is huge even without these changes, so I suggest to do it in one of the next PRs.
In theory yes, but I'm not sure that we must do it.
|
Implemented Items 1, 2 and 4 from INDY-2262 PoA: