-
Notifications
You must be signed in to change notification settings - Fork 137
md_ops: add caching to improve validation of MDs written by revoked devices #1893
md_ops: add caching to improve validation of MDs written by revoked devices #1893
Conversation
34ff9bf
to
867480e
Compare
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.
LGTM; just a nit, an understanding question, and a small advice.
// for TLF 1, if we have a next revision of 1000, and we've | ||
// validated that MDs 100-1000 form a valid chain, then the map | ||
// would contain: {1: {1000: 100}} | ||
leafChainsValidated map[tlf.ID]map[kbfsmd.Revision]kbfsmd.Revision |
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.
Is the idea that we are always checking on the revision right after a device revoke?
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.
Is the idea that we are always checking on the revision right after a device revoke?
Yep. When we see something signed by a revoked key, we ask the service what revision came back right after the revoke, and always check that one.
Instead of hitting the server every single time we need to verify a revoked key. For example, when we have to verify lots of MDs written by the same revoked key when doing garbage collection. Issue: KBFS-3581 Issue: #1888
So that the cache can assume all nodes have been validated. Issue: KBFS-3581
When verifying the MDs written by a revoked device, we have to validate a long chain of MDs between the MD we're looking at, and the MD just following the revocation. if we're doing something like garbage collection and iterating through MDs, we may have to do this repeatedly for the "end" MD in the chain. If that chain exceeds the size of the in-memory MD cache, we will be going to the mdserver a lot to download the same MDs over and over again. Instead, introduce a simple cache that maps the "end" MD to the earlier revision in a validated chain. That way we can avoid all the extra downloads when we miss the cache, and just download the MDs we care about. Issue: KBFS-3581
Suggested by songgao. Issue: #1893
867480e
to
daf47f8
Compare
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.
Thanks!
In #1888, a user is doing way more work than necessary to validate a bunch of MDs written by a revoked device, during garbage collection. We can improve that a small amount of caching:
This PR:
FindNextMD
.This should eliminate most of the redundant work that was happening when verifying lots of MDs written by the same revoked device, as in garbage collection.
Issue: KBFS-3581
Issue: #1888