Skip to content

Sync with other peers never re-downloads blobs #82

@gusinacio

Description

@gusinacio

Current system allows to set a Download policy so you automatically download values (blobs) from peers that inserted an entry.

When everyone is connected, and you are fully synced, it works without any problem and it automatically downloads from peers. It also maintains a list of missing_hashes in case who inserted doesn't have the hash yet, and later downloads from them when it receives a ContentReady event.

The problem arrises when you first sync with a peer that doesn't have all blobs downloaded. This might happen because it didn't download yet or because their Download Policy doesn't allow them to download it.

After that, the system will never try to download from any other peer that information unless you do so locally. Even if you sync with other peers, you only exchange information about the keys, so in case your keys are synced, you don't try to download the values.

For me, this seems like a non intended behavior because the download policy of one peer shouldn't affect other peers that are actively downloading all values.

Other projects like iroh-lan, do the re-syncing themselves by querying the whole key-value store and looking for missing hashes in blobs then retrying download them from other peers.

This could be done more efficiently inside Docs and also emitting events about ContentReady again so when someone does the syncing, others could piggyback and request any missing_hashes on their side directly, reusing docs machinery.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    Status

    🏗 In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions