advanced25 min studyLesson 316 in Engineering

Detecting corrupt bytes is different from repairing them

Separate transfer checksums, stored-data scrubs, authoritative versions, and repair evidence while budgeting the cost of reading cold data.

On this page

What you’ll understand

  • Explain what a checksum comparison does and does not establish.
  • Distinguish access-time verification from coverage of cold stored data.
  • Calculate an ideal scan-time bound with consistent binary byte units.

Successful storage once does not prove that every later read returns the intended bytes. Devices, software, memory, and transfer paths can introduce corruption, while infrequently read objects can hide it for a long time. Integrity checks need a reference and a coverage plan. A checksum mismatch detects inconsistency under its assumptions; it does not identify the correct version or create a healthy replacement. Keep detection, diagnosis, and repair as separate stages so an alert cannot be mistaken for restored redundancy.

A checksum needs a defined reference

A client-supplied checksum can help verify upload integrity when the API validates it over the specified bytes with the stated algorithm and checksum type. Multipart checksums can have full-object or composite meanings according to the service contract. An ETag is not a universal substitute. Decide whether the checked representation is the intended object payload, an encoded part, or stored backend data, and retain enough algorithm and version information to compare like with like. A matching string with an unspecified scope is weak evidence.

A noncryptographic checksum targets accidental corruption patterns rather than an adversary who can replace both data and checksum. Even a cryptographic digest needs a trusted reference if malicious replacement is in scope. A mismatch can originate in data, metadata, the transfer path, or an incorrect version association, so inspect the evidence before choosing a repair source. Copying the first available replica because another failed its checksum can propagate stale data unless the replication protocol also establishes the intended generation.

h(Dread)=?cexpectedh(D_{\rm read})\stackrel{?}{=}c_{\rm expected}
h is the specified checksum or digest over the specified byte representation. Equality is meaningful only when c_expected belongs to the intended version and is itself trusted under the fault model. It does not by itself establish freshness, authenticity against all attackers, or repairability.↔ Scroll wide equations horizontally.

Cold objects require deliberate coverage

Checking data only when clients read it leaves cold objects unexamined. Scrubbing schedules integrity work independently of application demand. In the Ceph Squid documentation, shallow scrubbing compares metadata while deep scrubbing also reads object data and checks integrity. The exact schedule and repair behavior depend on configuration and implementation. A configured weekly interval is not proof that every object completed a check during the last week if overload, scheduling, or unavailable devices prevented progress.

Measure completed coverage, age since the last successful check, unreadable fragments, and the time from detection to verified repair. Scans compete with foreground and recovery I/O, so increasing their frequency can affect client latency and repair capacity. Conversely, postponing them indefinitely allows latent errors to overlap with later failures. A useful operational budget includes enough scan throughput to meet the intended coverage objective under realistic competing work rather than assuming unused bandwidth is always available.

Tscan≥VreadBallowedT_{\rm scan}\geq\frac{V_{\rm read}}{B_{\rm allowed}}
V_read is bytes that must be read and B_allowed is a sustained byte-per-second scan budget. The ratio is an ideal lower bound in seconds assuming that budget is attainable; seeks, checksumming, retries, scheduling, and other bottlenecks can lengthen the scan.↔ Scroll wide equations horizontally.

A repaired object needs new integrity evidence

After detecting a bad fragment, establish a valid authoritative source or enough valid matching erasure-code fragments. Repair writes replacement data and should verify the result and restored placement. A clean checksum on an old generation is not a license to overwrite a committed newer one. Also investigate repeated repairs on a device: serving a read by using another replica can hide a failing component from a simplistic success-rate graph. Ceph's read-repair and scrub-related health signals illustrate why error counts and client success answer different questions.

Use the cache lab to inspect request coverage rather than corruption itself. Reset, set both C=4 and s=4, predict that the initial sixteen requests visit only identifiers 0,4,8,12, then inspect and Play or Step. Reset and set both C=4,s=1 for a separate stream that visits all sixteen identifiers initially. The deterministic cache contains no checksum, disk, or scrub, and playback is capped at 4,096 evaluated requests. Its lesson is that repeated hot accesses do not cover the unvisited population; actual scrub completion must provide that missing evidence.

Budget one ideal deep scan

A fictional scan must read 1 TiB of stored data and receives a sustained 256 MiB/s read budget. Assume no seeks, retries, CPU limit, or scheduling gaps. Calculate the ideal time.

  1. Convert the volume to the bandwidth unit: one TiB is 1,048,576 MiB. Keeping binary units consistent avoids treating the prefix T as an unspecified decimal or binary multiplier.

  2. Divide 1,048,576 MiB by 256 MiB/s to obtain 4,096 seconds. That is 68 minutes and 16 seconds, or approximately 1.138 hours.

  3. Treat this as an ideal budget under the assumptions. If only half the bandwidth is available on average, the corresponding transfer-only estimate doubles to 8,192 seconds before any additional overhead.

The result

The ideal full-data read takes 4,096 seconds. Scheduling a scrub is not the same as proving that this coverage actually completed and any discovered defects were repaired.

Explore the model

Interactive lab

Interactive lab · cache

Hot access can leave most identifiers unvisited

Compare fresh Reset → set both C=4,s=4 and Reset → set both C=4,s=1 cases. Predict the distinct identifiers in the initial sixteen requests, then Play or Step. The exact LRU trace does not perform checksums, detect bit rot, or repair storage.

Hot access can leave most identifiers unvisitedA fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Current readings: Hits / requests: 0 / 16; Hit rate: 0%; Address-stream period: 16 addresses. All parameters are adjustable with the labeled controls below.Fully associative LRU cache after 16 deterministic requests: 0 hits and 16 misses.Most recent 16 requestsaddress = i × 3 mod 160M3M6M9M12M15M2M5M8M11M14M1M4M7M10M13MCurrent cache order · oldest → newest471013Latest address 13 · miss: inserted as newestToy address stream · period 16 · starts empty
Cached addressMiss / evictionMost recent request
Hits / requests
0 / 16
Hit rate
0%
Address-stream period
16 addresses
t = 0 s

A fully associative LRU cache starts empty and requests address (i·s) mod 16. Hits move an address to the newest position; misses evict the oldest when full. Playback starts with 16 requests and adds two per second, capped at 4096 explicitly simulated requests. This toy stream is not a processor-cache benchmark. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.

Look forApplication access coverage and deliberate stored-data integrity coverage are different evidence.

Check your understanding

A stored fragment fails its checksum. What follows immediately from that observation?

Try it yourself

Estimate the ideal time to read 2 TiB at a sustained 128 MiB/s, then explain why a successful application read rate cannot prove that every cold object has been checked.

Take a moment to make a prediction or work it out on paper. Open a hint when you need one.

Give me a hint

Convert TiB to MiB before dividing. Application reads cover their chosen objects, not necessarily the full stored population.

Compare with the solution

Two TiB is 2,097,152 MiB; dividing by 128 MiB/s gives 16,384 seconds, or 4 hours, 33 minutes, and 4 seconds. This remains a transfer-only ideal under the stated budget. High successful application-read volume may repeatedly touch a small hot set while leaving cold objects unvisited. Completed scrub coverage and the age of each relevant check provide different evidence.

Take it with you

  • Checksum meaning depends on algorithm, byte representation, version, and reference trust.
  • Scrubbing covers stored data that normal client reads can leave untouched.
  • Detection, authoritative repair selection, and verified restored redundancy are separate stages.

Read further

Original sources and deeper explanations to follow at your own pace.

Optional progress, saved in this browser when available. Revisit any lesson at any time.

Lesson not marked complete.