Skip to content

Deletion

The deletion system is set up in a similar way to the replication. Except, the stager parses the server for file replicas that match different conditions:

Python
session.query(FileReplica)
.join(File)
.filter(
    FileReplica.deletion_state == TransformationState.available,
    FileReplica.delete_after <= delete_after,
    FileReplica.storage_id == storage_id,
    FileReplica.replicate_to == None,
    File.num_available_replicas > 1, # (1)!
)
.order_by(FileReplica.id)
.limit(MAX_QUEUED)
.all()
  1. Note that this condition prevents the last copy of a file replica from being deleted, however, this will eventually be removed.