Closed drazicmartin closed 5 months ago
Could you let me know in which journal mode your database is running? You can find this out by running this command inside your database (can be done from Grafana):
PRAGMA journal_mode;
I am currently investigating the issue and I am wondering if this might be relevant: https://www.sqlite.org/wal.html#read_only_databases
And sadly your "steps to reproduce" only work on your machine I think.
Could you provide me a debug level grafana log file when the error occurs?
Thanks for your anser !
PRAGMA journal_mode;
return wal
The error only came accross if i'm edditing the SQL query, if i'm only viewing the dashboard and not editing it, the error never came. Also, I found that it auto fix when a new entry is added to the database, but then it came back if I futher edit.
some logs when the error appear :
2024-03-18 21:39:13 logger=context userId=1 orgId=1 uname=admin t=2024-03-18T20:39:13.788060844Z level=info msg="Request Completed" method=POST path=/api/ds/query status=400 remote_addr=172.20.0.1 time_ms=44 duration=44.607735ms size=116 referer="http://localhost:3001/d/a67e2671-da10-42e4-b293-61d6c7b80fd4/main-dashboard?editPanel=2&orgId=1" handler=/api/ds/query
2024-03-18 21:39:14 logger=accesscontrol.service t=2024-03-18T20:39:14.635974739Z level=debug msg="Using cached permissions" key=rbac-permissions-1-user-1
2024-03-18 21:39:14 logger=query_data t=2024-03-18T20:39:14.686296537Z level=debug msg="Processing metrics query" query="unsupported value type"
2024-03-18 21:39:14 logger=secrets.kvstore t=2024-03-18T20:39:14.68636007Z level=debug msg="got secret value from cache" orgId=1 type=datasource namespace=pb-database
2024-03-18 21:39:14 logger=plugin.frser-sqlite-datasource t=2024-03-18T20:39:14.686962583Z level=debug msg="Received request for data"
2024-03-18 21:39:14 logger=plugin.frser-sqlite-datasource t=2024-03-18T20:39:14.686989364Z level=debug msg="Variables replaced"
2024-03-18 21:39:14 logger=plugin.frser-sqlite-datasource t=2024-03-18T20:39:14.687067034Z level=debug msg="Macros applied"
2024-03-18 21:39:14 logger=plugin.frser-sqlite-datasource t=2024-03-18T20:39:14.687440766Z level=error msg="Could not execute query" err="attempt to write a readonly database (1544)" query="SELECT * FROM records\r\n"
2024-03-18 21:39:14 logger=plugin.frser-sqlite-datasource t=2024-03-18T20:39:14.687528182Z level=debug msg="Finished query" refID=A
2024-03-18 21:39:14 logger=context userId=1 orgId=1 uname=admin t=2024-03-18T20:39:14.687694291Z level=info msg="Request Completed" method=POST path=/api/ds/query status=400 remote_addr=172.20.0.1 time_ms=52 duration=52.760945ms size=116 referer="http://localhost:3001/d/a67e2671-da10-42e4-b293-61d6c7b80fd4/main-dashboard?editPanel=2&orgId=1" handler=/api/ds/query
I also investigated the version that pocketabse is using for SQLite is 3.45.1
which is almost the latest version and far from version 3.22.0 that is mentioned in the link you provided.
The command PRAGMA journal_mode; return wal
According to the SQLite docs this is not a good setup for a read only file system. See link: https://www.sqlite.org/wal.html#read_only_databases
Describe the bug It seam like the Grafana is trying to write into my data.db but does not have write access. I don't want grafana to have it. I simply want him to fetch data from my backend using pocket-base that use SQlite database under the hood. So I simply point data source to the
data.db
file. The FAQ says that it is fine if the plugins only have read-access :But after some time a simple query like
SELECT * FROM [table]
raise an errorTo Reproduce Steps to reproduce the behavior:
docker-compose
filehttp://localhost:8090/_
SELECT * FROM [table]
Screenshots
Versions:
Additional context
Here is my docker-compose file
I hope it's clear. If you have any questions, feel free to ask!