Skip to content

Conversation

@tsachiherman
Copy link
Contributor

Summary

This PR completes the previous started efforts and ensure all the requests are tunneled directly to the participation registry for optimal performance.

Test Plan

Unit tests added.

@codecov-commenter
Copy link

codecov-commenter commented Mar 14, 2022

Codecov Report

Merging #3768 (5931670) into master (963bc33) will increase coverage by 0.01%.
The diff coverage is 42.85%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3768      +/-   ##
==========================================
+ Coverage   49.75%   49.77%   +0.01%     
==========================================
  Files         392      392              
  Lines       68745    68757      +12     
==========================================
+ Hits        34205    34222      +17     
+ Misses      30777    30770       -7     
- Partials     3763     3765       +2     
Impacted Files Coverage Δ
data/accountManager.go 66.66% <0.00%> (+10.98%) ⬆️
util/db/dbpair.go 0.00% <0.00%> (ø)
util/db/dbutil.go 44.78% <0.00%> (-0.28%) ⬇️
node/node.go 23.33% <12.50%> (+0.07%) ⬆️
data/account/participationRegistry.go 79.24% <87.50%> (+1.08%) ⬆️
cmd/algoh/blockWatcher.go 77.77% <0.00%> (-3.18%) ⬇️
ledger/blockqueue.go 82.18% <0.00%> (-2.88%) ⬇️
crypto/merkletrie/trie.go 66.42% <0.00%> (-2.19%) ⬇️
agreement/cryptoVerifier.go 75.17% <0.00%> (-2.13%) ⬇️
agreement/proposalManager.go 96.07% <0.00%> (-1.97%) ⬇️
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 963bc33...5931670. Read the comment docs.

// Persist participation registry metrics.
node.accountManager.FlushRegistry(2 * time.Second)
// Persist participation registry updates to last-used round and voting key changes.
err = node.accountManager.Registry().Flush(participationRegistryFlushMaxWaitDuration)
Copy link
Contributor

@winder winder Mar 15, 2022

Choose a reason for hiding this comment

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

I'm not sure this duration should be raised. Don't we want to keep the warning if it is taking > 2 seconds?

Suggested change
err = node.accountManager.Registry().Flush(participationRegistryFlushMaxWaitDuration)
err = node.accountManager.Registry().Flush(2 * time.Second)

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be nice to get a warning about this specific flush timeout being slow, agreed. (As opposed to the REST API ones)

return makeErasableAccessor(dbfilename, false)
}

func makeErasableAccessor(dbfilename string, readOnly bool) (Accessor, error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this function does not need readOnly argument, since _secure_delete does not make sense for reader

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It depend on the case - see new erasablepair

Copy link
Contributor

Choose a reason for hiding this comment

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

I discovered our readOnly argument is not enforced by the driver, and mostly only controls whether _txlock=immediate is set in the URI. So I wanted to ensure that both of the pair of DB conns used the same _secure_delete flag when being opened, just in case.

}
}

// mark updated records as dirty, so they will be flushed by a call to FlushRegistry after each round
Copy link
Contributor

Choose a reason for hiding this comment

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

FlushRegistry func looks removed

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, we should fix this in a later PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to add a TODO here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll take care of this one.

@tsachiherman tsachiherman merged commit 08792f2 into algorand:master Mar 15, 2022
@tsachiherman tsachiherman deleted the tsachi/updatePartDB branch March 15, 2022 01:33
@algojack algojack mentioned this pull request Mar 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants