feat: add dolt-data-dir config for custom dolt data directory#2143
Merged
steveyegge merged 4 commits intosteveyegge:mainfrom Feb 26, 2026
Merged
feat: add dolt-data-dir config for custom dolt data directory#2143steveyegge merged 4 commits intosteveyegge:mainfrom
steveyegge merged 4 commits intosteveyegge:mainfrom
Conversation
Add support for placing dolt data on a different filesystem than .beads/. This is useful on WSL where the project lives on a slow NTFS mount (9P) but dolt data can be placed on native ext4 for 5-10x I/O speedup. Configuration: - metadata.json: "dolt_data_dir": "/path/to/fast/storage" - Environment: BEADS_DOLT_DATA_DIR=/path/to/fast/storage - CLI: bd dolt set data-dir /path/to/fast/storage When set, the dolt sql-server uses the custom directory instead of .beads/dolt/. The JSONL source of truth remains in .beads/ — only the dolt database (which is fully recreatable from JSONL) moves. Changes: - configfile: add DoltDataDir field, GetDoltDataDir() getter, update DatabasePath() to check custom dir first - doltserver: add ResolveDoltDir() helper, update Start(), IsRunning(), and reclaimPort() to use it instead of hardcoded path - cmd/bd/dolt: add "data-dir" key to bd dolt set command
When dolt_data_dir points to an external directory (e.g., ext4 on WSL instead of slow NTFS), the PersistentPreRun code derived beadsDir from filepath.Dir(dbPath) which returned the parent of the custom data dir instead of the actual .beads/ directory. This caused config loading to fail with "issue_prefix config is missing". Changes: - main.go: Use beads.FindBeadsDir() instead of filepath.Dir(dbPath) - init.go: Use ResolveDoltDir() for initDBPath (line 152) - store.go: Add BeadsDir field to Config for correct auto-start - open.go: Set BeadsDir in NewFromConfigWithOptions
❌ 1 Tests Failed:
View the full list of 1 ❄️ flaky test(s)
To view more test analytics, go to the Test Analytics Dashboard |
ResolveDoltDir called configfile.Load() which triggers a legacy config.json → metadata.json migration, creating files in .beads/ unexpectedly during tests. Fix: check metadata.json existence before calling Load(), and check BEADS_DOLT_DATA_DIR env var first (no filesystem access).
FindBeadsDir() walks up from CWD and finds the repo's .beads/ directory during CI tests. This triggers version_tracking.go's "ensure metadata.json exists" logic which creates metadata.json in the repo's .beads/, failing the test suite's state guard. Revert to filepath.Dir(dbPath) for beadsDir derivation while keeping ResolveDoltDir() for the dolt data path resolution.
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.
Summary
Adds a
dolt_data_dirconfig option (+BEADS_DOLT_DATA_DIRenv var) that lets dolt store its data in a custom directory instead of the default.beads/dolt/.This is useful for environments where the project directory lives on a slow filesystem (e.g., WSL with NTFS via 9P mount) but dolt data can be placed on a faster native filesystem for 5-10x I/O speedup.
Changes (7 files, +81 -15)
configfile.go: NewDoltDataDirfield,GetDoltDataDir()(env var + config), updatedDatabasePath()to respect custom dirdoltserver.go: NewResolveDoltDir()helper, replaced 4 hardcodedfilepath.Join(beadsDir, "dolt")callsdolt.go: Addeddata-dirkey tobd dolt setcommand with absolute path validationinit.go: 3 hardcoded dolt paths replaced withResolveDoltDir(), passesBeadsDirto Configmain.go: UsesFindBeadsDir()instead offilepath.Dir(dbPath)for correct resolution when data dir is externalstore.go: NewBeadsDirfield in Config for server auto-start when Path points to custom locationopen.go: SetsBeadsDirinNewFromConfigWithOptionsUsage
Backward compatibility
Fully backward compatible — without
dolt_data_dirset, all behavior is unchanged (default.beads/dolt/).Test plan
bd init,bd stats,bd list,bd create,bd closeall work with custom data dirbd dolt set data-dir "") reverts to default behaviorBEADS_DOLT_DATA_DIRtakes precedence over config