Check and repair Databases | STORJ Optimization

Hello together,

today I discovered some great approach to check quickly all data bases.

First you download sqlite3 as per guide:

Then you should download notepad++ and switch the view to automatic line-switching. The reason why we swtich to that line-switching is to keep the overview and not scrolling annoyingly to the right and left because the command line is that long.

grafik

Now you can already start preparing your command to check all 13 data bases with one command:

sqlite3 /mnt/disk-1/STORJ-1/storage/heldamount.db “PRAGMA integrity_check;”; sqlite3 /mnt/disk-1/STORJ-1/storage/info.db “PRAGMA integrity_check;”; sqlite3 /mnt/disk-1/STORJ-1/storage/notifications.db “PRAGMA integrity_check;”
… and so on till you have all 13.

When executed and the DB’s are looking fine it looks like this:

grafik

When there are errors it looks like this:

grafik

When you have multiple nodes and want to continue then just change the command with Ctrl + H and then replace all with the next mount point plus the next node number.

Hope this helps and thanks and kind regards,

This can already be achieved with a shorter simpler version as shown in documentation

Linux:

find /path/to/storage/ -iname “*.db” -maxdepth 1 -print0 -exec sqlite3 ‘{}’ ‘PRAGMA integrity_check;’ ‘;’

Windows:

Get-ChildItem X:\storagenode\storage*.db -File | %{$.Name + " " + $(sqlite3.exe $.FullName “PRAGMA integrity_check;”)}

This is without the need to mention all the dbs by name or the need to have notepad++

I think you totally missed point 5.2.5 from the documentation.

2 Likes

With this command I’m getting the message: find: warning: you have specified the global option -maxdepth after the argument -iname, but global options are not positional, i.e., -maxdepth affects tests specified before it as well as those specified after it. Please specify global options before other arguments.

Also when I try to fix the DB I’m getting the following error message with this command:

docker run -it --rm --mount type=tmpfs,destination=/ramdisk,tmpfs-size=1.5G --mount type=bind,src=Y:/mnt/disk-1/STORJ-1/storage,dst=/data sstc/sqlite3 sh

Error message:

docker: Error response from daemon: invalid mount config for type “bind”: invalid mount path: ‘Y:…’ mount path must be absolute.

Update:

Unfortunately I can’t just delete the corrupted DB and then restart with a new. It has to be repaired. Does anyone know how to repair the piece_expiration.db?

Start from step 6 for repairing a database … “We will unload all uncorrupted data and then load it back.”


This should totally be possible. A node can start with completely new databases as long as the data and identity is still the same and not corrupt.

2 Likes

I got it run for the first piece_expiration.db now.

Was struggeling with the docker command, which I don’t need at all with sqlite3 installed and with all the /storage/-paths who have all to be adjusted.

Hope it works soon.

Update:

Perfect it worked for piece_expiration.db and for storage_usage.db and the node is running fine now. The guide should still have more hints, that the commands should be adjusted and not just copied over.

2 Likes

this is simple a warning, but I would fix it.

find /path/to/storage/ -maxdepth 1 -iname "*.db" -print0 -exec sqlite3 '{}' 'PRAGMA integrity_check;' ';'

You may try it like this:

docker run -it --rm --mount type=tmpfs,destination=/ramdisk,tmpfs-size=1.5G --mount type=bind,src=Y:\mnt\disk-1\STORJ-1\storage,dst=/data sstc/sqlite3 sh

However, it’s for a Windows OS. And are you sure that it’s really have this path?
In PowerShell:

ls Y:\mnt\disk-1\STORJ-1\storage