can you put it in meaningful commits? · Entire
Overwriting Sync Design Proposal
Assumptions
- Target is read-only, allowing overwrites.
- Bandwidth efficiency is not a priority.
Current Design Overview
The existing synchronization is designed for safe incremental mirroring, ensuring no data loss or conflicts by checking:
- Fast-forward checks: Verify that the updates can safely push to the target without losing data.
- Blocked updates: Avoid any operations that would disrupt ongoing updates.
- Prune semantics: Manage the state effectively to minimize the impact of deletions.
Key Components
- Fast-forward/Conflict Planning in
PlanRef - Relay Eligibility Rules in
CanIncrementalRelay - Materialized Fallback Path in
materialized.Execute
Proposed Simplifications
- Adopt a Forceful Replication Model:
- Treat sync as direct replication, which eliminates complexities tied to incremental checks.
- Update Logic:
- Always list source and target references.
- For each desired reference:
- If source hash matches target hash, skip.
- Otherwise, send an update command with target's current hash as
oldand the source hash asnew.
- Fetch Logic:
- Fetch from the source without
haves to receive a complete data pack instead of a minimal delta.
- Fetch from the source without
- Direct Target Push:
- Push updated data directly to the target.
- Simplify Other Components:
- Remove complexities related to incremental logic, including bootstrap special-casing, incremental relay eligibility, and materialized object counts.
Caveats
- Target reference discovery is still required for effective updates since
receive-packcommands need the currentoldhash. - Considerations for request/body size limits at the target could still warrant bootstrap batching.
Additional Considerations
In practice, this structure allows:
- Source discovery and validation to ensure updates are effective.
- Streamlined planning for creating, updating, deleting based purely on hash comparisons.
- Focused, efficient data transfer without needless overhead.
Implementation Steps
- Define New Operations:
- Introduce clear operational definitions within the software architecture.
- Create Testing Framework:
- Ensure that execution and behavior align with the single-command approach.
- Validate Performance:
- Measure efficiency gains in both computation and data transfer with the new approach.
- Analyze User Impact:
- Gather feedback based on user interactions and adaptation of the new operational model.
Conclusion
Through these modifications, the entire sync process can shift from a complex, safety-focused model to a more streamlined and direct replication approach, yielding faster operations with less overhead.