Throw DataCorruptionError for meaningful duplicate batch detections#27668
Throw DataCorruptionError for meaningful duplicate batch detections#27668dannimad wants to merge 2 commits into
Conversation
Updates the Duplicate Batch Detection tests to match the new behavior: processing a duplicate batch now throws a DataCorruptionError when either the incoming or previously-recorded batch has an explicit batchId, instead of always being log-only. Adds a new test covering the still-log-only case where neither batch has an explicit batchId (the known service-outage scenario). Also adds a changeset. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
|
||
| Previously, all detected duplicate batches were only logged via the `DuplicateBatch` telemetry event, and the corresponding `DataCorruptionError` was never thrown. This was a temporary mitigation for a service-side bug that could redeliver batches. | ||
|
|
||
| Now, the error is thrown when either the incoming batch or the previously-seen batch has an explicit `batchId` (i.e. the batch was resubmitted, as opposed to a fresh batch whose `batchId` is derived from `clientId` and `batchStartCsn`). This distinguishes genuine duplicate-batch scenarios (e.g. container forking) from the known service-outage artifact, which only ever produces duplicates without explicit batch ids. Duplicates without an explicit `batchId` on either side continue to be log-only. |
There was a problem hiding this comment.
📝 [vale] reported by reviewdog 🐶
[Microsoft.SentenceLength] Try to keep sentences short (< 30 words).
|
|
||
| Previously, all detected duplicate batches were only logged via the `DuplicateBatch` telemetry event, and the corresponding `DataCorruptionError` was never thrown. This was a temporary mitigation for a service-side bug that could redeliver batches. | ||
|
|
||
| Now, the error is thrown when either the incoming batch or the previously-seen batch has an explicit `batchId` (i.e. the batch was resubmitted, as opposed to a fresh batch whose `batchId` is derived from `clientId` and `batchStartCsn`). This distinguishes genuine duplicate-batch scenarios (e.g. container forking) from the known service-outage artifact, which only ever produces duplicates without explicit batch ids. Duplicates without an explicit `batchId` on either side continue to be log-only. |
There was a problem hiding this comment.
[Microsoft.Hyphens] 'previously-seen' doesn't need a hyphen.
|
|
||
| Previously, all detected duplicate batches were only logged via the `DuplicateBatch` telemetry event, and the corresponding `DataCorruptionError` was never thrown. This was a temporary mitigation for a service-side bug that could redeliver batches. | ||
|
|
||
| Now, the error is thrown when either the incoming batch or the previously-seen batch has an explicit `batchId` (i.e. the batch was resubmitted, as opposed to a fresh batch whose `batchId` is derived from `clientId` and `batchStartCsn`). This distinguishes genuine duplicate-batch scenarios (e.g. container forking) from the known service-outage artifact, which only ever produces duplicates without explicit batch ids. Duplicates without an explicit `batchId` on either side continue to be log-only. |
There was a problem hiding this comment.
🚫 [vale] reported by reviewdog 🐶
[Microsoft.Foreign] Use 'that is' instead of 'i.e. '.
|
|
||
| Previously, all detected duplicate batches were only logged via the `DuplicateBatch` telemetry event, and the corresponding `DataCorruptionError` was never thrown. This was a temporary mitigation for a service-side bug that could redeliver batches. | ||
|
|
||
| Now, the error is thrown when either the incoming batch or the previously-seen batch has an explicit `batchId` (i.e. the batch was resubmitted, as opposed to a fresh batch whose `batchId` is derived from `clientId` and `batchStartCsn`). This distinguishes genuine duplicate-batch scenarios (e.g. container forking) from the known service-outage artifact, which only ever produces duplicates without explicit batch ids. Duplicates without an explicit `batchId` on either side continue to be log-only. |
There was a problem hiding this comment.
🚫 [vale] reported by reviewdog 🐶
[Microsoft.Foreign] Use 'for example' instead of 'e.g. '.
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (125 lines, 3 files), I've queued these reviewers:
How this works
|
Bundle size comparisonBase commit: Notable changesNo bundles changed by ≥ 500 bytes parsed. Per-bundle deltas
|
| ); | ||
|
|
||
| const batchIdExplicit = batchStart.batchId !== undefined; | ||
| const otherBatchIdExplicit = result.otherBatchInfo?.batchIdExplicit ?? false; |
There was a problem hiding this comment.
Consider a comment reminding that otherBatchInfo may not be known (if loaded from a snapshot) and in this corner case we treat it as false to avoid false positives on the error
Description
Previously, duplicate-batch detection only logged a
DuplicateBatchtelemetry event and never threw theDataCorruptionError— this was a temporary mitigation for a live service bug that could redeliver batches.This PR re-enables throwing, but only when either the incoming batch or the previously-recorded batch has an explicit
batchId(i.e., it came from a resubmit viaPendingStateManager.replayPendingStates), which indicates a genuine duplicate-batch scenario (e.g. container forking) rather than the known service-outage artifact. Duplicates where neither batch has an explicitbatchIdcontinue to be log-only.Updated the
Duplicate Batch Detectiontests incontainerRuntime.spec.tsto assert the new throwing behavior where applicable, and added a new test covering the still-log-only case (no explicitbatchIdon either side).Reviewer Guidance
The review process is outlined on this wiki page.