-
Notifications
You must be signed in to change notification settings - Fork 496
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
CrossRegionHedging: Fixes NullReference Exception Bug #4869
base: master
Are you sure you want to change the base?
CrossRegionHedging: Fixes NullReference Exception Bug #4869
Conversation
...soft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs
Outdated
Show resolved
Hide resolved
...soft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs
Outdated
Show resolved
Hide resolved
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.
One minor comment. Otherwise, LGTM.
...soft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs
Outdated
Show resolved
Hide resolved
...t.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs
Outdated
Show resolved
Hide resolved
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.
A few nits other than that LGTM. Good work, thanks!
@@ -143,7 +143,7 @@ internal override async Task<ResponseMessage> ExecuteAvailabilityStrategyAsync( | |||
request, | |||
hedgeRegions.ElementAt(requestNumber), | |||
cancellationToken, | |||
cancellationTokenSource); | |||
cancellationTokenSource, trace); |
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.
@NaluTripician curious who is the consumer for below snipper (its unrelated to this PR)
if (completedTask.IsFaulted)
{
AggregateException innerExceptions = completedTask.Exception.Flatten();
}
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.
If I recall correctly from when we added this, it is needed for if there is an exception that needs to be thrown to the customer
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.
Its only getting the exception and not using it.
Below await does throw in-case of exceptions?
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.
@NaluTripician can you please follow-up on this?
And resolve this comment.
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.
Yes, we throw if there was an exception and there are no more regions to hedge to
...t.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.EmulatorTests/CosmosAvailabilityStrategyTests.cs
Outdated
Show resolved
Hide resolved
We are changing the behavior here, previously if operation was cancelled due to cancellation token, it used to return a valid |
...soft.Azure.Cosmos/src/Routing/AvailabilityStrategy/CrossRegionHedgingAvailabilityStrategy.cs
Show resolved
Hide resolved
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.
LGTM - thanks!
@dibahlfi please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
Pull Request Template
Description
This change is to fix CosmosNullReferenceException that happens when a client passes a CancellationToken along with the request. Please see(#4737) for more information.
Type of change
Please delete options that are not relevant.
Closing issues
To automatically close an issue: closes #4737