Yesterday's records are pushed through the same job again this morning, and a whole day of history lands in one hour's bucket. Which moment was it grouping by, and which would have been immune?
answer
- the same records, a different day
- carried value versus generated value
- one clock is read fresh each pass
- history collapses into the re-run hour
- receipt survives only if re-read
basics
~20 sIt was grouping by the wall clock of the worker that handled each record, which is read fresh on every pass, so the second pass re-dates everything to now. The moment stamped in the payload is immune because it travels inside the record.
solid answer
~50 sThe wall clock of the handling worker is not stored in the record — it is generated when the record is handled. Process the same records again and every one of them gets a new value, so a day of history collapses into the hour of the second pass. The moment stamped in the payload is immune: it was written by the producer before transmission and is identical on every pass, so the same records reproduce the same buckets. Receipt time is the interesting middle case — if the second pass re-reads the stored records, the original stamp is still on them and the buckets hold; if the records are fed through the receiving system again, they are stamped afresh and it re-dates just like the worker's clock. This is the cheapest test of which moment a pipeline chose, and the strongest argument for choosing the payload one.
go deeper
Remember that the worker's clock is read at handling time, so running the same records again gives them all new times. The moment stamped in the payload does not change.
Explain the split between a carried moment and a generated one, and be able to say what happens to the receipt stamp depending on whether the second pass re-reads stored records or pushes them through the receiving system again.
Treat repeatability as the requirement: describe the two-way damage to the old day and the new hour, and use a double run of the same input as a diagnostic on an inherited pipeline.
Make it a standard every pipeline must meet before anyone publishes from it — the same input must produce the same buckets whenever it is run — because reprocessing is routine and discovering this during an incident is expensive.
## Carried moments and generated moments The cleanest way to separate the three candidate moments is to ask a single question: **is this value inside the record, or is it produced at the instant the record is handled?** - The moment stamped in the payload — *occurrence time*, what the producer recorded as when the thing happened — is **carried**. It was written before transmission and is part of the bytes. - The moment the receiving system wrote the record down — *receipt time* — is **carried once the record is stored**, because the stamp was applied on acceptance and travels with the record from then on. - The wall clock of the worker that reached the record — the term of art is *processing time* — is **generated**. It exists only at handling. There is no such field anywhere; there is only a clock being read. A second pass over the same records is precisely the experiment that separates them. | grouping moment | second pass over the stored records | records fed through the receiving system again | |---|---|---| | payload stamp | identical buckets | identical buckets | | receipt stamp | identical buckets — the original stamp is still on the record | re-dated — a new stamp is applied | | worker's wall clock | re-dated into the hour of the second pass | re-dated into the hour of the second pass | So the absolute statement holds for exactly one row: the worker's clock never survives a second pass. The payload stamp always does. Receipt sits between them and depends on how the second pass is fed, which is why it is worth knowing how your own re-run is wired before relying on it. ## What the collapse actually looks like The damage is not subtle once you know to look for it, and it is completely silent until then: 1. A day that already had its counts now has approximately zero, because those records were re-dated out of it. 2. One hour of the current day holds a day's worth of volume, producing a spike that looks like a traffic event or an attack. 3. Any aggregate built on top — a rolling average, an anomaly threshold, a figure someone already reported — is now wrong in two places for one cause. 4. Nothing reports an error. Every record was processed successfully; they were simply filed under the wrong moment. Whether the old numbers are *replaced* or *duplicated* depends on how the destination handles a re-written result, which is a separate matter. The re-dating happens regardless. ## Why this is the decisive argument for the payload moment Every other argument for grouping by the payload moment is about accuracy at the margins: records near a day boundary, a source that buffers. This one is about whether the pipeline is **repeatable at all**. A pipeline that produces a different answer from the same input depending on when you ran it is not a computation over data; it is a computation over data and the calendar. Reprocessing is a completely ordinary operation — a code fix, a widened output, a destination rebuilt — and a pipeline that cannot survive it has an operational ceiling that will be discovered at the worst possible moment. ## What varies, and what does not The mechanism is the same everywhere, but the surroundings differ: - On an engine that runs continuous work as a rapid succession of small finite jobs, the worker's clock moves in steps at job boundaries rather than smoothly; the re-dating is identical, just chunkier. - On a record-at-a-time engine the clock is read per record, so a long second pass smears the history across however long the pass takes rather than into a single instant. - On an engine that only ever processes a finished bounded input, there is no running notion of now at all, and a grouping that depends on the run's clock re-dates the entire input to the run — the effect is at its most total precisely where people assume time is not involved. In all three the fix is the same and it is not a setting: nominate the moment stamped in the payload, and where no such stamp exists, nominate the receipt stamp and make sure the re-run re-reads stored records rather than pushing them back through the system that applies it. ## Using it as a test Because the behaviour is categorical, it doubles as a two-minute diagnostic on any pipeline you have inherited: run the same recorded input twice, some hours apart, into a scratch destination and compare the bucket boundaries. Identical means the grouping is on a carried moment. Shifted means it is on a generated one, and every historical number that pipeline produced was a statement about when the job ran.
- Does grouping by the payload moment make a re-run completely safe?It makes the buckets repeatable, which is a different thing from safe. The results still have to reach the destination in a way that overwrites the previous answer rather than adding to it, and a re-run of old history will be far behind the job's running claim about what is still expected, so anything that discards old records on that basis needs to be accounted for.
- The pipeline groups by a running claim that nothing older than a given timestamp is still expected — a watermark. Does a re-run change that?The claim is derived from the moments the job sees, so it inherits whichever one was nominated. Grouped by the payload moment, a re-run of old history drives the claim back through the same timestamps it saw before. Grouped by the worker's clock, the claim simply tracks now and asserts nothing useful about the history being replayed.
- A source genuinely has no usable moment in its payload. What is the best you can do?Nominate the receipt stamp and treat it as the record's moment everywhere, then make sure any re-run re-reads the stored records instead of pushing them back through the system that applies the stamp. Document that the figures describe when records were received, so nobody reads them as a statement about when things happened.
The date written at the top of a letter, the postmark on its envelope, and the day you happened to open it. Put the letter back in the pile and open it again next week and only the third changes — unless you post the envelope again, in which case the postmark changes too. The date in the letter never does.
saying these in an interview costs you the question
- Says a re-run is safe because the records themselves did not change
- Claims the payload moment is the only one that ever survives a second pass
- Blames the spike on duplicate delivery rather than on the moment being regenerated
- Expects an error or a warning when history is re-dated
- Thinks choosing the right moment is only about accuracy near a day boundary