-
Notifications
You must be signed in to change notification settings - Fork 549
Implemented App and DB level concurrency management for Search parameter upates #5097
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
base: main
Are you sure you want to change the base?
Implemented App and DB level concurrency management for Search parameter upates #5097
Conversation
…eter Implemented Datastore level optimistic concurrency for Search Parameter
src/Microsoft.Health.Fhir.Core/Features/Search/Parameters/SearchParameterOperations.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.Core/Features/Search/Parameters/SearchParameterOperations.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.Core/Features/Search/Parameters/SearchParameterOperations.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.Core/Features/Search/Registry/SearchParameterConcurrencyManager.cs
Fixed
Show fixed
Hide fixed
...Microsoft.Health.Fhir.SqlServer/Features/Storage/Registry/SearchParameterStatusCollection.cs
Fixed
Show fixed
Hide fixed
...t.Health.Fhir.SqlServer/Features/Storage/Registry/SqlServerSearchParameterStatusDataStore.cs
Dismissed
Show dismissed
Hide dismissed
...t.Health.Fhir.SqlServer/Features/Storage/Registry/SqlServerSearchParameterStatusDataStore.cs
Fixed
Show fixed
Hide fixed
Fixed issue with release timing of semaphore
...ealth.Fhir.Core.UnitTests/Features/Search/Registry/SearchParameterConcurrencyManagerTests.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.Core/Features/Search/Registry/SearchParameterConcurrencyManager.cs
Fixed
Show fixed
Hide fixed
...Shared.Tests.Integration/Persistence/SearchParameterOptimisticConcurrencyIntegrationTests.cs
Fixed
Show fixed
Hide fixed
Updated integration test error handling
src/Microsoft.Health.Fhir.Core/Features/Search/Registry/SearchParameterConcurrencyManager.cs
Fixed
Show fixed
Hide fixed
src/Microsoft.Health.Fhir.Core/Features/Search/Registry/SearchParameterConcurrencyManager.cs
Fixed
Show fixed
Hide fixed
...Shared.Tests.Integration/Persistence/SearchParameterOptimisticConcurrencyIntegrationTests.cs
Dismissed
Show dismissed
Hide dismissed
src/Microsoft.Health.Fhir.Core/Features/Search/Registry/SearchParameterConcurrencyManager.cs
Dismissed
Show dismissed
Hide dismissed
…e on SearchParam table
/// <summary> | ||
/// Exception thrown when an optimistic concurrency conflict occurs during search parameter updates. | ||
/// </summary> | ||
public class SearchParameterConcurrencyException : Exception |
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.
Is this exception used anywhere? I don't see any references to it in this PR.
var tableValuedParameter = new SqlParameter | ||
{ | ||
ParameterName = "searchParamStatuses", | ||
SqlDbType = SqlDbType.Structured, | ||
Value = collection, | ||
Direction = ParameterDirection.Input, | ||
TypeName = "dbo.SearchParamTableType_2", |
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.
I think this will be the problem with backwards compatibility. The old code will pass in a type that the new stored procedure isn't expecting as an input.
@@ -353,11 +354,6 @@ object IServiceProvider.GetService(Type serviceType) | |||
return _testHelper; | |||
} | |||
|
|||
if (serviceType.IsInstanceOfType(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.
Why remove this? It doesn't look useful at all, but I'm curious why it caught your attention.
Description
Resolves critical race conditions in SearchParameter operations that occurred when multiple concurrent requests attempted to create, update, or delete the same SearchParameter resource simultaneously. This implementation introduces a robust two-layer concurrency control strategy combining application-level pessimistic locking with database-level optimistic concurrency.
Related issues
Addresses race condition issues where concurrent SearchParameter updates would fail unpredictably, particularly in high-load environments with multiple FHIR server instances.
AB#164155
Testing
Describe how this change was tested.
FHIR Team Checklist
Semver Change (docs)
Feature - New concurrency management capabilities with backward compatibility