Versioning
Versioning refers to the process of creating, storing, and managing multiple versions of objects in an object storage system. It allows you to maintain different versions of the same object over time, providing an effective way to protect against accidental deletion, corruption or overwriting of data.
Purpose of Versioning
Versioning is primarily used for:
- Data Protection: it prevents data loss by maintaining older versions of objects. These can be restored if the latest version is accidentally deleted or corrupted.
- Auditing and Compliance: for legal and compliance reasons, some organizations may need to retain historical versions of data.
- Recovery: users can recover from accidental or malicious changes by reverting to a previous version of an object.
How Versioning Works in SCS3
When versioning is enabled in a bucket, every time an object is modified or deleted, SCS3 keeps the old object. It creates a new version and the older one(s) are retained.
Version ID
Each version of an object is assigned a unique identifier, known as the VersionId
. This ID allows to differentiate between multiple versions of the same object.
Versioning States
A SCS3 bucket can be in one of the following versioning states:
- Unversioned: by default, a bucket is unversioned, meaning it does not keep older versions of objects. If an object is overwritten or deleted, the original object is lost.
- Versioning enabled: once versioning is enabled, SCS3 keeps all versions of an object. Even if an object is deleted, its previous versions can still be retrieved.
- Versioning suspended: if versioning is suspended, no new versions of an object will be created. New objects uploaded to the bucket after versioning is suspended will not have version IDs. Modifying or deleting these new unversioned objects will result in permanent changes without the ability to revert to a previous version.
Important
Objects created while versioning was enabled still retain their version history - existing versions remain accessible and unchanged. Deleting these objects will behave the same way as in a versioned bucket. Read more on deleting below.
Overwriting and Deleting Objects
- Overwriting: when overwriting an object in a versioned bucket, SCS3 creates a new version of the object and retains the old version.
- Deleting: when deleting an object in a versioned bucket without specifying a
VersionId
, SCS3 does not remove it. Instead, it adds a delete marker, hiding the object and its previous versions. This action is reversible by removing the delete marker.
Warning
If you delete a specific version of an object by specifying its VersionId
, that version is permanently removed from the bucket and cannot be recovered. Use this operation with caution to avoid unintended data loss.
Restore Versions
Users can retrieve any version of an object by specifying the VersionId
.
If a versioned object is deleted, it can still be restored by deleting the delete marker.
Delete Markers
When an object is deleted in a versioned bucket without specifying a VersionId
, SCS3 adds a delete marker rather than removing the object.
This marker is treated as the latest version. An attempt to retrieve the object will return an error unless a specific older version is requested.
Also an object with a delete marker will not show up when listing objects in a bucket.
Warning
Deleting a specific object version (by specifying its VersionId
) permanently removes that version from the bucket. Unlike delete markers, this operation is irreversible.
Lifecycle Policies
SCS3 allows the creation of lifecycle policies to manage the retention and expiration of object versions automatically. For example, you may define a policy that deletes older versions after a certain period of time. This helps managing storage costs. You may find more information and examples in Lifecycle Policies.
Use Cases
- Backup and Recovery: SCS3 versioning is commonly used for backup and disaster recovery scenarios, where organizations need to ensure that previous versions of objects are available in case of accidental deletion or corruption.
- Compliance Storage: for industries with strict regulatory requirements, versioning ensures that historical data is retained and can be audited.
Performance Considerations
While versioning is powerful, it comes with some overhead. Storing multiple versions of objects increases storage usage and may lead to an increased number of requests. This impacts the performance of the workload and of the SCS3 clusters. Careful management, including the usage of lifecycle policies, is essential to balance the benefits of versioning with its costs.