OK i did the following now:
stop storagenode
rm bandwidth.db
rm storage_usage.db
rm used_serial.db
rm orders.db
start storage node and let him create all the tables
storagenode_1 | Error: Error creating tables for master database on storagenode: migrate: no such table: main.order_archive_
storagenode_1 | storj.io/storj/private/migrate.(*Migration).Run:182
storagenode_1 | storj.io/storj/storagenode/storagenodedb.(*DB).CreateTables:291
storagenode_1 | main.cmdRun:186
storagenode_1 | storj.io/storj/pkg/process.cleanup.func1.2:299
storagenode_1 | storj.io/storj/pkg/process.cleanup.func1:317
storagenode_1 | github.com/spf13/cobra.(*Command).execute:826
storagenode_1 | github.com/spf13/cobra.(*Command).ExecuteC:914
storagenode_1 | github.com/spf13/cobra.(*Command).Execute:864
storagenode_1 | storj.io/storj/pkg/process.ExecWithCustomConfig:79
storagenode_1 | storj.io/storj/pkg/process.Exec:61
storagenode_1 | main.main:326
storagenode_1 | runtime.main:203
storagenode_1 exited with code 1
stop storage node
copy back orders.db.bak to orders.db
Executing the sqlite commands:
sqlite3 orders.db
drop index idx_orders;
CREATE INDEX idx_orders ON unsent_order(satellite_id, serial_number);
.exit
starting the storagenode and now i get again:
storagenode_1 | 2020-02-11T09:01:12.562Z INFO version running on version v0.31.12
storagenode_1 | 2020-02-11T09:01:13.408Z INFO db.migration Database Version {"version": 31}
storagenode_1 | Error: Error during preflight check for storagenode databases: storage node preflight database error: used_serial: expected schema does not match actual: &dbschema.Schema{
storagenode_1 | - Tables: []*dbschema.Table{
storagenode_1 | - &{
storagenode_1 | - Name: "used_serial_",
storagenode_1 | - Columns: []*dbschema.Column{
storagenode_1 | - &{Name: "expiration", Type: "TIMESTAMP"},
storagenode_1 | - &{Name: "satellite_id", Type: "BLOB"},
storagenode_1 | - &{Name: "serial_number", Type: "BLOB"},
storagenode_1 | - },
storagenode_1 | - },
storagenode_1 | - },
storagenode_1 | + Tables: nil,
storagenode_1 | - Indexes: []*dbschema.Index{
storagenode_1 | - &{Name: "idx_used_serial_", Table: "used_serial_", Columns: []string{"expiration"}},
storagenode_1 | - &{
storagenode_1 | - Name: "pk_used_serial_",
storagenode_1 | - Table: "used_serial_",
storagenode_1 | - Columns: []string{"satellite_id", "serial_number"},
storagenode_1 | - },
storagenode_1 | - },
storagenode_1 | + Indexes: nil,
storagenode_1 | }
storagenode_1 |
storagenode_1 | storj.io/storj/storagenode/storagenodedb.(*DB).Preflight:317
storagenode_1 | main.cmdRun:196
storagenode_1 | storj.io/storj/pkg/process.cleanup.func1.2:299
storagenode_1 | storj.io/storj/pkg/process.cleanup.func1:317
storagenode_1 | github.com/spf13/cobra.(*Command).execute:826
storagenode_1 | github.com/spf13/cobra.(*Command).ExecuteC:914
storagenode_1 | github.com/spf13/cobra.(*Command).Execute:864
storagenode_1 | storj.io/storj/pkg/process.ExecWithCustomConfig:79
storagenode_1 | storj.io/storj/pkg/process.Exec:61
storagenode_1 | main.main:326
storagenode_1 | runtime.main:203
storagenode_1 exited with code 1
How can expected schema does not match when the database is recreated on first start when it´s not present?
So i backed up all databases and removed them and did the same procedure like before stop, restore orders.db, execute SQL commands, start storagenode.
The result is:
Error: Error during preflight check for storagenode databases: storage node preflight database error: orders: expected schema does not match actual: &dbschema.Schema{
Tables: []*dbschema.Table{
&{Name: "order_archive_", Columns: []*dbschema.Column{&{Name: "archived_at", Type: "TIMESTAMP"}, &{Name: "order_limit_serialized", Type: "BLOB"}, &{Name: "order_serialized", Type: "BLOB"}, &{Name: "satellite_id", Type: "BLOB"}, &{Name: "serial_number", Type: "BLOB"}, &{Name: "status", Type: "INTEGER"}, &{Name: "uplink_cert_id", Type: "INTEGER", Reference: &dbschema.Reference{Table: "certificate", Column: "cert_id"}}}},
+ &{
+ Name: "test_table",
+ Columns: []*dbschema.Column{
+ &{Name: "id", Type: "int"},
+ &{Name: "name", Type: "varchar(30)", IsNullable: true},
+ },
+ PrimaryKey: []string{"id"},
+ },
&{Name: "unsent_order", Columns: []*dbschema.Column{&{Name: "order_limit_expiration", Type: "TIMESTAMP"}, &{Name: "order_limit_serialized", Type: "BLOB"}, &{Name: "order_serialized", Type: "BLOB"}, &{Name: "satellite_id", Type: "BLOB"}, &{Name: "serial_number", Type: "BLOB"}, &{Name: "uplink_cert_id", Type: "INTEGER", Reference: &dbschema.Reference{Table: "certificate", Column: "cert_id"}}}},
},
Indexes: []*dbschema.Index{&{Name: "idx_order_archived_at", Table: "order_archive_", Columns: []string{"archived_at"}}, &{Name: "idx_orders", Table: "unsent_order", Columns: []string{"satellite_id", "serial_number"}}},
}
storj.io/storj/storagenode/storagenodedb.(*DB).Preflight:317
main.cmdRun:196
storj.io/storj/pkg/process.cleanup.func1.2:299
storj.io/storj/pkg/process.cleanup.func1:317
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:79
storj.io/storj/pkg/process.Exec:61
main.main:326
runtime.main:203
This is driving me crazy