add a sqlite history backend#2352
Conversation
|
it is possible to set maxOpenConns to higher than that :) just a few things to keep in mind, all of which we've documented fairly extensively in our gotosocial sqlite driver initialization here: https://codeberg.org/superseriousbusiness/gotosocial/src/commit/a2cbe8cf28d3271c52c6032cb9ea1841ea606ada/internal/db/bundb/driver_sqlite.go#L44 |
|
@NyaaaWhatsUpDoc since I'm still using |
|
Merging this because I have other stuff pipelined on top, but comments are still welcome |
|
@slingamn the issue is that the concurrent interrupt goroutine they use in their Query() and Exec() database/sql implementations can put their sqlite connection type into a bad state in which connections return "INTERRUPTED" forever and never recover. i've never been able to make a test case that reveals it in their repo, though i have tried. you can show it in gotosocial still though if you load our repo, remove the "replace modernc.org/sqlite" line in our go.mod to stop using my workaround, then run you can find my 1 commit workaround for it here: https://gitlab.com/NyaaaWhatsUpDoc/sqlite/-/compare/master...workaround%2Fremove-concurrent-interrupt-calls?from_project_id=9241019 and as you can see from the tags here i've been maintaining additional ${version}-concurrency-workaround tags since 2024: https://gitlab.com/NyaaaWhatsUpDoc/sqlite/-/tags you might want to keep an eye on https://github.com/ncruces/go-sqlite3, at the moment it relies on a WebAssembly runtime, but it's currently undergoing an underlying rewrite that uses transpiled WebAssembly to Go code as seen here which i've been helping a little with. in my opinion, the ncruces/go-sqlite3 code is a lot easier to reason with if you ever have issues to upstream fixes for, and doesn't use garbage-collector-opaque "uintptrs" all over the place like the transpiled modernc.org/sqlite does. for the moment if you want i can submit a PR that switches you to my own fork without that issue? or i can just submit a PR when the WebAssembly-free release of https://github.com/ncruces/go-sqlite3 is ready :). or you can just stick with modernc.org/sqlite as it is too, obviously, these are all just my suggestions! |
|
Thanks! I am planning to release Ergo v2.18 with |
cc @felix @NyaaaWhatsUpDoc
modernc.org/sqlitevia the standarddatabase/sqlAPIsynchronous(NORMAL)db.SetMaxOpenConns(1). I wasn't really confident in an alternative strategy? I've found sources saying that it can make sense to run multiple concurrent readers and a single writer, but the workload here is write-heavy so it could lead to starvation?