kollo
April 2, 2020, 8:04pm
1
I had preflight errors before and I managed to repair them successfully すbut now there is no info about which db file is corrupted
@Alexey please help
2020-04-02T19:59:51.684Z INFO db.migration Database Version {"version": 33}
Error: Error during preflight check for storagenode databases: storage node preflight database error: file is not a database
storj.io/storj/private/dbutil/sqliteutil.QuerySchema.func1:35
storj.io/storj/private/dbutil/sqliteutil.QuerySchema:53
storj.io/storj/storagenode/storagenodedb.(*DB).Preflight:293
main.cmdRun:198
storj.io/storj/pkg/process.cleanup.func1.2:312
storj.io/storj/pkg/process.cleanup.func1:330
github.com/spf13/cobra.(*Command).execute:826
github.com/spf13/cobra.(*Command).ExecuteC:914
github.com/spf13/cobra.(*Command).Execute:864
storj.io/storj/pkg/process.ExecWithCustomConfig:84
storj.io/storj/pkg/process.ExecCustomDebug:66
main.main:328
runtime.main:203
2020-04-02T19:59:56.976Z INFO Configuration loaded from: /app/config/config.yaml
Alexey
April 2, 2020, 8:24pm
2
First of all - you should figure out, which one is died.
Please, use this manual to check all your databases: https://support.storj.io/hc/en-us/articles/360029309111-How-to-fix-a-database-disk-image-is-malformed-
kollo
April 2, 2020, 9:02pm
3
#sqlite3 notifications.db "PRAGMA integrity_check;"
ok
#sqlite3 pieceinfo.db "PRAGMA integrity_check;"
ok
#sqlite3 satellites.db "PRAGMA integrity_check;"
ok
#sqlite3 heldamount.db "PRAGMA integrity_check;"
ok
#sqlite3 orders.db "PRAGMA integrity_check;"
Error: database is locked
#sqlite3 piece_spaced_used.db "PRAGMA integrity_check;"
ok
#sqlite3 storage_usage.db "PRAGMA integrity_check;"
ok
#sqlite3 used_seria.db "PRAGMA integrity_check;"
ok
#sqlite3 info.db "PRAGMA integrity_check;"
ok
#sqlite3 piece_expiration.db "PRAGMA integrity_check;"
ok
#sqlite3 reputation.db "PRAGMA integrity_check;"
ok
OK, I can unlock by replacing the file
#cp orders.db orders.db.bak
#rm orders.db
#mv orders.db.bak orders.db
but getting still the same error:
Error: Error during preflight check for storagenode databases: storage node preflight database error: file is not a database
despite now orders.db is: ok
Alexey
April 2, 2020, 9:07pm
4
Have you stopped the storagenode before the check?
Make sure that you checked the actual dbs not the copies.
You missed the one database - bandwidth.db
kollo
April 2, 2020, 9:12pm
5
Yes
As in output, all files are in their original form
I checked, just missed to paste here, it is ok
kollo
April 2, 2020, 9:13pm
6
maybe remount drive (internal disk)
Alexey
April 2, 2020, 9:14pm
7
No, not needed.
But you can enable the debug log level in the config.yaml
and restart the storagenode
kollo
April 2, 2020, 9:18pm
10
Alexey
April 2, 2020, 9:28pm
12
kollo:
used_seria.db
doesn’t exist
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 4/2/2020 11:31 PM 6316032 bandwidth.db
-a---- 3/31/2020 6:31 PM 32768 heldamount.db
-a---- 3/31/2020 6:31 PM 16384 info.db
-a---- 3/31/2020 6:31 PM 24576 notifications.db
-a---- 4/2/2020 11:02 PM 84365312 orders.db
-a---- 3/31/2020 6:31 PM 114331648 pieceinfo.db
-a---- 3/31/2020 6:31 PM 53248 piece_expiration.db
-a---- 3/31/2020 6:31 PM 24576 piece_spaced_used.db
-a---- 3/31/2020 6:31 PM 20480 reputation.db
-a---- 2/19/2020 5:03 PM 32768 revocations.db
-a---- 3/31/2020 6:31 PM 32768 satellites.db
-a---- 3/31/2020 6:31 PM 196608 storage_usage.db
-a---- 4/2/2020 11:40 PM 265232384 used_serial.db
kollo
April 2, 2020, 9:34pm
14
got it! I didn’t check: used_serial.db and it gives me “Error: file is encrypted or is not a database”
Can I just remove?
Alexey
April 2, 2020, 9:39pm
15
Yes, you can try, but node will not start.
Please, do this:
Stop the storagenode
Remove the used_serial.db
and used_seria.db
(seems you typed it manually, not by [Tab]).
Execute
sqlite3 used_serial.db
CREATE TABLE used_serial_ (
satellite_id BLOB NOT NULL,
serial_number BLOB NOT NULL,
expiration TIMESTAMP NOT NULL
);
CREATE UNIQUE INDEX pk_used_serial_ ON used_serial_(satellite_id, serial_number);
CREATE INDEX idx_used_serial_ ON used_serial_(expiration);
.exit
Try to start the storagenode
Also, please, update your docker run
command: https://documentation.storj.io/setup/cli/storage-node#running-the-storage-node
2 Likes
kollo
April 2, 2020, 9:46pm
16
It worked! Thanks @Alexey ! Data is flowing.
3 Likes
bar1
July 2, 2020, 1:58pm
17
Hi bumping this…
getting this:
DEBUG Unrecoverable error {“error”: "Error during preflight check for storagenode databases: storage node preflight database error: bandwidth: schema check failed: disk I/O error: input/output error\n\tstorj.io/storj/storagenode/storagenodedb.(*DB ).Preflight:304\n\tmain.cmdRun:190\n\tstorj.io/private/process.cleanup.func1.4:359\n\tstorj.io/private
this did not work and i am getting a dize 0 bandwidth.db:
anything else i can try?
baker
July 2, 2020, 2:16pm
18
The disk I/O error would seem to suggest a problem with the disk/file system. Have you tried running a disk/filesystem check?
bar1
July 2, 2020, 3:11pm
19
i am running as a docker…disk seems ok
baker
July 2, 2020, 3:16pm
20
It may seem okay, but 1 bad block could kill a db file. Did you run a disk check? fsck in Linux or Disk Check in Windows? It would help if you gave us more info on your setup. Windows/Linux? How drive is attached? How old is your node? Did it recently get updated?
Did you already try the steps outlined here?
bar1
July 2, 2020, 3:37pm
21
bar1
July 2, 2020, 3:38pm
22
It’s an unraid docker, i think it got corrupt during a power trip at my house.
Alexey
July 2, 2020, 9:22pm
23
Then
Stop the storagenode
Check disk
Remove the bandwidth.db
if it’s still zero
Execute (replace the /path/to/the/data/storage
with your actual path to the databases):
docker run -it --rm --mount type=bind,source=/path/to/the/data/storage,destination=/data sstc/sqlite3 sqlite3 bandwidth.db
CREATE TABLE bandwidth_usage (
satellite_id BLOB NOT NULL,
action INTEGER NOT NULL,
amount BIGINT NOT NULL,
created_at TIMESTAMP NOT NULL
);
CREATE INDEX idx_bandwidth_usage_satellite ON bandwidth_usage(satellite_id);
CREATE INDEX idx_bandwidth_usage_created ON bandwidth_usage(created_at);
CREATE TABLE bandwidth_usage_rollups (
interval_start TIMESTAMP NOT NULL,
satellite_id BLOB NOT NULL,
action INTEGER NOT NULL,
amount BIGINT NOT NULL,
PRIMARY KEY ( interval_start, satellite_id, action )
);
.exit
Try to start the node