Multiprocess support #184
Labels
No labels
A-build
A-cli
A-core
A-design
A-edn
A-ffi
A-query
A-sdk
A-sdk-android
A-sdk-ios
A-sync
A-transact
A-views
A-vocab
P-Android
P-desktop
P-iOS
bug
correctness
dependencies
dev-ergonomics
discussion
documentation
duplicate
enhancement
enquiry
good first bug
good first issue
help wanted
hygiene
in progress
invalid
question
ready
size
speed
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: greg/mentat#184
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I thought I'd write a quick brain-dump about how I could imagine two separate processes collaborating on a single Mentat store.
Firstly, the basics: NFS share workarounds and such. That's relatively well understood.
Secondly, SQLite: SQLite is happy with two processes sharing a database, but if only one is allowed to write, the other must be prepared for its attempts to open a transaction to fail.
Thirdly, Mentat itself: we store schema and part information in memory. We must be prepared to establish a transaction around every read or write (or be prepared to re-do work if we keep our critical section small and the schema changes before we enter it), and within that transaction quickly check or revise our assumptions: e.g., refreshing the parts table or checking the latest transaction ID.
We should be able to make this relatively efficient — we already store a generation number in memory, and the work being done on syncing will increase the amount of metadata we store on disk, so there's a natural place to track changes.
You could imagine this as being equivalent to re-opening the
Conn
and rebuilding its metadata each time we start a read or write.In reality the schema is fairly stable, so the only collisions are likely to be in transacting, which is already an exclusive operation.