Skip to content

Deletion with defensive behavior #20

@Antonov548

Description

@Antonov548

Detect Deleted Nodes That Should Be Restored

The Core Issue:

When one client modifies children of a node and another client deletes the parent node (before seeing the modifications), the deletion operation will delete the parent, causing the children to become orphaned. This effectively loses the work made by the first client on those children.

Current Behavior

When apply_delete() is called:

  • The deleted node is detached from its parent
  • The node is marked as tombstoned
  • Children of the deleted node remain in the tree but become orphaned (they still exist but have no parent reference)
  • Any modifications made to these children before the deletion arrived are preserved in the tree structure, but the parent-child relationship is lost

Functional Requirements

  1. Preserve User Work: Modifications made to children before parent deletion should not be lost
  2. Maintain Tree Integrity: Parent-child relationships should be preserved when possible
  3. Conflict Detection: System should detect when deletions conflict with modifications
  4. CRDT Semantics: Solution must maintain eventual consistency across all replicas
  5. Operation Ordering: Solution must handle out-of-order operation delivery correctly
  6. Idempotency: Applying the same operation multiple times should have the same effect

Proposed Implementation

Implement algorithm to find nodes which should be restored in order to preserve work. This algorithm should return list of nodes to restore. Also need to implement restore function which restore last valid parent of node.

In this case responsibility to merge conflict can be delegated to client side.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions