advanced24 min studyLesson 338 in Engineering

Reconcile identities and values at a defined cutoff

Compare source and derived data using authoritative fields, stable keys, aligned snapshots, and explicit late-data handling.

On this page

What you’ll understand

  • Define authority per field or entity instead of assuming one universal newest copy.
  • Find missing, extra, duplicate, and mismatched records at aligned cutoffs.
  • Distinguish a progress estimate from a proof that all relevant source events were applied.

Two systems report ten thousand training examples, yet a hundred expected identities are missing and a hundred unwanted identities replace them. Count equality did not establish agreement. Reconciliation compares the right identities and values at the same logical boundary, according to a defined authority rule. It must also handle corrections, duplicates, and late input without declaring every temporary lag a defect or every recent timestamp the truth.

Specify authority and stable identity

A source of truth is authoritative for a particular fact under a contract, not necessarily for every field in every representation. A collection system might own the original event while a reviewed labeling system owns its corrected class. A feature pipeline derives values from both using a versioned transformation. Define stable keys, merge rules, tombstones, and field ownership before attempting repair. Picking whichever record has the latest wall timestamp can select a stale or incorrectly clocked update, and a larger sequence number is meaningful only within the sequence's defined scope and incarnation.

Compare equivalent populations. Pin source and target snapshots, source log positions, transformation version, and the policy cutoff used for membership. A stream target may legitimately lag the source, while an intentionally filtered training set should not contain every source key. Build the expected target set by applying the specified rules to the authoritative source state, then compare with the actual target. Reconcile corrections and deletions as well as additions. Otherwise a pipeline that ingests all new records but never removes withdrawn ones can appear healthy on an append-only count dashboard.

M=S∖T,E=T∖SM=S\setminus T,\qquad E=T\setminus S
S is the expected target-key set derived from an authoritative snapshot and policy cutoff; T is the actual target-key set at the corresponding boundary. M and E identify missing and extra keys, not all value mismatches or duplicate rows.↔ Scroll wide equations horizontally.

Align cutoffs and compare more than totals

A watermark often expresses an estimate or contract about event-time progress, not an unconditional certificate that no older event can arrive. Its meaning depends on the source and late-data policy. A maximum observed sequence can also hide gaps: seeing 100 does not prove that 99 was applied. For partitioned logs, retain the relevant contiguous position per partition and account for transactional or cross-stream relationships. If the available evidence cannot establish a common completed boundary, label the comparison provisional and specify when late data or a later snapshot will trigger another pass.

After aligning keys, compare the values covered by the transformation contract, including null semantics, units, label versions, and normalized representations. Equal sums can hide offsetting errors; equal row counts can hide replacements; equal digest summaries depend on their scope and collision assumptions. Partition-level checksums can narrow an investigation but should lead to appropriate record-level verification for the claim being made. Track duplicates separately before converting rows into key sets, because a set comparison silently removes multiplicity that can change training weights. State whether ordering matters for the downstream consumer.

Nrepair candidates=∣M∣+∣E∣+∣V∣N_{\mathrm{repair\ candidates}}=|M|+|E|+|V|
V is the set of shared keys with a compared-value mismatch at the same cutoff. M, E, and V are disjoint categories here; duplicates or unverified keys require additional accounting rather than being hidden in this count.↔ Scroll wide equations horizontally.

Repair from evidence without repeating the defect

A repair should be reproducible, scoped, and idempotent: insert the missing expected version, remove an extra version under the policy, or recompute a mismatched value from pinned authoritative inputs. Record the repair run and verify the result at a new clearly defined boundary. Replaying an old source without the current required suppression or correction rules can restore the very data the reconciliation was meant to remove. Preserve evidence of what differed before overwriting it, and test that normal ingestion will not immediately reproduce the same mismatch after the repair finishes.

The probability lab shows the limits of a small spot audit. Reset, set both p=0.01 and n=30, predict the zero-defect bar, then inspect. Under independent equal-probability selection, it is 0.99 raised to the thirtieth, about 74%. The instrument does not reconcile keys, compare values, or model finite-population sampling without replacement. It explains why seeing no defect in a small convenience check cannot establish equality of two large sets. Use aligned full comparisons or a justified sampling design matched to the required confidence and defect scope.

Equal counts can conceal replacements and wrong values

At a verified common cutoff, expected set S and actual set T each contain 10, 000 unique keys. Their intersection has 9900 keys. Within the shared keys, 50 have incorrect compared feature values. Assume no duplicates and the expected transformation is defined.

  1. Each set has 100 keys absent from the other:100 expected keys are missing and 100 actual keys are extra, even though the two total counts match.

  2. Of the 9900 shared keys, 50 have value mismatches, leaving 9850 with matching compared values. Value comparison is a separate check from key membership.

  3. The disjoint repair categories contain 100+100+50=250 candidate keys. Repair them according to the pinned source and transformation, then verify a new aligned boundary rather than only checking that total count remains 10, 000.

The result

Count equality concealed 250 distinct reconciliation candidates: missing keys, extra keys, and mismatched shared values.

Explore the model

Interactive lab

Interactive lab · probability

A clean spot check is weak evidence of equality

Reset, set both p=0.01 and n=30, predict the zero-defect probability, then inspect the exact binomial bar. It is approximately 0.7397 under independent equal-probability draws. This is not a set reconciliation engine or a without-replacement finite-population model.

A clean spot check is weak evidence of equalityThese are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Current readings: Mean · np: 5; Variance · np(1−p): 2.5; Total probability: 1. All parameters are adjustable with the labeled controls below.03581000.070.150.220.3Successes kP(X = k)k = 0 · P = 9.77e-4
Exact probabilityHighlighted outcomeMean np
Mean · np
5
Variance · np(1−p)
2.5
Total probability
1
t = 0 s

These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. 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 forNo defect in a small audit does not establish identical membership or values. The authoritative comparison needs aligned source and target boundaries and explicit transformation rules.

Check your understanding

A stream target has observed source sequence 100, but position 99 has not been verified. What can an engineer safely conclude?

Try it yourself

Expected keys number 500 and actual unique keys number 495. Their intersection has 490 keys, of which eight have wrong compared values. Compute missing, extra, and total candidate counts.

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

Give me a hint

Compare each total with the shared intersection; value mismatches belong to shared keys.

Compare with the solution

There are 500−490=10 missing keys and 495−490=5 extra keys. Adding eight disjoint shared-key mismatches gives 23 candidates. These counts assume aligned snapshots and do not include any duplicate-row problem hidden by the unique-key sets.

Take it with you

  • Authority belongs to a fact and versioned contract, not simply the newest-looking record.
  • Reconciliation needs aligned cutoffs, key identity, multiplicity, and value semantics.
  • Repairs should preserve policy, provenance, idempotency, and verification evidence.

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.