"Action": "GET_AUDIT", "error": "usedserialsdb error: database is locked",

I’m running a docker version on Debian GNU/Linux.

Here’s the procedure I use to vacuum and check the databases:

  • Stop the node
  • Vacuum the dbs
  • integrity_check the dbs
  • Restart the node

Here’s a bash check which should do that for you. Please change the database directory to reflect where yours are on your system.

docker stop -t 300 storagenode &&
dbs=$(ls /opt/storj/storage/*.db)
c1="VACUUM;"
c2="PRAGMA integrity_check;"
for i in $dbs
do
  sqlite3 $i "$c1"
done
for i in $dbs
do
  sqlite3 $i "$c2"
done
docker start storagenode

The output looks like this:

# ./vacuum-test.sh
storagenode
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
ok
storagenode

If it works for you, and you have a low spec-ed node, it might be useful to run the script once a week.

You can automate that task using cron:

crontab -e

And add the following line… changing the script location as appropriate… to run every Sunday at 6:30

30 6 * * 0 /root/scripts/vacuum-databases.sh

11 Likes