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

ITrace: Fixes concurrency of cache. #2314

Merged
merged 3 commits into from
Mar 18, 2021

Conversation

bchong95
Copy link
Contributor

@bchong95 bchong95 commented Mar 16, 2021

ITrace: Fixes concurrency of cache.

Description

Makes the cache concurrent.

using System.IO;
using System.Linq;
using System.Text;
using Microsoft.Azure.Cosmos.Json;

internal static partial class TraceWriter
{
private static readonly Dictionary<string, string> FilePathToName = new Dictionary<string, string>();
private static readonly ConcurrentDictionary<string, string> FilePathToName = new ConcurrentDictionary<string, string>();
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add tests.

Copy link
Member

Choose a reason for hiding this comment

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

Let's avoid regressing this, please add a test using concurrent tasks.

Copy link
Member

Choose a reason for hiding this comment

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

A test would also discover any other thread-unsafe operations that could be happening.

Copy link
Contributor

@sboshra sboshra left a comment

Choose a reason for hiding this comment

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

:shipit:

@sboshra sboshra merged commit 3e64a98 into master Mar 18, 2021
@sboshra sboshra deleted the users/brchon/ITrace/ConcurrentDictionaryCache branch March 18, 2021 16:41
ealsur pushed a commit that referenced this pull request Mar 18, 2021
Co-authored-by: Samer Boshra <sboshra@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants