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 )
);
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:
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?