nalgeon / redka

Redis re-implemented with SQLite
BSD 3-Clause "New" or "Revised" License
3.53k stars 101 forks source link

Failed to open db with path like "./a/b/c" #38

Closed jxs1211 closed 1 month ago

jxs1211 commented 1 month ago

I got an error when opening a db with file path like:

    log.Println("dbPath: ", dbPath)
    db, err := redka.Open(dbPath, o)

issue goes like:

➜  ktt git:(feat/cli) ✗ go test -timeout 30s -run ^TestRedka$ ktt/backend/db -v
=== RUN   TestRedka
2024/10/03 21:02:59 dbPath:  /root/.KTT/db/sqlite.db
    helper_test.go:38: 
                Error Trace:    /home/going/workspace/myspace/golang/build-together/ktt/backend/db/helper_test.go:38
                Error:          Received unexpected error:
                                disk I/O error: no such file or directory
                Test:           TestRedka

I changed the path to /root/KTT/db/sqlite.db(not .KTT), it works well, not sure whether it's a bug. Maybe someone can tell me something about it?

nalgeon commented 1 month ago

The error means that the directory /root/.KTT/db does not exist. I don't see how this is a bug in Redka, but if you think otherwise, please explain your reasoning.

jxs1211 commented 1 month ago

Sorry, I verified it again, it's my misunderstanding.

nalgeon commented 1 month ago

No worries.