* 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>
(cherry picked from commit 7367cfc0a3)
Co-authored-by: Serge Zaitsev <serge.zaitsev@grafana.com>
This commit is contained in:
co-authored by
Serge Zaitsev
parent
b86d371aab
commit
0e8d0be72a
@@ -105,6 +105,12 @@ log_queries =
|
|||||||
# For "mysql", use either "true", "false", or "skip-verify".
|
# For "mysql", use either "true", "false", or "skip-verify".
|
||||||
ssl_mode = disable
|
ssl_mode = disable
|
||||||
|
|
||||||
|
# Database drivers may support different transaction isolation levels.
|
||||||
|
# Currently, only "mysql" driver supports isolation levels.
|
||||||
|
# If the value is empty - driver's default isolation level is applied.
|
||||||
|
# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE".
|
||||||
|
isolation_level =
|
||||||
|
|
||||||
ca_cert_path =
|
ca_cert_path =
|
||||||
client_key_path =
|
client_key_path =
|
||||||
client_cert_path =
|
client_cert_path =
|
||||||
|
|||||||
@@ -94,6 +94,12 @@
|
|||||||
# For "postgres" only, either "disable", "require" or "verify-full"
|
# For "postgres" only, either "disable", "require" or "verify-full"
|
||||||
;ssl_mode = disable
|
;ssl_mode = disable
|
||||||
|
|
||||||
|
# Database drivers may support different transaction isolation levels.
|
||||||
|
# Currently, only "mysql" driver supports isolation levels.
|
||||||
|
# If the value is empty - driver's default isolation level is applied.
|
||||||
|
# For "mysql" use "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE".
|
||||||
|
;isolation_level =
|
||||||
|
|
||||||
;ca_cert_path =
|
;ca_cert_path =
|
||||||
;client_key_path =
|
;client_key_path =
|
||||||
;client_cert_path =
|
;client_cert_path =
|
||||||
|
|||||||
@@ -329,6 +329,10 @@ Set to `true` to log the sql calls and execution times.
|
|||||||
For Postgres, use either `disable`, `require` or `verify-full`.
|
For Postgres, use either `disable`, `require` or `verify-full`.
|
||||||
For MySQL, use either `true`, `false`, or `skip-verify`.
|
For MySQL, use either `true`, `false`, or `skip-verify`.
|
||||||
|
|
||||||
|
### isolation_level
|
||||||
|
|
||||||
|
Only the MySQL driver supports isolation levels in Grafana. In case the value is empty, the driver's default isolation level is applied. Available options are "READ-UNCOMMITTED", "READ-COMMITTED", "REPEATABLE-READ" or "SERIALIZABLE".
|
||||||
|
|
||||||
### ca_cert_path
|
### ca_cert_path
|
||||||
|
|
||||||
The path to the CA certificate to use. On many Linux systems, certs can be found in `/etc/ssl/certs`.
|
The path to the CA certificate to use. On many Linux systems, certs can be found in `/etc/ssl/certs`.
|
||||||
|
|||||||
@@ -235,6 +235,10 @@ func (ss *SQLStore) buildConnectionString() (string, error) {
|
|||||||
cnnstr += "&tls=custom"
|
cnnstr += "&tls=custom"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if isolation := ss.dbCfg.IsolationLevel; isolation != "" {
|
||||||
|
cnnstr += "&tx_isolation=" + isolation
|
||||||
|
}
|
||||||
|
|
||||||
cnnstr += ss.buildExtraConnectionString('&')
|
cnnstr += ss.buildExtraConnectionString('&')
|
||||||
case migrator.Postgres:
|
case migrator.Postgres:
|
||||||
addr, err := util.SplitHostPortDefault(ss.dbCfg.Host, "127.0.0.1", "5432")
|
addr, err := util.SplitHostPortDefault(ss.dbCfg.Host, "127.0.0.1", "5432")
|
||||||
@@ -381,6 +385,7 @@ func (ss *SQLStore) readConfig() {
|
|||||||
ss.dbCfg.ClientCertPath = sec.Key("client_cert_path").String()
|
ss.dbCfg.ClientCertPath = sec.Key("client_cert_path").String()
|
||||||
ss.dbCfg.ServerCertName = sec.Key("server_cert_name").String()
|
ss.dbCfg.ServerCertName = sec.Key("server_cert_name").String()
|
||||||
ss.dbCfg.Path = sec.Key("path").MustString("data/grafana.db")
|
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.CacheMode = sec.Key("cache_mode").MustString("private")
|
||||||
ss.dbCfg.SkipMigrations = sec.Key("skip_migrations").MustBool()
|
ss.dbCfg.SkipMigrations = sec.Key("skip_migrations").MustBool()
|
||||||
@@ -516,6 +521,7 @@ type DatabaseConfig struct {
|
|||||||
ClientCertPath string
|
ClientCertPath string
|
||||||
ServerCertName string
|
ServerCertName string
|
||||||
ConnectionString string
|
ConnectionString string
|
||||||
|
IsolationLevel string
|
||||||
MaxOpenConn int
|
MaxOpenConn int
|
||||||
MaxIdleConn int
|
MaxIdleConn int
|
||||||
ConnMaxLifetime int
|
ConnMaxLifetime int
|
||||||
|
|||||||
Reference in New Issue
Block a user