Large history.db-wal file

I’m doing a cleanup and backup and I noticed that my ~/.local/share/atuin/history.db-wal weights 1.6 GB, while the history.db is 21 MB. atuin sync seems to return successfully, but there is no change to that wal file. As far as I read, it would be dangerous to delete it, and if it’s only for the not applied transactions, then it should be rather small, I assume, so now I’m not sure what to do.

atuin doctor:

{
  "atuin": {
    "version": "18.3.0",
    "sync": {
      "cloud": true,
      "records": false,
      "auto_sync": false,
      "last_sync": "2024-10-03 19:04:27.179903607 +00:00:00"
    },
    "sqlite_version": "3.44.0"
  },
  "shell": {
    "name": "zsh",
    "default": "zsh",
    "plugins": [
      "atuin"
    ],
    "preexec": "built-in"
  },
  "system": {
    "os": "Gentoo",
    "arch": "x86_64",
    "version": "2.15",
    "disks": [
      {
        "name": "/dev/md127",
        "filesystem": "xfs"
      },
      {
        "name": "/dev/nvme0n1p1",
        "filesystem": "vfat"
      },
      {
        "name": "/dev/nvme0n1p2",
        "filesystem": "vfat"
      },
      {
        "name": "/dev/sdb1",
        "filesystem": "exfat"
      },
      {
        "name": "/dev/sda1",
        "filesystem": "fuseblk"
      }
    ]
  }
}

Can you run

sqlite3 ~/.local/share/atuin/history.db

and then

VACUUM;

please?

2 Likes

Sure, it looks like the db is locked up to do that:

➜ sqlite3 ~/.local/share/atuin/history.db

SQLite version 3.46.1 2024-08-13 09:16:08
Enter ".help" for usage hints.
sqlite> VACUUM;
Runtime error: database is locked (5)
sqlite> 

Maybe try starting a shell with Atuin disabled and try again? It could be stepping on itself

Awesome, yeah it looks like atuin was running in the background at that time. That’s what the Google searches suggested as well. It’s cleaned up now, thanks a lot for the quick help!

.rw------- adamtajti adamtajti  17 MB Thu Oct  3 21:18:37 2024  history.db
.rw------- adamtajti adamtajti  32 KB Thu Oct  3 21:18:42 2024  history.db-shm
.rw------- adamtajti adamtajti  56 KB Thu Oct  3 21:18:42 2024  history.db-wal
2 Likes

Glad it’s sorted! Weird that it somehow got to such a large size though

OP, do you happen to use screen, bg or run a process from the terminal with an & trailing?

I’m thinking that the process was running in the background and locked as it was flung there (detached) somehow.

Have you rebooted recently (or do you run your machine for months)?