-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Codegen does not convert [Unordered] interface attribute into method metadata InvokeMethodOptions.Unordered + Proposed Fix #9149
Comments
I have a branch fixing most of this, but I think it would be better to deprecate EDIT: Could you elaborate on your original use case, @MarkNickeson? I want to understand the ask better |
Thanks, Reuben! I appreciate your feedback and fully understand the Occam's razor approach. Below is a first cut at describing the use case: Use case
Reasoning
Alternatives considered and why deemed undesirable
|
Thanks for the context! We could make this work for stateless workers specifically and mark the attribute as obsolete. How does that sound to you? |
Sounds good to me! I am curious how it will be achieved without an attribute or marker interface given that [StatelessWorker] is an implementation aspect. But I'm here to learn and look forward to eventually it trying out and putting it to work! Thanks again! |
The gist of it is this:
public GrainReferenceShared(
GrainType grainType,
GrainInterfaceType grainInterfaceType,
ushort interfaceVersion,
IGrainReferenceRuntime runtime,
InvokeMethodOptions invokeMethodOptions,
CodecProvider codecProvider,
CopyContextPool copyContextPool,
IServiceProvider serviceProvider)
{
this.GrainType = grainType;
this.InterfaceType = grainInterfaceType;
this.Runtime = runtime;
this.InvokeMethodOptions = invokeMethodOptions;
this.CodecProvider = codecProvider;
this.CopyContextPool = copyContextPool;
this.ServiceProvider = serviceProvider;
this.InterfaceVersion = interfaceVersion;
}
|
In principle, [Unordered] is applied to grain interfaces to instruct gateway connection selection to be round-robin instead of hashed to GrainId. However, the test "TestWithConstantId_ExpectTwo" depicted in this gist demonstrates that round-robin behavior does not occur. Debugging into source, the key finding is that metadata for methods within interfaces decorated with [Unordered] indicates InvokeMethodOptions.None rather than including the required InvokeMethodOptions.Unordered.
A potential solution would require revision to InvokableMethodDescription.cs. However, this is potentially risky given that other important Orleans capabilities such as reminders make use of [Unordered] - the potential for unintended consequences seems high.
To fix the problem, pseudo-code similar to below must be added to the ctor in InvokableMethodDescription.cs:
if containingInterface is decorated with UnorderedAttribute
{
CustomInitializerMethods.Add(("AddInvokeMethodOptions",InvokeMethodOptions.Unordered))
}
The text was updated successfully, but these errors were encountered: