feat(sync-service): Add exclusive mode to support AWS EFS#3859
Open
magnetised wants to merge 1 commit intomainfrom
Open
feat(sync-service): Add exclusive mode to support AWS EFS#3859magnetised wants to merge 1 commit intomainfrom
magnetised wants to merge 1 commit intomainfrom
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3859 +/- ##
===========================================
+ Coverage 76.66% 87.18% +10.52%
===========================================
Files 37 25 -12
Lines 1611 2325 +714
Branches 171 587 +416
===========================================
+ Hits 1235 2027 +792
+ Misses 375 296 -79
- Partials 1 2 +1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This comment has been minimized.
This comment has been minimized.
50a1bcd to
986229f
Compare
✅ Deploy Preview for electric-next ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
986229f to
2cdda99
Compare
2cdda99 to
c8e3cea
Compare
This comment has been minimized.
This comment has been minimized.
c8e3cea to
75f6997
Compare
This comment has been minimized.
This comment has been minimized.
d8d8e2f to
12495f2
Compare
this is done by registering the write pool twice when in exclusive_mode, so the runtime cost is equivalent to the version without the mode tweak. while we're there allow for configuring other bits of the sqlite behaviour via config and env-vars
12495f2 to
59ba3da
Compare
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.
NFS filesystems, such as AWS EFS, do not support SQLite WAL mode or simultaneous access by multiple processes, due to the limitiations of NFS locking semantics.
So to support AWS EFS this pr adds a new "exclusive mode" to the shape db configuration, enabled by setting
ELECTRIC_SHAPE_DB_EXCLUSIVE_MODE=true, which multiplexes all reads and writes through a single SQLite connection and configures the database withjournal_mode=DELETEas recommended by the SQLite docs.There is also a new
ELECTRIC_SHAPE_DB_STORAGE_DIRconfiguration option which allows for hosting the shape db file in a different location from the shape data, e.g. on a non-networked filesystem.These two options open up the possibility of an in-memory shape database, so enabling exclusive mode and setting
ELECTRIC_SHAPE_DB_STORAGE_DIR=:memory:will do exactly that.Since I was wiring up shapedb configuration, I've also added env-vars and configuration to set page cache size and durabilty (
PRAGMA cache_size=...andPRAGMA synchronous=...).Follow up work: