Skip to content
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

CosmosDiagnostics: Fixes IndexOutOfRangeException #2099

Merged
merged 3 commits into from
Jan 4, 2021

Conversation

j82w
Copy link
Contributor

@j82w j82w commented Dec 29, 2020

Pull Request Template

Description

To avoid any IndexOutOfRangeException the CosmosDiagnostics is refactored to remove the AddRange call. This will avoid any indexing issues caused by the possibility of the CosmosDiagnosticsContext getting modified in another task at the same time it is getting append to a parent CosmosDiagnosticContext.

This should also help improve performance by reducing the number of copies required when combining multiple CosmosDiangosticsContext.

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)
  • [] New feature (non-breaking change which adds functionality)
  • [] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [] This change requires a documentation update

Closing issues

To automatically close an issue: closes #2075

@j82w j82w added bug Something isn't working Diagnostics Issues around diagnostics and troubleshooting labels Dec 29, 2020
@j82w j82w self-assigned this Dec 29, 2020
ealsur
ealsur previously approved these changes Dec 29, 2020
@@ -40,6 +40,7 @@ public async Task TestInitialize()
this.containerSettings = new ContainerProperties(id: Guid.NewGuid().ToString(), partitionKeyPath: PartitionKey);
ContainerResponse response = await this.database.CreateContainerAsync(
this.containerSettings,
throughput: 20000,
Copy link
Member

Choose a reason for hiding this comment

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

Does this change make any difference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It makes it where there is multiple logical partitions which should cause the race condition to be exposed during our testing runs.

Copy link
Member

Choose a reason for hiding this comment

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

Will it impact the test durations?

Copy link
Contributor Author

@j82w j82w Jan 4, 2021

Choose a reason for hiding this comment

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

There was no noticeable difference when testing locally or in gates. It still drains the same number of items. Worst case is for some queries it might result in a extra read operation.

@j82w j82w merged commit 13cd277 into master Jan 4, 2021
@j82w j82w deleted the users/jawilley/diagnostics/fix_count branch January 4, 2021 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Diagnostics Issues around diagnostics and troubleshooting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CosmosDiagnostics throws IndexOutOfRangeException
3 participants