diff --git a/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.diff.sql b/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.diff.sql index 0fde302139..ba40fd681d 100644 --- a/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.diff.sql +++ b/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.diff.sql @@ -21,7 +21,7 @@ BEGIN d.OriginalWatermark FROM dbo.DeletedInstance AS d WITH (UPDLOCK, READPAST) INNER JOIN - dbo.Partition AS p WITH (NOLOCK) + dbo.Partition AS p ON p.PartitionKey = d.PartitionKey WHERE RetryCount <= @maxRetries AND CleanupAfter < SYSUTCDATETIME(); diff --git a/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.sql b/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.sql index 9bc6bf796e..8436e11d41 100644 --- a/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.sql +++ b/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Migrations/42.sql @@ -2630,7 +2630,7 @@ BEGIN d.OriginalWatermark FROM dbo.DeletedInstance AS d WITH (UPDLOCK, READPAST) INNER JOIN - dbo.Partition AS p WITH (NOLOCK) + dbo.Partition AS p ON p.PartitionKey = d.PartitionKey WHERE RetryCount <= @maxRetries AND CleanupAfter < SYSUTCDATETIME(); diff --git a/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Sql/Sprocs/RetrieveDeletedInstanceV42.sql b/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Sql/Sprocs/RetrieveDeletedInstanceV42.sql index afe35eb6e4..6dd97138d2 100644 --- a/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Sql/Sprocs/RetrieveDeletedInstanceV42.sql +++ b/src/Microsoft.Health.Dicom.SqlServer/Features/Schema/Sql/Sprocs/RetrieveDeletedInstanceV42.sql @@ -23,7 +23,7 @@ BEGIN SELECT TOP (@count) p.PartitionName, d.PartitionKey, d.StudyInstanceUid, d.SeriesInstanceUid, d.SopInstanceUid, d.Watermark, d.OriginalWatermark FROM dbo.DeletedInstance as d WITH (UPDLOCK, READPAST) - INNER JOIN dbo.Partition as p WITH (NOLOCK) + INNER JOIN dbo.Partition as p ON p.PartitionKey = d.PartitionKey WHERE RetryCount <= @maxRetries AND CleanupAfter < SYSUTCDATETIME()