After this update i have some zeros

Then .output in the sqlite should work too.
Ok. Perhaps database is unrecoverable. Then I would suggest to create an empty one:

  1. Stop the storagenode
  2. remove the bandwidth.db
  3. execute with sqlite3 container:
sqlite3 /storage/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 INDEX idx_bandwidth_usage_satellite ON bandwidth_usage(satellite_id);
CREATE INDEX idx_bandwidth_usage_created   ON bandwidth_usage(created_at);
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 )
                                                                        );
.exit
  1. Start the storagenode
  2. Check your dashboard

Alexey one more question.
After i open sqlite3 should i just copy -> paste this as single script or should i paste each line separately?

" ```
CREATE TABLE bandwidth_usage (
satellite_id BLOB NOT NULL,
action INTEGER NOT NULL,
amount BIGINT NOT NULL,
created_at TIMESTAMP NOT NULL
);
CREATE INDEX idx_bandwidth_usage_satellite ON bandwidth_usage(satellite_id);
CREATE INDEX idx_bandwidth_usage_created ON bandwidth_usage(created_at);
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 TABLE bandwidth_usage (
                                                satellite_id  BLOB    NOT NULL,
                                                action        INTEGER NOT NULL,
                                                amount        BIGINT  NOT NULL,
                                                created_at    TIMESTAMP NOT NULL
                                        );
CREATE INDEX idx_bandwidth_usage_satellite ON bandwidth_usage(satellite_id);
CREATE INDEX idx_bandwidth_usage_created   ON bandwidth_usage(created_at);
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 )
                                                                        );

Just copy (there is a little copy button on the code block in the upper right corner) and paste when you see a sqlite> prompt.

1 Like

Thank you, but something did not worked out:

sudo sqlite3
SQLite version 3.22.0 2018-01-22 18:45:57
Enter “.help” for usage hints.
Connected to a transient in-memory database.
Use “.open FILENAME” to reopen on a persistent database.
sqlite> sqlite3 /storage/bandwidth.db
…> CREATE TABLE bandwidth_usage (
…> satellite_id BLOB NOT NULL,
…> action INTEGER NOT NULL,
…> amount BIGINT NOT NULL,
…> created_at TIMESTAMP NOT NULL
…> );
Error: near “sqlite3”: syntax error
sqlite> CREATE INDEX idx_bandwidth_usage_satellite ON bandwidth_usage(satellite_id);
Error: no such table: main.bandwidth_usage
sqlite> CREATE INDEX idx_bandwidth_usage_created ON bandwidth_usage(created_at);
Error: no such table: main.bandwidth_usage
sqlite> 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 )
…> );
sqlite> .exit

I’ve managed another way to deal with it.
I’ve just navigated to the storage folder, and run all commands from the manual without /storage/. Looks like everyting is worked out, now i’m at this point:

sqlite3 bandwidthNEW.db “.read dump_all_notrans.sql”

It looks like it will take long time, as the original db ±19Gb. Currenlty i see the new file growing up but after 30min. of work it only have now ±1Gb of size.
I don’t want my node to be offline for next ±8hours. as it looks like it will take about that long to recreated db.

If my current bandwith.db is corrupted, probably storagenode can’t use it propperly. Temporary two other DB’s “dump_all.sql” and “dump_all_notrans.sql” are not in use by storagenode. I’ve decided to leave runing node with corrupted bandwitdh.db while in the background i’m creating new db bandwidhNEW.db. Once it will be finished i’m about to stop the node, rename new db to original name. And as i understand i will loose some stats data (that is currenlty generated), but i will have new and correctly working db. The main question will it work that way? :slight_smile:

@Alexey thank you !!!

I did it !!

looks like its working now.
Somehow instead of 19Gb it’s now 18Gb, but it’s working :slight_smile:

Have a nice weekend !

1 Like