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

Cleanup search parameters on historical resources #3847

Merged
merged 7 commits into from
May 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/validate-prs.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Validate Pull Request

on:
pull_request:
pull_request_target:
branches:
- main
types:
Expand All @@ -11,8 +11,6 @@ on:
- reopened
- synchronize
- edited
- milestoned
- demilestoned

env:
LABELS: ${{ join( github.event.pull_request.labels.*.name, ' ' ) }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Execute dbo.DeleteHistory 0,0,0
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this statement?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What has happened is that after Schema 76 the IsHistory column was removed from search parameter tables. This column hadn't been being used since v48, but for any customers who had data older than that there could be historical data still in those tables. That data was preventing current data from being returned in search requests because it was filling up the count of resources the search was looking for.
This stored procedure was written as part of v48 to clean up this data, but it was never actually run. This change explicitly runs this stored proc to finally clean up this unneeded data. It does not delete the historical resources, just the search parameters connected to them.

5,130 changes: 5,130 additions & 0 deletions src/Microsoft.Health.Fhir.SqlServer/Features/Schema/Migrations/80.sql

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,6 @@ public enum SchemaVersion
V77 = 77,
V78 = 78,
V79 = 79,
V80 = 80,
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Microsoft.Health.Fhir.SqlServer.Features.Schema
public static class SchemaVersionConstants
{
public const int Min = (int)SchemaVersion.V73;
public const int Max = (int)SchemaVersion.V79;
public const int Max = (int)SchemaVersion.V80;
public const int MinForUpgrade = (int)SchemaVersion.V73; // this is used for upgrade tests only
public const int SearchParameterStatusSchemaVersion = (int)SchemaVersion.V6;
public const int SupportForReferencesWithMissingTypeVersion = (int)SchemaVersion.V7;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ Go

INSERT INTO dbo.SchemaVersion
VALUES
(79, 'started')
(80, 'started')

Go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<!-- Properties used by sql task to generate full script -->
<PropertyGroup>
<LatestSchemaVersion>79</LatestSchemaVersion>
<LatestSchemaVersion>80</LatestSchemaVersion>
<GeneratedFullScriptPath>Features\Schema\Migrations\$(LatestSchemaVersion).sql</GeneratedFullScriptPath>
</PropertyGroup>

Expand Down
Loading