Conditional Object Write
A conditional object write succeeds only if a specified precondition holds when the storage service applies the write. Create-if-absent protects a fresh key from replacement; compare-and-swap replaces an object only if its current validator matches the one the writer previously read. A separate read followed by an unconditional write does not provide the same protection.
Suppose two writers read publication token A. The first prepares immutable files and conditionally replaces A with B. The second still expects A and is rejected. It must inspect the new state and decide whether its candidate remains valid. Retrying without the condition would discard the conflict protection.
The validator is service-specific. S3 conditional writes use If-Match with an ETag or If-None-Match with an asterisk. Do not substitute an arbitrary version identifier or assume an ETag is a universal checksum. Handle the documented conflict and retry behavior for the exact API operation.
Publication order is not source freshness. A candidate built from older input can satisfy a current publication precondition, so enforce source-version policy separately. After a lost response, inspect whether the intended commit is present before deciding what to retry. One conditional object write does not atomically update several tables or prevent later deletion of referenced files.
See Designing an Object-Storage Data Lake for worked examples.
Reference: S3 conditional writes.
Discover more from Insightful Data Lab
Subscribe to get the latest posts sent to your email.
