Data Synchronization & Replication Consistency
Deep-dive page: how replicated social data converges, stays valid, and survives churn and offline periods.
Sources in order of authority: current code (
com.p2pframework.DDS, PAST replication incom.p2pframework.storage.past) first; then newest first: Masinde dissertation 2020 (churn/replication studies) → PG 2013 report (signed replication, offline notifications) → Graffi & Xu CTS 2014 (update/consistency protocol, still the design reference) → PG 2012 report (remote-operation protocol).
Where "synchronization" happens in LibreSocial
There is no single sync daemon; consistency is maintained at four layers:
- DDS object level — the update path. Writers apply remote operations against bucket chains instead of republishing whole objects; a four-step protocol (request, hash/version comparison, ordered apply, done message) serialises concurrent writers, and a random nonce in the signed item prevents replay (PG 2012, CTS 2014). Concurrent updates converge through bucket merge + tombstones; consolidation then removes deleted shares (deleted-entry share 0.3 → <0.05; splitsize 20 a good trade-off) — see DDS internals.
- Replication level — PAST keeps RF copies of each bucket (RF = leafsetSize/2 + 1). PG 2013
added signature validation before a replica is accepted (
SecureStorageItemsigning fix — the same signing bug had affectedPastryStorageItemandDistributedDataItemContainer); the dissertation shows RF must grow with the network to stay stable (dissertation). - Content-push level (social caching) — wall/profile updates are pushed to subscribers, which is what makes cached copies provably consistent (ISNCC 2020, caching).
- User level (offline periods) — the Notifications plugin stores messages offline on reachable peers so a returning user receives everything missed, including key distribution traffic for group encryption (PG 2013, access control).
Churn behaviour (authoritative measurement)
The dissertation's churn experiments show FreePastry + the capacity protocol handle join/leave storms without service degradation up to 2000 nodes, with weak nodes excluded from routing and storage (systematic evaluation, dissertation). Earlier Paderborn testing had already disabled the parallel/iterative routing optimisation due to churn problems and set search timeouts to 5 s (PG 2013) — a small example of newer work superseding an older optimisation.
Known weaknesses (open work items)
- #33 (open): replication is attackable because neighbouring nodes in the ring can overtake replica responsibilities — the replication placement is proximity-based, not adversary-aware.
- #35 (open): replication does not (fully) check data validity on receipt — PG 2013 fixed signing but the semantic validity check is still missing. GitLab item #22 ("Expertenrolle Replication / Zugriffskontrolle: PAST") is closed: the responsibility split exists in the code; these two open items are its remaining edges.
- A consolidated design tying #33/#35 to the ECC identity layer would pair naturally with the security roadmap blog post.
Design choice: eventual convergence, per-object serialisation
LibreSocial deliberately avoids global clocks or vector clocks per user: ordering is enforced per bucket via the remote-operation handshake, and cross-bucket conflicts are accepted and merged at the DDS level. The rationale (CTS 2014): social data operations are user-paced and commutative enough (add/delete entries) that object-granular convergence is cheaper than transactional machinery, while the security layer guarantees who may write at all (access control).
Related
DDS internals · caching · StorageDispatcher component · PAST storage component · evaluation benchmarks