-
Notifications
You must be signed in to change notification settings - Fork 139
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
feat: Sync improvements and propagation #1530
Conversation
8e25fee
to
c5c35cd
Compare
d6cccfc
to
31e1429
Compare
35fc560
to
9e99d99
Compare
iroh-sync/src/store/fs.rs
Outdated
// Table | ||
// Key: ([u8; 32], [u8; 32]) # (NamespaceId, AuthorId) | ||
// Value: (u64, Vec<u8>) # (Timestamp, Key) | ||
const LATEST_TABLE: TableDefinition<LatestKey, LatestValue> = TableDefinition::new("latest-1"); |
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 table will be empty on new versions, resulting in wrong results, we should either do a migration or error on an existing db
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.
Good point. I wrote a migration: 8865641
ebd6cc9
to
8865641
Compare
Description
This PR implements sync propagation. NOTE: The main feature of this PR, propagating
SyncReport
s to neighboring peers, is currently DISABLED through a constant which is set to false (SYNC_REPORTS_ENABLED
iniroh/src/sync_engine/live.rs
). The test for this featuresync_big
is ignored. We will enable the feature once the test is not flakey anymore.iroh-sync
now returns a structAuthorHeads
which contains a map with an entry for each author for which we received entries in the sync operation, and the latest timestamp of all entries we received. So it is a kind of "cheapo vector clock", indicating "what's the latest entry we received in this sync op for each author"AuthorHeads
struct is then sent as a gossip message * to neighbors only* as aSyncReport
AuthorHeads
have any news to offer (i.e. if it contains a timestamp for an author newer than the latest existing entry for this author in the local store). If so, the node starts a sync request to the node we received the report fromThrough this, the sync operations should propagate, and through checking the
AuthorHeads
if there are actually news for us loops should be avoided.Notes & open questions
My biggest question is if that propagation model of sending the
AuthorHeads
to neighbors will scale in practice.There is a test included that passes for 20 nodes, but hangs for more nodes. Reason unknown.
Some notes:
AuthorHeads
is naive and not at all efficient atm, we will have to add a new table to the redb to storeAuthorId -> LatestEntry
LiveSync
actor would really benefit from some refactoring to better track the various states involvedAuthorHeads
to some number of authorsChange checklist