Repository navigation
Declare SqlEventLogServerEncrypted indexes inline on SQL Server - #10675
Merged
tim-smart merged 4 commits intoNov 17, 2026
Merged
Conversation
createTable created each compaction index with a separate IF NOT EXISTS (sys.indexes) CREATE INDEX after the CREATE TABLE. Two instances opening the same store could run CREATE INDEX on the same table together, which SQL Server can deadlock and only resolves after its lock monitor picks a victim (up to about 5 s). The indexes are now declared inside the one CREATE TABLE, through a helper shared with MySQL, so the table and its indexes appear together. Index names, columns and the existing retry are unchanged. Closes Effect-TS#10672 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: b04ad2d The changes in this PR will be included in the next version bump. This PR includes changesets to release 35 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Bundle Size AnalysisGenerated from PR build output; treat the content below as untrusted.
|
This branch is waiting to be deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type
Description
On SQL Server, concurrent openers of
SqlEventLogServerEncryptedcan both pass the index-existence check and execute separateCREATE INDEXstatements, causing lock waits and deadlocks before retry recovery.Declare the compaction-table indexes inside
CREATE TABLE, matching the existing per-scope batch-table approach. Index names, columns and retries are unchanged. The change is MSSQL-local; MySQL, PostgreSQL and SQLite are untouched.One regression in the existing MSSQL integration file holds a separate index creation open on another connection and asserts that opening storage completes instead of waiting on a lock held by that session. The probe filters on the holding session's id, because SQL Server's own background sessions block each other in a fresh container. The test detects the blocking path. It is not a full deadlock reproduction or a guarantee that all concurrent startup is wait-free.
Validation
At b04ad2d, using SQL Server 2022 through local Podman with
EFFECT_INTEGRATION_TESTS=1andEFFECT_MSSQL_INTEGRATION_TESTS=1:expected 'waited' to equal 'opened'in 2 of 2 runs.SqlEventLogServerEncrypted.integration.test.ts.Test timed out in 5000msfor two tests, and one run failed a single test after 5.2 seconds (message not captured).pnpm lint-fix,pnpm check(tsrs) andgit diff --checkpass, all throughnix develop -c.Other SQL dialect suites were not rerun because their implementation is unchanged. Standard PR CI disables MSSQL integration tests, so the local SQL Server runs above are what cover this change.
Original author's cross-dialect red/green evidence for the first PR head: workflow run.
Related
Closes #10672
Closes EFF-3849