Skip to content

enabling wal = true in grafana.ini as default for Grafana SQLite installation #65115

@usmangt

Description

@usmangt

Last week (and also in the past) we have seen a lot of issues (parent GH issue #64664 which links others) where the error message says:

logger=datasources t=2023-03-13T07:15:14.007294232+01:00 level=error msg="Failed getting data source" err="database is locked" uid=cb_4ryF7k id=0 name= orgId=1
logger=sqlstore.transactions rule_uid=aYormIFVz org_id=1 t=2023-03-13T07:15:14.007424053+01:00 level=info msg="Database locked, sleeping then retrying" error="database is locked" retry=1 code="database is locked"

The solution was to enable the wal (write-ahead-log) option in the grafana.ini configuration file:

# For "sqlite3" only. Enable/disable Write-Ahead Logging, https://sqlite.org/wal.html. Default is false.
; wal = false
I set it to "true" and its stable since then (first night without crash). So adding

wal = true

After that, it resolved the error message.

I then submitted this PR #64990 about the limitations of the (default) SQLite database as backend DB for Grafana so that users can know more if they are scaling their environment or don't want such issues in a production env.

The idea comes from a community user if we can enable this configuration parameter as default in the grafana.ini file.

Therefore, opening this issue myself so that we can get some feedback if it is fine to enable it or need more testing as the scope might be bigger.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions