fix: report accurate progress statistics on export batch failure#326
Open
YunchuWang wants to merge 1 commit into
Open
fix: report accurate progress statistics on export batch failure#326YunchuWang wants to merge 1 commit into
YunchuWang wants to merge 1 commit into
Conversation
… batch failure When a batch of export activities fails after exhausting all retry attempts, the orchestrator commits a checkpoint with scannedInstances=0 and exportedInstances=0. This discards the actual work done: the number of instances that were scanned and the number that were successfully exported before the batch was marked as failed. The entity accumulates these counters via addition, so reporting 0 means the job's progress statistics undercount the real work, giving operators inaccurate progress data. Fix: Use the actual scannedCount and batchResult.exportedCount values in the failure-path checkpoint, matching the success-path behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
| instanceIds: ["inst-1", "inst-2", "inst-3", "inst-4", "inst-5"], | ||
| nextCheckpoint: { lastInstanceKey: "inst-5" }, | ||
| }; | ||
| stepResult = await gen.next(pageResult); |
| } | ||
|
|
||
| // Resume the generator (receives the array of results from whenAll) | ||
| stepResult = await gen.next(attempt1Results); |
| const timerCalls = getCallsByType(ctx._calls, "createTimer"); | ||
| expect(timerCalls.length).toBeGreaterThanOrEqual(1); | ||
| timerCalls[timerCalls.length - 1].task!.complete(undefined); | ||
| stepResult = await gen.next(undefined); |
| for (let i = 0; i < newExportCalls2.length; i++) { | ||
| newExportCalls2[i].task!.complete(attempt2Results[i]); | ||
| } | ||
| stepResult = await gen.next(attempt2Results); |
| // Step 7: Backoff timer for retry attempt 3 | ||
| const timerCalls2 = getCallsByType(ctx._calls, "createTimer"); | ||
| timerCalls2[timerCalls2.length - 1].task!.complete(undefined); | ||
| stepResult = await gen.next(undefined); |
| for (let i = 0; i < newExportCalls3.length; i++) { | ||
| newExportCalls3[i].task!.complete(attempt3Results[i]); | ||
| } | ||
| stepResult = await gen.next(attempt3Results); |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes progress reporting for the export job orchestrator in @microsoft/durabletask-js-export-history so that, when an export batch ultimately fails after retries, the checkpoint records the actual scanned/exported counts instead of hardcoded zeros (addressing Issue #213).
Changes:
- Update failure-path checkpoint commits to use
scannedCountandbatchResult.exportedCount. - Add orchestrator-level Jest coverage to validate progress statistics in success and failure scenarios (including partial success before final failure).
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| packages/durabletask-js-export-history/src/orchestrators/export-job-orchestrator.ts | Fixes failure-path checkpoint to persist accurate scanned/exported progress counts. |
| packages/durabletask-js-export-history/test/export-job-orchestrator.spec.ts | Adds tests that assert correct checkpoint progress reporting for batch success and batch failure after retries. |
Comment on lines
+18
to
+20
| import { EntityInstanceId } from "@microsoft/durabletask-js"; | ||
| import { CompletableTask } from "../../durabletask-js/src/task/completable-task"; | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #213.
The export job orchestrator reported zero progress statistics when a batch failed. This ensures accurate progress counts are reported on batch failure.
Opens the existing fix branch
copilot-finds/bug/fix-batch-failure-progress-statsas a PR (automated triage of active [copilot-finds] issues that had a ready fix branch but no open PR).