I got an update this evening and now cannot start:
Error: Error creating tables for master database on storagenode: migrate: UNIQUE constraint failed: paystubs_new.period, paystubs_new.satellite_id
storj.io/storj/storagenode/storagenodedb.(*DB).Migration.func20:1968
storj.io/storj/private/migrate.Func.Run:303
storj.io/storj/private/migrate.(*Migration).Run.func1:197
storj.io/storj/private/dbutil/txutil.withTxOnce:75
storj.io/storj/private/dbutil/txutil.WithTx:36
storj.io/storj/private/migrate.(*Migration).Run:196
storj.io/storj/storagenode/storagenodedb.(*DB).MigrateToLatest:346
main.cmdRun:193
storj.io/private/process.cleanup.func1.4:363
storj.io/private/process.cleanup.func1:381
github.com/spf13/cobra.(*Command).execute:842
github.com/spf13/cobra.(*Command).ExecuteC:950
github.com/spf13/cobra.(*Command).Execute:887
storj.io/private/process.ExecWithCustomConfig:88
storj.io/private/process.ExecCustomDebug:70
main.main:385
runtime.main:204
- Stop the storagenode
- Create a backup of
heldamount.db
- Run either with a local sqlite3 (make sure you use version v3.25.2 or later) or with a docker version (see https://support.storj.io/hc/en-us/articles/360029309111-How-to-fix-a-database-disk-image-is-malformed- for example), replace
/path/to
to your actual path to theheldamount.db
:
sqlite3 /path/to/heldamount.db
- When you see
sqlite>
prompt, execute:
CREATE TABLE IF NOT EXISTS "paystubs_new2" (period text NOT NULL,
satellite_id bytea NOT NULL,
created_at timestamp NOT NULL,
codes text NOT NULL,
usage_at_rest double precision NOT NULL,
usage_get bigint NOT NULL,
usage_put bigint NOT NULL,
usage_get_repair bigint NOT NULL,
usage_put_repair bigint NOT NULL,
usage_get_audit bigint NOT NULL,
comp_at_rest bigint NOT NULL,
comp_get bigint NOT NULL,
comp_put bigint NOT NULL,
comp_get_repair bigint NOT NULL,
comp_put_repair bigint NOT NULL,
comp_get_audit bigint NOT NULL,
surge_percent bigint NOT NULL,
held bigint NOT NULL,
owed bigint NOT NULL,
disposed bigint NOT NULL,
paid bigint NOT NULL,
distributed bigint NOT NULL,
PRIMARY KEY ( period, satellite_id )
);
insert into paystubs_new2 select * from paystubs;
drop table paystubs;
alter table paystubs_new2 rename to paystubs;
You could see an error during execution of the script, you can ignore it.
- Start the storagenode
- Check your logs.
Thanks Alexsey - that did it, not sure why it went wonky.
1 Like