feat(dolt): add server mode support for multi-client access
- Add dolt_mode, dolt_server_host, dolt_server_port fields to configfile.Config - Add IsDoltServerMode(), GetDoltServerHost(), GetDoltServerPort() helpers - Update factory to read server mode config and set Options accordingly - Skip bootstrap in server mode (database lives on server) - Pass Database name to dolt.Config for USE statement after connecting - Disable dolt stats collection to avoid lock issues in embedded mode This enables bd to connect to a running dolt sql-server (started via 'gt dolt start') instead of using embedded mode, allowing multi-client access without file locking conflicts. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
gastown/crew/george
parent
db0c6fbd3f
commit
13c362e67e
@@ -262,6 +262,11 @@ func openEmbeddedConnection(ctx context.Context, cfg *Config) (*sql.DB, string,
|
||||
return nil, "", fmt.Errorf("failed to connect to Dolt database after %d retries: %w", cfg.LockRetries, lastErr)
|
||||
}
|
||||
|
||||
// Disable statistics collection to avoid stats subdatabase lock issues
|
||||
// The stats database can cause "cannot update manifest: database is read only"
|
||||
// errors when multiple processes access the embedded Dolt database
|
||||
_, _ = db.ExecContext(ctx, "SET @@dolt_stats_enabled = 0")
|
||||
|
||||
return db, connStr, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ type Options struct {
|
||||
// Dolt server mode options (federation)
|
||||
ServerMode bool // Connect to dolt sql-server instead of embedded
|
||||
ServerHost string // Server host (default: 127.0.0.1)
|
||||
ServerPort int // Server port (default: 3306)
|
||||
ServerPort int // Server port (default: 3307)
|
||||
ServerUser string // MySQL user (default: root)
|
||||
Database string // Database name for Dolt server mode (default: beads)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user