mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Database: Adds support for enable/disable SQLite Write-Ahead Logging (WAL) via configuration (#58268)
Adds support for enable/disable SQLite Write-Ahead Logging (WAL) via configuration. Enables SQLite WAL for E2E tests.
This commit is contained in:
committed by
GitHub
parent
df27164b8e
commit
79f1a7a4fd
@@ -325,6 +325,11 @@ func (ss *SQLStore) buildConnectionString() (string, error) {
|
||||
}
|
||||
|
||||
cnnstr = fmt.Sprintf("file:%s?cache=%s&mode=rwc", ss.dbCfg.Path, ss.dbCfg.CacheMode)
|
||||
|
||||
if ss.dbCfg.WALEnabled {
|
||||
cnnstr += "&_journal_mode=WAL"
|
||||
}
|
||||
|
||||
cnnstr += ss.buildExtraConnectionString('&')
|
||||
default:
|
||||
return "", fmt.Errorf("unknown database type: %s", ss.dbCfg.Type)
|
||||
@@ -453,6 +458,7 @@ func (ss *SQLStore) readConfig() error {
|
||||
ss.dbCfg.IsolationLevel = sec.Key("isolation_level").String()
|
||||
|
||||
ss.dbCfg.CacheMode = sec.Key("cache_mode").MustString("private")
|
||||
ss.dbCfg.WALEnabled = sec.Key("wal").MustBool(false)
|
||||
ss.dbCfg.SkipMigrations = sec.Key("skip_migrations").MustBool()
|
||||
ss.dbCfg.MigrationLockAttemptTimeout = sec.Key("locking_attempt_timeout_sec").MustInt()
|
||||
|
||||
@@ -677,6 +683,7 @@ type DatabaseConfig struct {
|
||||
MaxIdleConn int
|
||||
ConnMaxLifetime int
|
||||
CacheMode string
|
||||
WALEnabled bool
|
||||
UrlQueryParams map[string][]string
|
||||
SkipMigrations bool
|
||||
MigrationLockAttemptTimeout int
|
||||
|
||||
Reference in New Issue
Block a user