5 ms·
This may be a stupid question but what happens when two users update data in the same block? Also, does every update send an entire block over the wire?
by damiankennedy 5y ago
This may be a stupid question but what happens when two users update data in the same block? Also, does every update send an entire block over the wire?
- sekao 5y agoThat would be fine, sqlite takes care of correctly updating the db file, though i do need to ensure i'm writing from a single thread. And yes every update sends the whole block over, which is 1/4 of a MB (could've made it smaller but i felt that was small enough).
- xg15 5y agoI'm not so sure this would work. Yes, SQLite will do its best to synchronize the requests, but that's all built on the assumption the file exists on a normal file system with locks, consistency, etc. However, this is not the case here. At the very least, you'd have to emulate file locks on the HTTP layer - and deal with the problem of requests being delayed, getting losts, clients suddenly vanishing, etc. > though i do need to ensure i'm writing from a single thread. But how would you do that? This being a web app, it's hard to ensure you're even writing from a single machine.
- sekao 5y ago> but that's all built on the assumption the file exists on a normal file system with locks, consistency, etc. However, this is not the case here. It is the case here. Writes are happening on a normal linux VPS, and subsequently copied to S3. The read-only queries are using the HTTP VFS. It would be incredibly bad to enable direct writes to a db from arbitrary clients.
- xg15 5y agoAh, now I get it. I agree, if writes go through a backend, this should work.