-
Notifications
You must be signed in to change notification settings - Fork 273
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 SyncV2 Causal Negotiation #5570
Conversation
5a74104
to
40af0b1
Compare
@@ -116,6 +117,9 @@ syncFromFile :: | |||
Cli (Either (SyncError SyncV2.PullError) CausalHash) | |||
syncFromFile shouldValidate syncFilePath = do | |||
Cli.Env {codebase} <- ask | |||
-- Every insert into SQLite checks the temp entity tables, but syncv2 doesn't actually use them, so it's faster | |||
-- if we clear them out before starting a sync. | |||
Cli.runTransaction Q.clearTempEntityTables |
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.
The temp entity table should be empty except if a past sync failed and was never completed, right?
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.
Yup; but it's also never otherwise cleared, so if you accidentally clone @unison/base/main
instead of lib.install @unison/base
or something like that it'll leave junk in there basically forever.
Overview
UCM will now use the new causal-dependencies endpoint to determine which dependencies of a new root it already has, then will tell Share to skip certain dependencies in its stream.
This massively speeds up incremental pulls on a given branch.
Implementation notes
Before initiating a download, ask Share to enumerate relevant dependencies (currently the causal spine and all contained library causal hashes). Then pass the list of dependencies we've already got along to the download endpoint.
Note: this now clears the temp_entity tables before starting a pull.v2, we still have code to check temp entities on every insert, so clearing the tables speeds that up. There's not much reason to keep large amounts of code sitting around in there when the user isn't actively trying to pull.v1 something.
Interesting/controversial decisions
Nope
Test coverage
I've done a bunch of testing on staging, but would be good to dogfood it a bit with the Unison team or early adopters.
Loose ends