FATAL Unrecoverable error {"error": "Error during preflight check for storagenode databases "bandwidth"

HI, Have been at this all day, for some reason after a reboot storj stopped working, tracked it as far as the bandwidth db.

Im using Win 10 Gui

Have completed a fix as per instructions on - - How to fix a “database disk image is malformed”
All DBs are now showing as OK when tested as per the instructions.

This is the current fail I am getting

2020-09-27T20:36:41.808+1000 INFO db.migration Database Version {“version”: 45}
2020-09-27T20:36:42.603+1000 FATAL Unrecoverable error {“error”: “Error during preflight check for storagenode databases: preflight: database “bandwidth”: expected schema does not match actual: &dbschema.Schema{\n \tTables: *dbschema.Table{&{Name: “bandwidth_usage”, Columns: *dbschema.Column{&{Name: “action”, Type: “INTEGER”}, &{Name: “amount”, Type: “BIGINT”}, &{Name: “created_at”, Type: “TIMESTAMP”}, &{Name: “satellite_id”, Type: “BLOB”}}}, &{Name: “bandwidth_usage_rollups”, Columns: *dbschema.Column{&{Name: “action”, Type: “INTEGER”}, &{Name: “amount”, Type: “BIGINT”}, &{Name: “interval_start”, Type: “TIMESTAMP”}, &{Name: “satellite_id”, Type: “BLOB”}}, PrimaryKey: string{“action”, “interval_start”, “satellite_id”}}},\n- \tIndexes: *dbschema.Index{\n- \t\tsIndex<Table: bandwidth_usage, Name: idx_bandwidth_usage_created, Columns: created_at, Unique: false, Partial: \"\">,\n- \t\tsIndex<Table: bandwidth_usage, Name: idx_bandwidth_usage_satellite, Columns: satellite_id, Unique: false, Partial: \"\">,\n- \t},\n+ \tIndexes: nil,\n }\n\n\tstorj.io/storj/storagenode/storagenodedb.(*DB).Preflight:437\n\tmain.cmdRun:194\n\tstorj.io/private/process.cleanup.func1.4:353\n\tstorj.io/private/process.cleanup.func1:371\n\tgithub.com/spf13/cobra.(*Command).execute:840\n\tgithub.com/spf13/cobra.(*Command).ExecuteC:945\n\tgithub.com/spf13/cobra.(*Command).Execute:885\n\tstorj.io/private/process.ExecWithCustomConfig:88\n\tstorj.io/private/process.Exec:65\n\tmain.(*service).Execute.func1:66\n\tgolang.org/x/sync/errgroup.(*Group).Go.func1:57”, “errorVerbose”: “Error during preflight check for storagenode databases: preflight: database “bandwidth”: expected schema does not match actual: &dbschema.Schema{\n \tTables: *dbschema.Table{&{Name: “bandwidth_usage”, Columns: *dbschema.Column{&{Name: “action”, Type: “INTEGER”}, &{Name: “amount”, Type: “BIGINT”}, &{Name: “created_at”, Type: “TIMESTAMP”}, &{Name: “satellite_id”, Type: “BLOB”}}}, &{Name: “bandwidth_usage_rollups”, Columns: *dbschema.Column{&{Name: “action”, Type: “INTEGER”}, &{Name: “amount”, Type: “BIGINT”}, &{Name: “interval_start”, Type: “TIMESTAMP”}, &{Name: “satellite_id”, Type: “BLOB”}}, PrimaryKey: string{“action”, “interval_start”, “satellite_id”}}},\n- \tIndexes: *dbschema.Index{\n- \t\tsIndex<Table: bandwidth_usage, Name: idx_bandwidth_usage_created, Columns: created_at, Unique: false, Partial: \"\">,\n- \t\tsIndex<Table: bandwidth_usage, Name: idx_bandwidth_usage_satellite, Columns: satellite_id, Unique: false, Partial: \"\">,\n- \t},\n+ \tIndexes: nil,\n }\n\n\tstorj.io/storj/storagenode/storagenodedb.(*DB).Preflight:437\n\tmain.cmdRun:194\n\tstorj.io/private/process.cleanup.func1.4:353\n\tstorj.io/private/process.cleanup.func1:371\n\tgithub.com/spf13/cobra.(*Command).execute:840\n\tgithub.com/spf13/cobra.(*Command).ExecuteC:945\n\tgithub.com/spf13/cobra.(*Command).Execute:885\n\tstorj.io/private/process.ExecWithCustomConfig:88\n\tstorj.io/private/process.Exec:65\n\tmain.(*service).Execute.func1:66\n\tgolang.org/x/sync/errgroup.(*Group).Go.func1:57\n\tmain.cmdRun:196\n\tstorj.io/private/process.cleanup.func1.4:353\n\tstorj.io/private/process.cleanup.func1:371\n\tgithub.com/spf13/cobra.(*Command).execute:840\n\tgithub.com/spf13/cobra.(*Command).ExecuteC:945\n\tgithub.com/spf13/cobra.(*Command).Execute:885\n\tstorj.io/private/process.ExecWithCustomConfig:88\n\tstorj.io/private/process.Exec:65\n\tmain.(*service).Execute.func1:66\n\tgolang.org/x/sync/errgroup.(*Group).Go.func1:57”}

Any help would be appreciated

Thank you

Is there a way to fix this? Im happy to dump any bandwidth earnings if a simple delete of the bandwidth db will fix this.

thank you

I really wish these errors would just point out the exact mismatch rather than dumping a fairly hard to read schema.

Alright, lets start over with a clean one. This will remove bandwidth stats, but shouldn’t impact payout. (bandwidth orders for payout are stored and sent from elsewhere)

  1. Stop the node

  2. Rename the bandwidth.db file to something like bandwidth.db-bak

  3. Run with your path

sqlite3 /your/path/to/bandwidth.db

Create new empty tables.

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);
  1. Exit sqlite
.quit
  1. Start node

Sir, Thank you very much

Worked like a charm

cheers
Donkey