3 ms·
I… really don't get this. The people on SQLite, employed to work on this full time for over a year, have this to say (on the link I posted above): “Because th
by ncruces 2y ago
I… really don't get this.
The people on SQLite, employed to work on this full time for over a year, have this to say (on the link I posted above):
“Because the WASM build does not have shared memory APIs, activating WAL requires that a client specifically activate exclusive-locking mode for a db handle immediately after opening it, before doing anything else with it…
“WAL mode does not provide any concurrency benefits in this environment. On the contrary, the requirement for exclusive locking eliminates all concurrency support…”
I personally worked to implement shared memory WAL for a server side Wasm port of SQLite. But random internet poster decides to “strongly expect it closer to a weekend or two of hacking.”
Please, do me a favor and do spend that weekend or two for the benefit of the rest of us all. It'll sincerely be much appreciated.
PS: it was a random internet poster¹ (who's been posting in this thread) who helped me figure out how to implement shared memory WAL for my port. It still took way more than “a weekend or two.” So if you do figure out how to crack this, I'm sure that people who've been trying for the past year² will definitely appreciate it.
1: https://github.com/ncruces/go-sqlite3/discussions/69 https://github.com/ncruces/go-sqlite3/discussions/69
2: https://github.com/rhashimoto/wa-sqlite https://github.com/rhashimoto/wa-sqlite
- jauntywundrkind 2y ago> WAL mode does not provide any concurrency benefits in this environment. Except we aren't interested in concurrency or performance benefits of WAL; we want it for something else entirely (replication).
- ncruces 2y agoThen you don't need WAL. I didn't say replication isn't possible, I said "that's not how it works." A bunch of different people solved this already (though none in a couple of weekends); common to all of them: they don't use WAL mode.
- jauntywundrkind 2y ago> The shadow WAL is a directory next to your SQLite database where WAL files are effectively recreated as a sequence. . . These WAL files contain the original WAL frames & checksums to ensure consistency. https://litestream.io/how-it-works/ https://litestream.io/how-it-works/ > (though none in a couple of weekends) As I said, getting sqlite in wasm to run in WAL mode such that we could start to implement replication, like for example how litestream does. Not this strawman you build, of implementing replication.
- ncruces 2y agoSeriously? Litestream works out-of-process. It needs shared memory WAL and file locking to work exactly like on "desktop" SQLite for it to even function and produce this "shadow WAL." No ifs, no buts, no inbetweens. You just don't build Litestream without shared memory WAL. That's my entire point. These pieces you seem to think can be made to simply work together can't, in fact, work together at all, much less simply. Exclusive locking mode WAL doesn't work with Litestream, and can't be made to work with Litestream, even with a little elbow grease.
- jauntywundrkind 2y agoLitestreams how-we-did-this to says they take a lock on the whole db during checkpoints to work, so I don't see why shared would be needed. Seriously bro, take a massive chill pill. You have been way overcommitted to the "it's all impossible!!! How stupid to imagine! If only you were smart like me you'd see everything is impossible!" bit way too hard. Take a breather from your possessed absolute self certainty & derogatory belittling of others. There's also lots of different fs impls for wasm! Just because some limitations apply to emscriptens impl doesn't mean another impl has the same limitations, or that we can't improve or work around. Use some of your hard working loves-to-tax-itself big brain to find avenues of possibility, rather than just pissing on every possibility.
- ncruces 2y agoI'm chill bro. Still waiting for your productive couple of weekends. But that'll require more than looking at docs reading the words "lock" and "shared" and assuming you know what those mean.