Highlights

Contents

Part VII
07

Lifecycle and retention

We decide how long source bytes, derived bytes, versions, and unfinished transfers remain. Moving data to another tier can change retrieval behavior as well as cost. We will compute retention totals, make deletion explicit, recover orphaned states, and preserve operational evidence.

CHAPTER ATLAS / FOLLOW THE READING PATHCHAPTER ATLAS / FOLLOW THE READING PATH1Local, block, file,object storage2Buckets, objects andmetadata3Presigned URLs and directupload4Multipart uploads5Checksums and integrity6Replication anddistributed file systems7Lifecycle and retention8Case study: the mediaupload path

#Section 25Lifecycle policies move or expire objects

Heron keeps a clip for the illustrative 30-day retention period, but most reads happen early. A lifecycle policy applies actions such as storage-class transition or expiration according to object age, tags, or other supported rules. It changes the retained object population over time.

Assume an additional illustrative media workload of 100 clips per day, each 5,000,000,000 bytes. Thirty days retains 3,000 clips and 15,000,000,000,000 payload bytes. If 7 days remain in a hot tier, that population holds 3,500,000,000,000 bytes, while the remaining 23 days hold 11,500,000,000,000 in another tier.

100 CLIPS/DAY × 5 GB × 30 DAYS = 15 TB: 3.5 TB HOT (7 DAYS), 11.5 TB COLDER100 CLIPS/DAY × 5 GB × 30 DAYS = 15 TB: 3.5 TB HOT (7 DAYS), 11.5 TB COLDERother 23 days: 2,300 clips, 11,500,000,000,000 Bhot 7: 700 clips, 3.5 TBreplicas, metadata, versions and incomplete parts come on top
Figure 13.28Illustrative clip workload and decimal units. Replication, metadata, versions, and incomplete parts are additional.

S3 lifecycle documentation describes supported transition and expiration actions. A selected class can require restoration or different access charges. Do not quote prices from memory; a design can compare bytes and retrieval requirements without inventing a current bill.

#Section 26Retrieval behavior is part of the policy

A viewer requests an archived clip and the app returns a signed URL immediately. If the selected storage tier requires a restore first, the link may not supply playable bytes yet. Retention policy must coordinate with playback availability and the application state.

Represent archival or restore progress explicitly. Heron can show that a clip is retained but not immediately playable, start a permitted restore request, and publish availability only when the object is retrievable. A cached rendition may provide a limited alternative, but it has its own age, availability, and authorization contract.

AN ARCHIVED CLIP EXISTS BUT IS NOT PLAYABLE UNTIL A RESTORE FINISHESAN ARCHIVED CLIP EXISTS BUT IS NOT PLAYABLE UNTIL A RESTORE FINISHESarchivedretainedrequest restorepermittedwait + verifytier-dependentplayback accessnow playable
Figure 13.29Retrieval-state concept. Exact restore duration and access behavior depend on the selected tier.

The storage calculation should count source, renditions, old versions, restore copies, and transfer buffers separately where they coexist. A lifecycle transition does not delete every derived object automatically. Associate each derived identity with its source and policy so cleanup can decide what is still needed.

#Section 27Delete through a recoverable application state

A user deletes clip c7. If the object disappears before metadata changes, the app may still offer a broken playback link. If metadata disappears first and storage deletion fails, bytes remain orphaned. There is no single shared transaction across those owners.

Commit a deletion state or tombstone in the database, stop issuing new playback access, and perform storage cleanup under a retained idempotent job. Record the exact immutable identities or versions to delete. A worker retry should not infer the current key and accidentally remove a replacement upload.

COMMIT THE DELETE AND THE EXACT IDS FIRST; CLEAN THE BYTES IN A RETRYABLE JOBCOMMIT THE DELETE AND THE EXACT IDS FIRST; CLEAN THE BYTES IN A RETRYABLE JOB1commit tombstone+ object ids2stop newplayback URLs3delete recordedobjects4mark cleanupcompletealready-issued URLs and CDN copies expire on their own clocks
Figure 13.30Recoverable deletion sequence. Previously issued capabilities and cached bytes require their own revocation or expiry policy.

Deletion is a security and product promise as well as space reclamation. Retained backups, legal retention, version histories, and already-issued access may affect what disappear means. State these boundaries instead of assuming a successful object delete instantly erases every copy and cached response.

#Section 28Reconciliation finds stranded states

A worker completes storage upload but crashes before publishing metadata. Another fails after marking deletion but before deleting bytes. A reconciler compares retained state across owners and repairs mismatches through idempotent actions. It is a designed recovery path, not a speculative cleanup script.

For each pending upload, ask whether the exact reserved object or multipart session exists and is still within its supported lifetime. For each published record, verify required object identities according to the chosen audit policy. For each tombstone, finish recorded cleanup. These scans need bounded batches and indexes so they do not overload normal serving.

THREE STRANDED STATES, THREE DIFFERENT REPAIRSTHREE STRANDED STATES, THREE DIFFERENT REPAIRSpending + parts existwithin resume horizon?resume or abortobject done, row pendingobject verified?publish or reclaimrow deleted, bytes remaintombstone lists idsidempotent deleterecover by identity and state, never by age alone
Figure 13.31Reconciliation matrix. An old pending record alone is not proof that a published replacement can be deleted.

A notification can speed discovery, but notifications need deduplication and loss recovery according to their actual delivery contract. Periodic reconciliation catches states not resolved by the fast path. Keep command evidence long enough that retries and cleanup can distinguish completed work from new work.