Bandwidthdb error: file is not a database

Ok. Thank you for the reply. So I should be able to copy my old bandwidth.db file to my current folder? I could try that.

I am also having β€œfile is not a database” error. Does anybody have a new download link for bandwidth.db?

Here you go. https://alpha.transfer.sh/qnGpG/bandwidth.db

You also can create it yourself.

  1. Stop the storagenode
  2. Remove the broken bandwidth.db
  3. Execute either with native sqlite3 or with a docker (you can use the https://support.storj.io/hc/en-us/articles/360029309111-How-to-fix-a-database-disk-image-is-malformed- as a reference)
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 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 )
                                                                        );
CREATE INDEX idx_bandwidth_usage_satellite ON bandwidth_usage(satellite_id);
CREATE INDEX idx_bandwidth_usage_created   ON bandwidth_usage(created_at);
.exit
  1. Try to start the storagenode

Thanks for the file, I tried it but now I get the error below. I also did integrity checks on all the dbs based on the link you provided as well.

Error: Error during preflight check for storagenode databases: storage node preflight database error: bandwidth: expected schema does not match actual: &dbschema.Schema{

  • Tables: *dbschema.Table{
  • s"Name: bandwidth_usage\nColumns:\n\tName: action\n\tType: INTEGER\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\n\tName: amount\n\tType: BIGINT\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\n\tName: created_at\n\tType: TIMESTAMP\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\n\tName: satellite_id\n\tType: BLOB\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\nPrimaryKey: \nUniques:\n\t",
  • s"Name: bandwidth_usage_rollups\nColumns:\n\tName: action\n\tType: INTEGER\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\n\tName: amount\n\tType: BIGINT\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\n\tName: interval_start\n\tType: TIMESTAMP\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\n\tName: satellite_id\n\tType: BLOB\n\tNullable: false\n\tDefault: β€œβ€\n\tReference: nil\nPrimaryKey: action interval_start satellite_id\nUniques:\n\t",
  • },
  • Tables: nil,
  • Indexes: *dbschema.Index{
  • sIndex<Table: bandwidth_usage, Name: idx_bandwidth_usage_created, Columns: created_at, Unique: false, Partial: "">,
  • sIndex<Table: bandwidth_usage, Name: idx_bandwidth_usage_satellite, Columns: satellite_id, Unique: false, Partial: "">,
  • },
  • Indexes: nil,
    }

storj.io/storj/storagenode/storagenodedb.(*DB).Preflight:314
main.cmdRun:198

Please, try the second method

That worked! Node is back up and running, thanks

2 Likes