Skip to content

Remove locking while computing our metadata indices for FAR and Add-Using#51747

Merged
5 commits merged intodotnet:mainfrom
CyrusNajmabadi:metadataLockign
Mar 19, 2021
Merged

Remove locking while computing our metadata indices for FAR and Add-Using#51747
5 commits merged intodotnet:mainfrom
CyrusNajmabadi:metadataLockign

Conversation

@CyrusNajmabadi
Copy link
Contributor

@CyrusNajmabadi CyrusNajmabadi commented Mar 8, 2021

Fixes AB#1288263

@CyrusNajmabadi CyrusNajmabadi requested a review from sharwell March 8, 2021 20:50
@CyrusNajmabadi CyrusNajmabadi requested a review from a team as a code owner March 8, 2021 20:50
@ghost ghost added the Area-IDE label Mar 8, 2021
// AsyncLazy would normally be an ok choice here. However, in the case where all clients
// cancel their request, we don't want ot keep the AsyncLazy around. It may capture a lot
// of immutable state (like a Solution) that we don't want kept around indefinitely. So we
// only cache results (the symbol tree infos) if they successfully compute to completion.
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this comment is very relevant. we switched off of AsyncLazy because we woudl have AsyncLazys holding onto SOlution instances. However, in the new code, we do not hold onto solution instances. Instead, we hold onto a Workspace+SolutionKey. This is possible as the SOlution was only used to acquire an IPersistentStorage instance associated with that solution. But we don't need a full Solution object for that anymore with the current IPersistentStorage apis.

Note: if holding onto a workspace here is problematic, we could always key this first off of Workspace.

createAsync: () => CreateSourceSymbolTreeInfoAsync(project, checksum, cancellationToken),
keySuffix: "_Source_" + project.FilePath,
tryReadObject: reader => TryReadSymbolTreeInfo(reader, checksum, nodes => GetSpellCheckerAsync(project.Solution, checksum, project.FilePath, nodes)),
tryReadObject: reader => TryReadSymbolTreeInfo(reader, checksum, nodes => GetSpellCheckerAsync(workspace, solutionKey, checksum, project.FilePath, nodes)),
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ This is going to capture Solution via project. If that is not desired, read project.FilePath to a local variable before this call.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that's a good idea. it's not hugely important here (the task is kicked off immediately. but it's still good for hygeiene.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Auto-approval

@ghost ghost merged commit 230fa87 into dotnet:main Mar 19, 2021
@ghost ghost added this to the Next milestone Mar 19, 2021
@allisonchou allisonchou modified the milestones: Next, 16.10.P2 Mar 29, 2021
@CyrusNajmabadi CyrusNajmabadi deleted the metadataLockign branch April 11, 2021 18:20
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants