-
Notifications
You must be signed in to change notification settings - Fork 276
Add CustomStatus Size Check for OOP model #3113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/WebJobs.Extensions.DurableTask/ContextImplementations/RemoteOrchestratorContext.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Extensions.DurableTask/ContextImplementations/RemoteOrchestratorContext.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Extensions.DurableTask/ContextImplementations/RemoteOrchestratorContext.cs
Outdated
Show resolved
Hide resolved
src/WebJobs.Extensions.DurableTask/ContextImplementations/RemoteOrchestratorContext.cs
Outdated
Show resolved
Hide resolved
// Azure Table Storage enforces a 32 KB limit if a property value is a UTF-16 encoded string. | ||
// We apply a 16 KB limit here to align with our in-process model. | ||
const int MaxCustomStatusSizeInKB = 16; | ||
double customStatusSizeInKB = customStatus != null ? Encoding.Unicode.GetByteCount(customStatus) / 1024.0 : 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a big deal, but do we really need floating-point computation here? Consider defining the constant as 16*1024
and just comparing it with the GetByteCount
result. This may be more performant (though the impact is probably negligible) but, more importantly, this will eliminate some mental overhead for the reader of this code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the review, Anatoli! This was changed like this because of this comment .
Resolves #2918
Azure Storage has limit on Table Property, which is 64KB. For string value and UTF16 encoded, it should be 32 KB or less. Larger value will cause error.
This PR adds a
CustomStatus
size check, so that when it's too large, fail the orchestration instead. The limit size is 16KB with UTF16 encoded to align with in-process model.Pull request checklist
pending_docs.md
release_notes.md
/src/Worker.Extensions.DurableTask/AssemblyInfo.cs
dev
andmain
branches and will not be merged into thev2.x
branch.