-
Notifications
You must be signed in to change notification settings - Fork 300
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
Get instance id for desired control-queue(s) #1069
base: main
Are you sure you want to change the base?
Get instance id for desired control-queue(s) #1069
Conversation
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.
Some thoughts
src/DurableTask.AzureStorage/AzureStorageOrchestrationServiceSettings.cs
Outdated
Show resolved
Hide resolved
…ettings.cs Co-authored-by: David Justo <[email protected]>
controlQueueNumberToNameMap = new Dictionary<string, int>(); | ||
|
||
for (int i = 0; i < partitionCount; i++) | ||
{ | ||
var controlQueueName = AzureStorageOrchestrationService.GetControlQueueName(settings.TaskHubName, i); | ||
controlQueueNumberToNameMap[controlQueueName] = i; | ||
} | ||
} |
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.
are we still using this in the new tests? No, right?
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.
Have we tested this for external events as well?
…https://github.com/pasaini-microsoft/durabletask into users/pasaini/main/InstanceIdForSelectedControlQueue
/// <summary> | ||
/// Whether to allow instanceIDs to use special syntax to land on a specific partition. | ||
/// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | ||
/// </summary> | ||
public bool EnableExplicitPartitionPlacement { get; set; } = false; |
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.
Something to consider - it is not safe to change this from false
to true
(or vice-versa) while an orchestrator with the special syntax is in-flight. If we do that, any pre-existing messages for that orchestrator may now be considered to be "in the wrong queue".
Let's call this out in the intellisense
|
||
int placementSeparatorPosition = instanceId.LastIndexOf('!'); | ||
|
||
// if the instance id ends with !nnn, where nnn is an unsigned number, it indicates explicit partition placement |
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.
can we add a test that documents the behavior if the customer uses an instanceID with multiple !
in there? Say instanceID "A!1!B!3` should probably map to partition "3", right?
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.
Let's also add a test that checks that instanceID myinstanceID!NotANumber
does not trigger any errors / that it correctly ignores the explicit placement logic.
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.
Thank you for adding the first test, I think we're just missing the very last one:
Let's also add a test that checks that instanceID myinstanceID!NotANumber does not trigger any errors / that it correctly ignores the explicit placement logic.
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.
This looks almost ready to me, but please note there's some outstanding suggestions (and a missing test request from my last review).
FYI @gillum, whose approval we should seek before merging this.
|
||
int placementSeparatorPosition = instanceId.LastIndexOf('!'); | ||
|
||
// if the instance id ends with !nnn, where nnn is an unsigned number, it indicates explicit partition placement |
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.
Thank you for adding the first test, I think we're just missing the very last one:
Let's also add a test that checks that instanceID myinstanceID!NotANumber does not trigger any errors / that it correctly ignores the explicit placement logic.
/// <summary> | ||
/// Whether to allow instanceIDs to use special syntax to land on a specific partition. | ||
/// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | ||
/// ** DO NOT CHANGE THIS FLAG FOR PRE-EXISTING MESSAGES AS IT MAY BE CONSIDERED IN THE WRONG QUEUE ** | ||
/// </summary> |
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.
nit - I believe remark
is the right docs tag for this sort of thing. Let's also not use all-caps for comments, I realize it has a useful effect, but it's not in our usual style for customer-facing docs.
/// <summary> | |
/// Whether to allow instanceIDs to use special syntax to land on a specific partition. | |
/// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | |
/// ** DO NOT CHANGE THIS FLAG FOR PRE-EXISTING MESSAGES AS IT MAY BE CONSIDERED IN THE WRONG QUEUE ** | |
/// </summary> | |
/// <summary> | |
/// Whether to allow instanceIDs to use special syntax to land on a specific partition. | |
/// If enabled, when an instanceID ends with suffix '!nnn', where 'nnn' is an unsigned number, the instance will land on the partition/queue for to that number. | |
/// ** DO NOT CHANGE THIS FLAG FOR PRE-EXISTING MESSAGES AS IT MAY BE CONSIDERED IN THE WRONG QUEUE ** | |
/// </summary> | |
/// <remarks> | |
/// It is not generally safe to change to this flag for pre-existing TaskHubs, as it may change the expected target queue for an instanceID. | |
/// </remarks> |
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.
FYI - I'll take the liberty of deleting the deleting the comment about adding a test at the beginning of TaskHubClient
, since this is public documentation so it does not belong there. After that, I'll leave a 'LGTM'
@@ -707,6 +707,7 @@ void CreateAndTrackDependencyTelemetry(TraceContextBase requestTraceContext) | |||
} | |||
|
|||
/// <summary> | |||
/// Add test for this. |
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.
/// Add test for this. |
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.
Motivation
#1079
Issue: No way of targeting an orchestrator instance to a desired control-queue.
Motivation:
Issue: No way to load lightly loaded control-queues.
Motivation:
Proposal
API to generate instance id for a set of control-queues.