Multi-process follow-ups after #221 (open lock): index fill under the lock, dictionary reload for readers, stale free-list head, ...
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 12/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp
- Domain
- databases, distributed-systems
Research direction
Start with the open-lock path in WalSharedMemory.cs (EnterOpenLock, EnterOpenLockCore, ReleaseOpenLock), then StorageEngine.Dictionary.cs (GetDictionaryKey), StorageEngine.Memory.cs (.slots handling) and PageFile.cs (IsUnwrittenNewFile). Each numbered point needs either a fix or a documented decision, and the list is probably better split into separate issues. Multi-process locking and the free-list design need maintainer input before any code change.
Written by the indexing model from the issue text.
Description
Non-blocking points found while reviewing #221 (open lock for multi-process create/open, #216). None of them is a regression that blocks #221; collected here so they don't get lost.
- Index migration and fill run under the open lock.
MigrateLegacyDecimalIndexesandApplyIndexBuilder(model-declared index fill, #175) run inside theDocumentCollectionconstructor /CreateCollection, so underEnterOpenLock(). While one process builds a large index, other processes' opens, new dictionary keys and first collection-file opens wait up to 60 s (WalSharedMemory.cs, open-lock timeout) and then throwTimeoutException. Either keep the fill out of the lock (fill unregistered, then register under the lock) or document it inroadmap/v5/MULTI_PROCESS_WAL.md. - Readers don't see dictionary keys added by other processes.
GetDictionaryKey(StorageEngine.Dictionary.cs) never reloads, so a process can't decode a key id another process added after it opened (it getsnull). The new-key path in #221 reloads; the read path doesn't. - Cost of a new key in multi-process mode. Each new key re-reads the whole dictionary and refreshes every open page file. That adds up for schemaless workloads with many distinct field names.
- Stale free-list head in a writer that doesn't take the open lock.
RefreshAllocationStatere-reads_firstFreePageIdonly under the open lock. If another process takes pages from the free list meanwhile, a writer can hand out a page from its stale head. Same root cause as the block-skip fix in #221 (60a9c9f), which covers only appended pages. - Leaked pages. Each skip past another process's block abandons the rest of this engine's own block; those pages are never allocated until a compaction.
.slotsnot reloaded under the open lock (StorageEngine.Memory.cs). WithCollectionDataDirectory, two processes can give the same slot to different collections and overwrite each other's.slots. Predates #221.- Encrypted files whose creator crashed.
IsUnwrittenNewFile(PageFile.cs) skips encrypted files, so an encrypted database whose creator died before writing the header still can't be opened. (The zero-file re-initialisation in #221 also applies in single-process mode; worth a line in the release notes.) ReleaseOpenLockhas no "held" flag, unlike the writer lock's_writerLockHeld. A release while another thread of the same engine still holds it (engine disposed mid-constructor) can leave the in-process semaphore or the macOS lock descriptor wrong.- Small race: a collection file disposed by
DropCollectionFilewhileEnterOpenLockCoreiterates the files makes that call throwObjectDisposedException. - macOS sidecar:
<shm>.open.lockstays on disk like the existing.lock; document it with the other sidecar files.
- Dominant language
- C#
- Stars
- 66
- Forks
- 6
- Avg merge
- 1d 2h
- Merged PRs (30d)
- 58
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from EntglDb/BLite
-
GdprMode.Strict warns that deleted documents are not zeroed, but every delete zero-fills themPossibly taken @CaffeinatedCoder claimed this 7 days ago. Openbug gdpr package/core severity/low
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
EntglDb/BLite#299 · 1 comment ·
Maintainers usually reply within 2 days
-
bug package/core severity/medium triage
Difficulty 4/5 3-5 days Newbie friendliness 54/100
Maintainers usually reply within 2 days
-
bug package/core severity/medium
Difficulty 4/5 3-5 days Newbie friendliness 48/100
EntglDb/BLite#322 · 1 comment ·
Maintainers usually reply within 2 days
-
enhancement package/core
Difficulty 4/5 3-5 days Newbie friendliness 48/100
EntglDb/BLite#320 · 1 comment ·
Maintainers usually reply within 2 days
-
BLiteSession.Rollback() does not await the rollback: it returns while the transaction is still active, and failures go unobservedPossibly taken @CaffeinatedCoder claimed this 7 days ago. Openbug package/core severity/medium
Difficulty 3/5 1-2 days Newbie friendliness 78/100
EntglDb/BLite#307 · 1 comment ·
Maintainers usually reply within 2 days
Similar issues
-
area-multitenancy area-security p1-recommended priority-high technical-debt
Difficulty 2/5 Under an hour Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
-
kind/enhancement Provider Upgrade pulumi/pulumi-azure R1 Task
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
pulumi/pulumi-azure#3669 ·
-
[BUG] FromCString causes 1 byte OOB read in native codePossibly taken @mattleibow claimed this 1 day ago. Opentype/bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
mono/SkiaSharp#5426 · 1 reaction · 2 assignees ·
Maintainers usually reply within 1 day
-
webclient does not startPossibly taken @PawelTroka claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
PawelTroka/Computator.NET#257 ·
Maintainers usually reply within 1 day