Skip to content

Add migration SAS renewal and drain handling - #1444

Merged
sophiatev merged 4 commits into
mainfrom
stevosyan/storage-migration-sas-renewal
Nov 30, 2026
Merged

sophiatev merged 4 commits into
mainfrom
stevosyan/storage-migration-sas-renewal

Conversation

@sophiatev

Copy link
Copy Markdown
Contributor

Migration hosts need to renew short-lived Storage SAS credentials while migration is active and stop renewing when the control row closes. Add the internal MigrationSasManager from stevosyan/storage-migration: it uses Storage's clock, publishes a 15-second expiry with an ETag-conditional update, reuses delegation keys, and updates cached credential objects. A drain that wins the ETag race prevents renewal.

This PR also adds OrchestrationServiceUnavailableException and updates Azure.Storage.Queues to 12.25.0 for Queue user delegation keys. Production behavior is unchanged from the integration branch. The manager has no runtime caller yet; workload-client wiring and request policies follow separately. No detailed performance telemetry is included.

Validation: 71 tests passed on each of .NET 8 and .NET Framework 4.8 (142 total), including 17 new renewal-manager cases. Coverage includes shared-key and identity credentials, the renewal margin, competing renewals/drain, missing control rows, failed and slow key acquisition, cancellation, and refresh-loop stop/restart. Tests use real SDK pipelines with simulated local Storage responses and do not contact Azure.

Copilot AI balanced review requested due to automatic review settings November 24, 2026 17:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Critical expiry checks can publish already-expired SAS credentials after delayed reads and continue returning them after renewal fails, causing authentication failures instead of the intended unavailability exception.

2 open issues
What changed in this PR

Adds internal SAS renewal and drain handling for Azure Storage migration. The manager has no runtime caller yet; workload-client integration remains separate.

Changes:

  • Adds short-lived SAS renewal using Storage time, conditional control-row updates, cached delegation keys, and in-place credential updates.
  • Introduces an unavailable-service exception and upgrades Azure.Storage.Queues for delegation-key support.
  • Adds simulated Storage tests covering renewal, drain races, failures, cancellation, and refresh-loop lifecycle.
File Description
test/​DurableTask.AzureStorage.Tests/​MigrationSasManagerTests.cs Tests renewal and drain handling using local SDK responses.
src/​DurableTask.AzureStorage/​Storage/​MigrationSasManager.cs Implements credential renewal, caching, and drain detection.
src/​DurableTask.AzureStorage/​OrchestrationServiceUnavailableException.cs Defines the exception for unavailable backend access.
Directory.Packages.props Updates Azure.Storage.Queues to 12.25.0.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 24, 2026 19:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

Capturing the monotonic timestamp after the gate read excludes response latency from the expiry calculation, allowing RefreshAsync to return already-expired SAS credentials.

2 open issues

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 24, 2026 19:36

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

The monotonic timestamp is captured after the storage read, omitting response latency and allowing renewal to return successfully with an already-expired SAS.

2 open issues

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 24, 2026 20:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues block approval of the internal SAS credential renewal and drain-handling changes.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

@sophiatev
sophiatev merged commit f407d96 into main Nov 30, 2026
48 checks passed
@sophiatev
sophiatev deleted the stevosyan/storage-migration-sas-renewal branch November 30, 2026 21:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants