Skip to content
Draft
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
3 changes: 1 addition & 2 deletions src/DurableTask.SqlServer/Scripts/logic.sql
Original file line number Diff line number Diff line change
Expand Up @@ -1282,7 +1282,6 @@ BEGIN
-- Table order for this sproc: NewTasks --> Payloads

-- Update (lock) and return a single row.
-- The PK_NewTasks hint is specified to help ensure in-order selection.
-- TODO: Filter out tasks for instances that are in a non-running state (suspended, etc.)
UPDATE TOP (1) NewTasks WITH (READPAST)
SET
Expand All @@ -1291,7 +1290,7 @@ BEGIN
[LockExpiration] = @LockExpiration,
[DequeueCount] = [DequeueCount] + 1
FROM
NewTasks WITH (INDEX (PK_NewTasks))
NewTasks
WHERE
[TaskHub] = @TaskHub AND
([LockExpiration] IS NULL OR [LockExpiration] < @now) AND
Expand Down
17 changes: 17 additions & 0 deletions src/DurableTask.SqlServer/Scripts/schema-1.7.0.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Copyright (c) Microsoft Corporation.
-- Licensed under the MIT License.

-- PERSISTENT SCHEMA OBJECTS (tables, indexes, types, etc.)
--
-- The contents of this file must never be changed after
-- being published. Any schema changes must be done in
-- new schema-{major}.{minor}.{patch}.sql scripts.

-- Add a covering index on NewTasks to improve the performance of _LockNextTask.
-- This allows SQL Server to efficiently find unlocked, visible tasks without
-- performing a full clustered-index scan, which is important under high concurrency
-- when there may be a backlog of locked or not-yet-visible tasks.
IF NOT EXISTS (SELECT 1 FROM sys.indexes WHERE object_id = OBJECT_ID('__SchemaNamePlaceholder__.NewTasks') AND name = 'IX_NewTasks_LockNext')
CREATE NONCLUSTERED INDEX IX_NewTasks_LockNext ON __SchemaNamePlaceholder__.NewTasks(TaskHub, LockExpiration, VisibleTime)
INCLUDE (SequenceNumber, LockedBy, DequeueCount)
GO
2 changes: 1 addition & 1 deletion src/common.props
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<!-- Version settings: https://andrewlock.net/version-vs-versionsuffix-vs-packageversion-what-do-they-all-mean/ -->
<PropertyGroup>
<MajorVersion>1</MajorVersion>
<MinorVersion>6</MinorVersion>
<MinorVersion>7</MinorVersion>
<PatchVersion>0</PatchVersion>
<VersionPrefix>$(MajorVersion).$(MinorVersion).$(PatchVersion)</VersionPrefix>
<VersionSuffix></VersionSuffix>
Expand Down
Loading