From 01f5aa8f3cb687104d8615e34db563afc429facf Mon Sep 17 00:00:00 2001 From: Panos Xynos Date: Mon, 22 May 2023 15:36:00 +0100 Subject: [PATCH] Grafana SQLite3 supports WAL Signed-off-by: Jamie Van Dyke --- jobs/grafana/spec | 2 ++ jobs/grafana/templates/config/grafana.ini | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/jobs/grafana/spec b/jobs/grafana/spec index a721e704..9f158b88 100644 --- a/jobs/grafana/spec +++ b/jobs/grafana/spec @@ -140,6 +140,8 @@ properties: description: "(MySQL only) The common name field of the certificate used by the mysql server. Not necessary if ssl_mode is set to 'skip-verify'" grafana.database.log_queries: description: "Set to true to log the sql calls and execution times" + grafana.database.wal: + description: "(SQLite3 only & optional) Setting it to true enables SQLite WAL (Write-Ahead Logging). Possible values are true, false. If not set defaults to false for Grafana" grafana.remote_cache.type: description: "Either 'redis', 'memcached', 'database'" diff --git a/jobs/grafana/templates/config/grafana.ini b/jobs/grafana/templates/config/grafana.ini index f8509252..66890847 100644 --- a/jobs/grafana/templates/config/grafana.ini +++ b/jobs/grafana/templates/config/grafana.ini @@ -162,6 +162,10 @@ path = /var/vcap/store/grafana/grafana.db # For "sqlite3" only. cache mode setting used for connecting to the database cache_mode = <%= cache_mode %> <% end %> +<% if_p('grafana.database.wal') do |wal| %> +# Enable/disable Write-Ahead Logging, https://sqlite.org/wal.html. WAL has benefits when sqlite3 struggles with locks. +wal = <%= wal %> +<% end %> <% elsif p('grafana.database.type') == "mysql" || p('grafana.database.type') == "postgres" %> <% database_host = nil