ActivityWatch/aw-server-rust

database upgrade causes all data lost

rqdmap opened this issue · 4 comments

rqdmap commented

I have used ActivityWatch for several months. Today I find all my activity data before September 15th 0:52 is lost. I follow the time and check the aw-server-rust log:

[2023-09-15 00:52:37][INFO][aw_server]: Using DB at path "/home/rqdmap/.local/share/activitywatch/aw-server-rust/sqlite.db"
[2023-09-15 00:52:37][INFO][aw_server::dirs]: Cannot find assets "./aw-webui/dist/"
[2023-09-15 00:52:37][INFO][aw_server]: Using aw-webui assets at path "/data/rqdmap/Applications/activitywatch/aw-server-rust/./static/"
[2023-09-15 00:52:37][INFO][aw_server::endpoints]: Starting aw-server-rust at 127.0.0.1:5600
[2023-09-15 00:52:37][WARN][rocket::launch]: 🚀 Rocket has launched from http://127.0.0.1:5600
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Upgrading database to v2, adding data field to buckets
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Upgrading database to v3, replacing the broken data field for buckets
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Upgrading database to v4, adding table for key-value storage
[2023-09-15 00:52:37][INFO][aw_datastore::legacy_import::import]: Importing legacy DB
Importing legacy bucket: Bucket { bid: Some(1), id: "aw-watcher-window_ArchLinux", _type: "currentwindow", client: "aw-watcher-window", hostname: "ArchLinux", created: Some(2022-12-13T20:43:01.353472Z), data: {}, metadata: BucketMetadata { start: None, end: None }, events: None, last_updated: None }
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Created bucket aw-watcher-window_ArchLinux
Importing 0 events for aw-watcher-window_ArchLinux
Importing legacy bucket: Bucket { bid: Some(2), id: "aw-watcher-afk_ArchLinux", _type: "afkstatus", client: "aw-watcher-afk", hostname: "ArchLinux", created: Some(2022-12-13T20:43:01.361651Z), data: {}, metadata: BucketMetadata { start: None, end: None }, events: None, last_updated: None }
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Created bucket aw-watcher-afk_ArchLinux
Importing 0 events for aw-watcher-afk_ArchLinux
Importing legacy bucket: Bucket { bid: Some(3), id: "aw-watcher-vim_ArchLinux", _type: "app.editor.activity", client: "aw-watcher-vim", hostname: "ArchLinux", created: Some(2022-12-13T20:44:34.887023Z), data: {}, metadata: BucketMetadata { start: None, end: None }, events: None, last_updated: None }
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Created bucket aw-watcher-vim_ArchLinux
Importing 1 events for aw-watcher-vim_ArchLinux
Importing legacy bucket: Bucket { bid: Some(4), id: "aw-stopwatch", _type: "general.stopwatch", client: "aw-webui", hostname: "unknown", created: Some(2023-02-19T23:45:01.803064Z), data: {}, metadata: BucketMetadata { start: None, end: None }, events: None, last_updated: None }
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Created bucket aw-stopwatch
Importing 0 events for aw-stopwatch
[2023-09-15 00:52:37][INFO][aw_datastore::datastore]: Successfully imported legacy database
[2023-09-15 00:52:50][INFO][rocket_cors::_]: Verifying origin: chrome-extension://nglaklhklhcoonedhgnpgddginnjdadi
[2023-09-15 00:52:50][INFO][rocket_cors::_]: Origin has a regex match? true
[2023-09-15 00:52:50][INFO][aw_datastore::datastore]: Created bucket aw-watcher-web-chrome
[2023-09-15 00:52:50][INFO][rocket_cors::_]: Verifying origin: chrome-extension://nglaklhklhcoonedhgnpgddginnjdadi
[2023-09-15 00:52:50][INFO][rocket_cors::_]: Origin has a regex match? true
[2023-09-15 00:52:53][INFO][rocket_cors::_]: Verifying origin: chrome-extension://nglaklhklhcoonedhgnpgddginnjdadi
[2023-09-15 00:52:53][INFO][rocket_cors::_]: Origin has a regex match? true

It seems related to the suspicious aw_datastore::datastore upgrade... The datastore upgrade message never occurs before. Luckily I make regular bakcups. It looks like a strange bug; If necessary, I will be glad to provide more log messages.

I'm using:

  • aw-server-rust, 0.12.1
  • aw-watcher-afk
  • aw-watcher-window
  • aw-watcher-vim

There is no error in the log, it only says that it imported the data from the old aw-server-python?

Do you usually use aw-server-rust?

The logs suggest that this was no database file before.

rqdmap commented

Thanks for your replying! I usually use aw-server so there should be a database file. Then I checked my shell history commands and found it was my fault to have messed up the file system and lost the database file.

Sorry for wasting your time due to my carelessness:sob: I'll close this issue.