superfly / litefs

FUSE-based file system for replicating SQLite databases across a cluster of machines
Apache License 2.0
3.78k stars 89 forks source link

Unable to find `-pos` file #174

Closed kentcdodds closed 1 year ago

kentcdodds commented 1 year ago

In my litefs-indie app (the simpler app I'm testing litefs with), I'm trying to implement Using TXID to Handle Consistency and having trouble finding the TXID. It doesn't appear my instances have a -pos file anywhere...

~/Desktop/litefs-indie (main) 👾
$ fly ssh console
Connecting to fdaa:0:23df:a7b:14bf:2:da39:2... complete
# echo $FLY_REGION
maa
# ls -al /litefs/data
total 0
-rw-rw-rw- 1 root root 40960 Nov 11 19:31 sqlite.db
# ls -al /data
total 32
drwxr-xr-x  4 root root  4096 Nov 11 18:58 .
drwxr-xr-x 25 root root  4096 Nov 11 19:31 ..
drwxr-xr-x  3 root root  4096 Nov 11 18:58 dbs
-rw-r--r--  1 root root    25 Nov 11 18:58 id
drwx------  2 root root 16384 Nov 11 18:58 lost+found
# ls -al /data/dbs
total 12
drwxr-xr-x 3 root root 4096 Nov 11 18:58 .
drwxr-xr-x 4 root root 4096 Nov 11 18:58 ..
drwxr-xr-x 3 root root 4096 Nov 11 19:37 sqlite.db
# ls -al /data/ids
ls: cannot access '/data/ids': No such file or directory
# ls -al /data/lost+found
total 20
drwx------ 2 root root 16384 Nov 11 18:58 .
drwxr-xr-x 4 root root  4096 Nov 11 18:58 ..
# cat /data/id
4EC662D3DF4235D20F0D1E6F
# ls -al /litefs/data
total 0
-rw-rw-rw- 1 root root 40960 Nov 11 19:31 sqlite.db
# exit 0
~/Desktop/litefs-indie (main) 👾
$ fly ssh console -s
? Select instance: den.litefs-indie.internal (fdaa:0:23df:a7b:d826:2:da30:2)
Connecting to fdaa:0:23df:a7b:d826:2:da30:2... complete
# ls -al /data/dbs
total 12
drwxr-xr-x 3 root root 4096 Nov 11 18:56 .
drwxr-xr-x 4 root root 4096 Nov 11 18:56 ..
drwxr-xr-x 3 root root 4096 Nov 11 18:59 sqlite.db
# ls -al /litefs/data
total 0
-r--r--r-- 1 root root     9 Nov 11 19:29 .primary
-r--r--r-- 1 root root 40960 Nov 11 19:29 sqlite.db
# 

Any ideas?

benbjohnson commented 1 year ago

@kentcdodds it doesn’t show up in ls. I was worried about having too many files and it getting messy but maybe that’s just too confusing. I’ll fix that. You can open it directly by name though.

You should be able to run: cat /litefs/data/sqlite.db-pos

kentcdodds commented 1 year ago

Yup! Thank you 👍

benbjohnson commented 1 year ago

@kentcdodds I fixed this up so ls will now show the position file in the listing. https://github.com/superfly/litefs/pull/175

kentcdodds commented 1 year ago

Thanks!