Node error - orders.db

Dear Support,

I found the problem on 19 month node, i trying to fix the db problem and restart node still error. All the /home/storj/storage/ “*.DB” already backup and detail below.

Please help. thanks. :sneezing_face:

1.
sqlite3 /home/storj/storage/orders.db “PRAGMA integrity_check;”
*** in database main ***
On tree page 3 cell 179: Rowid 2986696 out of order
On tree page 3 cell 178: Rowid 2986688 out of order
On tree page 3 cell 177: Rowid 2986680 out of order
On tree page 3 cell 176: Rowid 2986672 out of order
On tree page 3 cell 175: Rowid 2986664 out of order
On tree page 3 cell 174: Rowid 2986656 out of order
On tree page 3 cell 173: Rowid 2986648 out of order
On tree page 3 cell 172: Rowid 2986640 out of order
On tree page 3 cell 171: Rowid 2986632 out of order
On tree page 3 cell 169: Rowid 2986616 out of order
On tree page 3 cell 154: Rowid 2986496 out of order
On tree page 3 cell 153: Rowid 2986488 out of order
On tree page 3 cell 152: Rowid 2986480 out of order
On tree page 3 cell 151: Rowid 2986472 out of order
On tree page 3 cell 150: Rowid 2986464 out of order
On tree page 3 cell 133: Rowid 2986328 out of order
On tree page 3 cell 132: Rowid 2986320 out of order
On tree page 3 cell 131: Rowid 2986312 out of order
On tree page 39207 cell 7: Rowid 5912 out of order
On tree page 39208 cell 7: Rowid 6040 out of order
On tree page 39212 cell 7: Rowid 5304 out of order
On tree page 39215 cell 7: Rowid 5192 out of order
On tree page 912 cell 304: 2nd reference to page 39208
On tree page 912 cell 288: 2nd reference to page 39207
On tree page 912 cell 212: 2nd reference to page 39212
On tree page 912 cell 198: 2nd reference to page 39215
On tree page 912 cell 190: 2nd reference to page 39210
On tree page 912 cell 182: 2nd reference to page 39206
On tree page 912 cell 135: 2nd reference to page 39213
On tree page 911 cell 202: 2nd reference to page 9107
On tree page 911 cell 125: 2nd reference to page 38568
On tree page 911 cell 123: 2nd reference to page 29072
On tree page 911 cell 121: 2nd reference to page 32484
On tree page 911 cell 119: 2nd reference to page 38101
On tree page 911 cell 118: 2nd reference to page 30270
On tree page 911 cell 117: 2nd reference to page 38486
On tree page 911 cell 115: 2nd reference to page 10368
On tree page 911 cell 113: 2nd reference to page 36092
On tree page 911 cell 111: 2nd reference to page 12224
On tree page 911 cell 110: 2nd reference to page 4929
On tree page 911 cell 109: 2nd reference to page 32379
On tree page 911 cell 108: 2nd reference to page 36840
On tree page 911 cell 105: 2nd reference to page 38023
On tree page 911 cell 104: 2nd reference to page 29298
On tree page 911 cell 103: 2nd reference to page 30114
On tree page 911 cell 60: 2nd reference to page 16056
On tree page 911 cell 57: 2nd reference to page 22905
On tree page 38468 cell 7: Rowid 896 out of order
On tree page 911 cell 55: 2nd reference to page 32372
On tree page 32341 cell 7: Rowid 776 out of order
On tree page 911 cell 52: 2nd reference to page 23216
On tree page 911 cell 51: 2nd reference to page 32863
On tree page 30242 cell 7: Rowid 944 out of order
On tree page 911 cell 49: 2nd reference to page 29484
On tree page 911 cell 48: 2nd reference to page 36909
On tree page 30386 cell 2: Rowid 388 out of order
On tree page 911 cell 46: 2nd reference to page 38411
On tree page 38269 cell 7: Rowid 784 out of order
On tree page 911 cell 44: 2nd reference to page 35487
On tree page 33304 cell 7: Rowid 792 out of order
On tree page 911 cell 42: 2nd reference to page 28993
On tree page 17203 cell 7: Rowid 808 out of order
On tree page 911 cell 38: 2nd reference to page 24653
On tree page 911 cell 37: 2nd reference to page 32093
On tree page 911 cell 36: 2nd reference to page 32865
On tree page 911 cell 35: 2nd reference to page 26114
On tree page 28753 cell 7: Rowid 816 out of order
On tree page 911 cell 33: 2nd reference to page 33999
On tree page 911 cell 32: 2nd reference to page 38718
On tree page 911 cell 31: 2nd reference to page 26402
On tree page 911 cell 30: 2nd reference to page 32402
On tree page 911 cell 29: 2nd reference to page 2241
On tree page 911 cell 28: 2nd reference to page 28852
On tree page 911 cell 27: 2nd reference to page 28413
On tree page 911 cell 26: 2nd reference to page 38317
On tree page 911 cell 25: 2nd reference to page 1097
On tree page 911 cell 24: 2nd reference to page 5228
On tree page 5020 cell 7: Rowid 824 out of order
On tree page 911 cell 22: 2nd reference to page 28692
On tree page 911 cell 21: 2nd reference to page 31137
On tree page 911 cell 20: 2nd reference to page 33198
On tree page 911 cell 19: 2nd reference to page 5294
On tree page 30642 cell 7: Rowid 832 out of order
On tree page 24372 cell 7: Rowid 904 out of order
On tree page 911 cell 15: 2nd reference to page 5156
On tree page 5158 cell 7: Rowid 912 out of order
On tree page 911 cell 13: 2nd reference to page 32201
On tree page 911 cell 12: 2nd reference to page 28859
On tree page 911 cell 11: 2nd reference to page 23694
On tree page 27377 cell 7: Rowid 920 out of order
On tree page 911 cell 9: 2nd reference to page 30204
On tree page 911 cell 8: 2nd reference to page 9846
On tree page 911 cell 7: 2nd reference to page 32493
On tree page 38526 cell 7: Rowid 840 out of order
On tree page 911 cell 4: 2nd reference to page 1038
On tree page 32655 cell 7: Rowid 712 out of order
On tree page 9682 cell 7: Rowid 928 out of order
On tree page 32165 cell 7: Rowid 936 out of order
On tree page 9 cell 7: Rowid 704 out of order
On tree page 324271 cell 17: 2nd reference to page 1749

2
Used the sqlite3 to fix the orders.db problem and show
sqlite3 /home/storj/storage/orders.db “PRAGMA integrity_check;”
ok

3
copy the new orders.db to /home/storj/storage/ and restart the node.

4
docker logs --tail 50 storagenode

X = Hidden

2020-10-14T04:25:29.635Z        INFO    Configuration loaded    {"Location": "/app/config/config.yaml"}
2020-10-14T04:25:29.661Z        INFO    Operator email  {"Address": "XXXXXXXXX@mail.com"}
2020-10-14T04:25:29.661Z        INFO    Operator wallet {"Address": "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"}
2020-10-14T04:25:30.050Z        INFO    Telemetry enabled
2020-10-14T04:25:30.055Z        INFO    db.migration    Database Version        {"version": 45}
Error: Error during preflight check for storagenode databases: preflight: database "orders": expected schema does not match actual:   &dbschema.Schema{
        Tables: {&{Name: "order_archive_", Columns: {&{Name: "archived_at", Type: "TIMESTAMP"}, &{Name: "order_limit_serialized", Type: "BLOB"}, &{Name: "order_serialized", Type: "BLOB"}, &{Name: "satellite_id", Type: "BLOB"}, ...}}, &{Name: "unsent_order", Columns: {&{Name: "order_limit_expiration", Type: "TIMESTAMP"}, &{Name: "order_limit_serialized", Type: "BLOB"}, &{Name: "order_serialized", Type: "BLOB"}, &{Name: "satellite_id", Type: "BLOB"}, ...}}},
        Indexes: []*dbschema.Index{
                &{Name: "idx_order_archived_at", Table: "order_archive_", Columns: {"archived_at"}},
-               s`Index<Table: unsent_order, Name: idx_orders, Columns: satellite_id serial_number, Unique: true, Partial: "">`,
        },
  }

        storj.io/storj/storagenode/storagenodedb.(*DB).Preflight:424
        main.cmdRun:199
        storj.io/private/process.cleanup.func1.4:362
        storj.io/private/process.cleanup.func1:380
        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:335
        runtime.main:204

All other information:
Error orders.db size: 1.3G orders.db
New orders.db size: 1.2G orders.db (sqlite3 after)

/home/storj/orders/unsent have a 515M unsent file ( from Sep 6 to 14 Oct 2020 )

:sweat_smile: :sweat_smile: :sweat_smile:

now, i re-use the Error orders.db size: 1.3G orders.db to keeping run to node first and keeping Suspension & Audit are stable (100%) until fixed the error
:sob: :crying_cat_face:

Can you try running this query on your orders.db and see if you still get the preflight error?

CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number)

Also, out of curiosity, what version is your storage node on? We are transitioning from using the orders db to using files stored on the disk - if your node has been on a new version for long enough, there might be other options to solve the issue. But try creating the index first.

Maybe also try

CREATE INDEX idx_order_archive_satellite ON order_archive(satellite_id)

The preflight errors don’t paste well into the forum so it is hard for me to see what exactly the issue is. If trying to create the indexes doesn’t work, please send me the preflight error through something like https://pastebin.com/

I edited a post - marked a code block as the code block :slight_smile:
Is it helpful?

1 Like

Yes, that is helpful. In that case, they only need to create idx_orders, and not idx_order_archive_satellite.

1 Like

@moby

I will try and update.
May i know this command how to use ? any tool need to install on Ubuntu 16.04 ?

thanks.

CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number)
CREATE INDEX idx_order_archive_satellite ON order_archive(satellite_id)

Please, tell us what version you are currently running.

About those commands, the only thing that you need is to have the sqlite3 command-line interface. If you don’t have, in Ubuntu 16.04 you can install the package named sqlite3, but it looks that you’ve already had it because you used it to execute the "PRAGMA integrity_check".

So you should just do sqlite3 /home/storj/storage/orders.db 'CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number)'

As @moby commented you shouldn’t need to execute the CREATE INDEX idx_order_archive_satellite ON order_archive(satellite_id) one.

1 Like

thanks for help.

VERSION v1.14.7.

Thanks.

Have you updated after you responded @moby or that was the version that you were running when you reported the problem in this thread?

that was the version that you were running when you reported the problem in this thread?

@ifraixedes Yes, version v1.14.7

@moby I will update the command result on tonight

1 Like

@moby This is my result , thanks.

  • Stop the storagenode
  • Used the command and detail below
root@PC1-ABC:/home/storj/storage# ls -l
total 1813756
-rw-r--r-- 1 root root  653366272 Oct 15 11:58 bandwidth.db
drwx------ 8 root root       4096 May  2 19:35 blobs
drwx------ 2 root root       4096 Oct 15 11:10 garbage
-rw-r--r-- 1 root root      65536 Oct 15 11:58 heldamount.db
-rw-r--r-- 1 root root      16384 Oct 15 11:58 info.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 notifications.db
-rw-r--r-- 1 root root 1189549056 Oct 15 11:50 orders.db
-rw-r--r-- 1 root root     192512 Oct 15 11:58 piece_expiration.db
-rw-r--r-- 1 root root   13537280 Oct 15 11:58 pieceinfo.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 piece_spaced_used.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 pricing.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 reputation.db
-rw-r--r-- 1 root root          0 Sep  1 10:26 revocations.db
-rw-r--r-- 1 root root      32768 Oct 15 11:58 satellites.db
-rw-r--r-- 1 root root         32 Oct 14 04:43 storage-dir-verification
-rw-r--r-- 1 root root     385024 Oct 15 11:58 storage_usage.db
drwx------ 2 root root       4096 Oct 15 11:10 temp
drwx------ 8 root root       4096 May 11 23:10 trash
-rw-r--r-- 1 root root       4096 Oct 15 11:58 used_serial.db
root@PC1-ABC:/home/storj/storage# sqlite3 /home/storj/storage/orders.db "CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number)"
Error: UNIQUE constraint failed: unsent_order.satellite_id, unsent_order.serial_number
root@PC1-ABC:/home/storj/storage# ls -l
total 1813788
-rw-r--r-- 1 root root  653366272 Oct 15 11:58 bandwidth.db
drwx------ 8 root root       4096 May  2 19:35 blobs
drwx------ 2 root root       4096 Oct 15 11:10 garbage
-rw-r--r-- 1 root root      65536 Oct 15 11:58 heldamount.db
-rw-r--r-- 1 root root      16384 Oct 15 11:58 info.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 notifications.db
-rw-r--r-- 1 root root 1189549056 Oct 15 11:50 orders.db
-rw-r--r-- 1 root root      32768 Oct 15 11:59 orders.db-shm  <---------
-rw-r--r-- 1 root root          0 Oct 15 11:59 orders.db-wal   <---------
-rw-r--r-- 1 root root     192512 Oct 15 11:58 piece_expiration.db
-rw-r--r-- 1 root root   13537280 Oct 15 11:58 pieceinfo.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 piece_spaced_used.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 pricing.db
-rw-r--r-- 1 root root      24576 Oct 15 11:58 reputation.db
-rw-r--r-- 1 root root          0 Sep  1 10:26 revocations.db
-rw-r--r-- 1 root root      32768 Oct 15 11:58 satellites.db
-rw-r--r-- 1 root root         32 Oct 14 04:43 storage-dir-verification
-rw-r--r-- 1 root root     385024 Oct 15 11:58 storage_usage.db
drwx------ 2 root root       4096 Oct 15 11:10 temp
drwx------ 8 root root       4096 May 11 23:10 trash
-rw-r--r-- 1 root root       4096 Oct 15 11:58 used_serial.db
root@PC1-ABC:/home/storj/storage#
root@PC1-ABC:/home/storj/storage# sqlite3 /home/storj/storage/orders.db "CREATE INDEX idx_order_archive_satellite ON order_archive(satellite_id)"
Error: no such table: main.order_archive
root@PC1-ABC:/home/storj/storage#
root@PC1-ABC:/home/storj/storage# sqlite3 /home/storj/storage/orders.db "PRAGMA integrity_check;"
ok

  • start storagenode and check the log again
root@PC1-ABC:/home/storj/storage# docker start storagenode
storagenode
root@PC1-ABC:/home/storj/storage# docker ps
CONTAINER ID        IMAGE                          COMMAND                  CREATED             STATUS                         PORTS               NAMES
eafa434be399        storjlabs/storagenode:latest   "/entrypoint"            32 hours ago        Restarting (1) 2 seconds ago                       storagenode
1ff8b6de97c1        storjlabs/watchtower           "/watchtower storage…"   5 months ago        Up 2 days                                          watchtower
root@PC1-ABC:/home/storj/storage# docker logs --tail 20 storagenode
2020-10-15T12:21:18.049Z        INFO    db.migration    Database Version        {"version": 45}
Error: Error during preflight check for storagenode databases: preflight: database "orders": expected schema does not match actual:   &dbschema.Schema{
        Tables: {&{Name: "order_archive_", Columns: {&{Name: "archived_at", Type: "TIMESTAMP"}, &{Name: "order_limit_serialized", Type: "BLOB"}, &{Name: "order_serialized", Type: "BLOB"}, &{Name: "satellite_id", Type: "BLOB"}, ...}}, &{Name: "unsent_order", Columns: {&{Name: "order_limit_expiration", Type: "TIMESTAMP"}, &{Name: "order_limit_serialized", Type: "BLOB"}, &{Name: "order_serialized", Type: "BLOB"}, &{Name: "satellite_id", Type: "BLOB"}, ...}}},
        Indexes: []*dbschema.Index{
                &{Name: "idx_order_archived_at", Table: "order_archive_", Columns: {"archived_at"}},
-               s`Index<Table: unsent_order, Name: idx_orders, Columns: satellite_id serial_number, Unique: true, Partial: "">`,
        },
  }

        storj.io/storj/storagenode/storagenodedb.(*DB).Preflight:424
        main.cmdRun:199
        storj.io/private/process.cleanup.func1.4:362
        storj.io/private/process.cleanup.func1:380
        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:335
        runtime.main:204
  • This is my archive & unsent status
root@PC1-ABC:/home/storj/orders/archive# ls -l
total 0
root@PC1-ABC:/home/storj/orders/unsent# ls -l
-rw-r--r-- 1 root root  23515 Oct 14 04:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602648000000000000
-rw-r--r-- 1 root root  59652 Oct 14 06:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602651600000000000
-rw-r--r-- 1 root root  38444 Oct 14 06:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602655200000000000
-rw-r--r-- 1 root root  11179 Oct 14 08:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602658800000000000
-rw-r--r-- 1 root root  12311 Oct 14 09:04 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602662400000000000
-rw-r--r-- 1 root root  33599 Oct 14 10:01 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602666000000000000
-rw-r--r-- 1 root root  51060 Oct 14 11:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602669600000000000
-rw-r--r-- 1 root root  69460 Oct 14 12:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602673200000000000
-rw-r--r-- 1 root root  50350 Oct 14 13:05 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602676800000000000
-rw-r--r-- 1 root root  22356 Oct 14 13:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602680400000000000
-rw-r--r-- 1 root root  42531 Oct 14 15:01 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602684000000000000
-rw-r--r-- 1 root root  13451 Oct 14 15:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602687600000000000
-rw-r--r-- 1 root root  11566 Oct 14 17:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602691200000000000
-rw-r--r-- 1 root root  10416 Oct 14 17:56 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602694800000000000
-rw-r--r-- 1 root root  22033 Oct 14 19:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602698400000000000
-rw-r--r-- 1 root root  24227 Oct 14 20:01 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602702000000000000
-rw-r--r-- 1 root root  26894 Oct 14 21:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602705600000000000
-rw-r--r-- 1 root root  16382 Oct 14 21:51 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602709200000000000
-rw-r--r-- 1 root root   4473 Oct 14 22:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602712800000000000
-rw-r--r-- 1 root root   6695 Oct 14 23:53 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602716400000000000
-rw-r--r-- 1 root root   1491 Oct 15 00:58 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602720000000000000
-rw-r--r-- 1 root root   9706 Oct 15 01:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602723600000000000
-rw-r--r-- 1 root root  15279 Oct 15 02:56 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602727200000000000
-rw-r--r-- 1 root root  33968 Oct 15 04:00 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602730800000000000
-rw-r--r-- 1 root root  52214 Oct 15 05:05 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602734400000000000
-rw-r--r-- 1 root root  55585 Oct 15 06:07 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602738000000000000
-rw-r--r-- 1 root root  16777 Oct 15 07:02 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602741600000000000
-rw-r--r-- 1 root root  16766 Oct 15 08:01 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602745200000000000
-rw-r--r-- 1 root root  40304 Oct 15 08:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602748800000000000
-rw-r--r-- 1 root root  43620 Oct 15 10:03 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602752400000000000
-rw-r--r-- 1 root root  33567 Oct 15 10:59 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602756000000000000
-rw-r--r-- 1 root root   4454 Oct 15 11:10 unsent-orders-1wFTAgs9DP5RSnCqKV1eLf6N9wtk4EAtmN5DpSxcs8EjT69tGE-1602759600000000000
root@PC1-ABC:/home/storj/orders/unsent# ls | wc -l
4608
  1. Stop the storagenode
  2. Execute with sqlite3
sqlite3 /home/storj/storage/orders.db
  1. When you see a sqlite> prompt, execute this script:
delete from unsent_order as uo
where exists(select 1 from unsent_order where satellite_id=uo.satellite_id and serial_number=uo.serial_number group by satellite_id, serial_number having count(*) > 1);
CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number);
.exit
  1. Start the storagenode
  2. Check your logs
1 Like

@Alexey

Thanks for provide the step for fix error. :grinning:

I’m fail to edit , the tool show it have syntax error.
maybe “AS” clause can’t be used in WHERE condition? i’m not sure

root@PC1-ABC:/home/storj# sqlite3 /home/storj/storage/orders.db
SQLite version 3.11.0 2016-02-15 17:29:24
Enter ".help" for usage hints.
sqlite> delete from unsent_order as uo
   ...> where exists(select 1 from unsent_order where satellite_id=uo.satellite_id and serial_number=uo.serial_number group by satellite_id, serial_number having count(*) > 1);
Error: near "as": syntax error
sqlite> CREATE UNIQUE INDEX idx_orders ON unsent_order(satellite_id, serial_number);
Error: no such table: main.unsent_order
sqlite> .exit

The minimum allowed version is v3.25.2 or later.
Please, use the docker version instead

1 Like

@Alexey

I using version v3.33.0 on windows sqlite3 tool now
In second command running over 18 hours but keeping run.
Once completed total 3 of command .
I will update again. thanks.

  • I also using docker sqlite3 version on linux OS (M.2 SSD) , hope can be faster to finish the command.
root@PC1-ABC:~# docker run \
> -it \
> --rm \
> -v ~:/data \
> sstc/sqlite3 \
> sqlite3 orders.db
SQLite version 3.30.1 2019-10-10 20:19:45
Enter ".help" for usage hints.
sqlite> delete from unsent_order as uo
   ...> where exists(select 1 from unsent_order where satellite_id=uo.satellite_id and serial_number=uo.serial_number group by satellite_id, serial_number having count(*) > 1);

Perhaps you can use a tmpfs if you have enough RAM.

On Windows you should increase the RAM allocation in the Docker desktop settings, because by default it offer only 2GB of RAM total.
Then you can copy an orders.db to the /ramdisk and open it in the sqlite (you can check the linked thread for example)
Then perform the same script, it should work faster than on SSD
Just do not forget to copy the database back before exiting from the container :slight_smile:

1 Like