Repository navigation
fix(storage): a partial PageFileConfig gets LockTimeout.Default, not Immediate (#322) - #329
Open
CaffeinatedCoder wants to merge 1 commit into
Open
CaffeinatedCoder wants to merge 1 commit into
CaffeinatedCoder wants to merge 1 commit into
Conversation
…Immediate (EntglDb#322) A PageFileConfig built with an object initializer that does not set LockTimeout opened with default(LockTimeout), whose values equal LockTimeout.Immediate, so every contended lock failed at once. LockTimeout now records whether any of its properties was set (not part of equality), and Normalize() replaces an unset value with LockTimeout.Default, as it already does for PageSize and GrowthBlockSize. An explicit Immediate or From(0, 0, 0) is kept. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch was successfully 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.
Closes #322
Problem
new PageFileConfig { AllowMultiProcessAccess = true }(the example in theNormalize()doc comment) opens withdefault(LockTimeout), whose values equalLockTimeout.Immediate(0 ms / 0 ms / 0 writers).Normalize()fills inPageSizeandGrowthBlockSizebut notLockTimeout, and the engine cannot tell "not set" from "fail fast on purpose", so every contended lock fails at once.Change
Option 1 from the issue:
LockTimeoutrecords whether any of its properties was set (internal bool IsSpecified). The threeinitaccessors set it, soImmediate,Default,From(...)and any object initializer count as set;default(LockTimeout)andnew LockTimeout()do not. Equality andGetHashCodestay on the three values.PageFileConfig.Normalize()replaces an unsetLockTimeoutwithLockTimeout.Default.StorageEnginealready callsNormalize()on every config.LockTimeout,PageFileConfig.LockTimeoutandNormalize()say so.No public API change. The presets already set
LockTimeout.Default, so their behaviour is unchanged.Tests
PageFileConfigLockTimeoutTests.StorageEngine_PartialConfigWithoutLockTimeout_GetsDefault_ExplicitImmediateIsKeptopens aStorageEnginewith an initializer config that leavesLockTimeoutunset (expectsDefault), and with an explicitImmediateandFrom(0, 0, 0)(both kept). It fails onmain(Actual: LockTimeout(Read=0ms, Write=0ms, MaxWriters=0)).Full suite on one machine under heavy load: the failures were lock-timeout tests from the class #302 addresses, a different set in each run, and the same happened on plain
main(10 failures). Every failing test class, run alone on this branch: 140 passed, twice.🤖 Generated with Claude Code