mirror of
https://github.com/grafana/grafana.git
synced 2025-08-02 11:01:34 +08:00
Add isolation level db configuration parameter (#33830)
* add isolation level db configuration parameter * add isolation_level to default.ini and sample.ini * add note that only mysql supports isolation levels for now * mention isolation_level in the documentation * Update docs/sources/administration/configuration.md Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com> Co-authored-by: achatterjee-grafana <70489351+achatterjee-grafana@users.noreply.github.com>
This commit is contained in:
@ -235,6 +235,10 @@ func (ss *SQLStore) buildConnectionString() (string, error) {
|
||||
cnnstr += "&tls=custom"
|
||||
}
|
||||
|
||||
if isolation := ss.dbCfg.IsolationLevel; isolation != "" {
|
||||
cnnstr += "&tx_isolation=" + isolation
|
||||
}
|
||||
|
||||
cnnstr += ss.buildExtraConnectionString('&')
|
||||
case migrator.Postgres:
|
||||
addr, err := util.SplitHostPortDefault(ss.dbCfg.Host, "127.0.0.1", "5432")
|
||||
@ -384,6 +388,7 @@ func (ss *SQLStore) readConfig() error {
|
||||
ss.dbCfg.ClientCertPath = sec.Key("client_cert_path").String()
|
||||
ss.dbCfg.ServerCertName = sec.Key("server_cert_name").String()
|
||||
ss.dbCfg.Path = sec.Key("path").MustString("data/grafana.db")
|
||||
ss.dbCfg.IsolationLevel = sec.Key("isolation_level").String()
|
||||
|
||||
ss.dbCfg.CacheMode = sec.Key("cache_mode").MustString("private")
|
||||
ss.dbCfg.SkipMigrations = sec.Key("skip_migrations").MustBool()
|
||||
@ -537,6 +542,7 @@ type DatabaseConfig struct {
|
||||
ClientCertPath string
|
||||
ServerCertName string
|
||||
ConnectionString string
|
||||
IsolationLevel string
|
||||
MaxOpenConn int
|
||||
MaxIdleConn int
|
||||
ConnMaxLifetime int
|
||||
|
Reference in New Issue
Block a user