[HN Gopher] LiteSync - Easy synchronization of SQLite databases
       ___________________________________________________________________
        
       LiteSync - Easy synchronization of SQLite databases
        
       Author : thunderbong
       Score  : 43 points
       Date   : 2023-01-05 19:34 UTC (3 hours ago)
        
 (HTM) web link (litesync.io)
 (TXT) w3m dump (litesync.io)
        
       | somedude82 wrote:
       | then there is https://github.com/benbjohnson/litestream
        
         | mtlynch wrote:
         | Litestream is one-way replication, so it can't sync across
         | multiple writers.
         | 
         | LiteFS is Ben Johnson's newer project that does SQLite
         | synchronization across nodes:
         | https://github.com/superfly/litefs
        
       | PreInternet01 wrote:
       | I'm not entirely opposed to a commercial product, but the list of
       | documented limitations does not make me reach for my wallet just
       | yet:
       | 
       | 1. Avoid using functions that return different values each time
       | they are called, like random() and date('now')
       | 
       | 2. AUTOINCREMENT keyword is not supported
       | 
       | 3. We must use just a single connection to each database file. Do
       | not let many apps access the same database file. Each instance
       | must use its own db file, and then they will be replicated and
       | synchronized using LiteSync
       | 
       | There are definitely obvious technical reasons for these, but it
       | may make using the product for existing apps pretty much
       | impossible.
       | 
       | Also worrisome is the lack, at least anywhere in the examples, of
       | authentication parameters on the (proprietary, I guess?) TCP
       | replication protocol, and no mention of over-the-wire encryption.
        
         | jitl wrote:
         | RANDOM and NOW you can easily do in application space.
         | 
         | AUTOINCREMENT you can replace in application space with nanoid,
         | or similar semi-random ordered ID.
         | 
         | These practices are standard if you're creating any data
         | offline on clients or syncing two ways.
        
         | LamaOfRuin wrote:
         | Also no mention of how it handles conflicting transactions from
         | separate nodes.
        
         | avtar wrote:
         | > 3. We must use just a single connection to each database
         | file. Do not let many apps access the same database file. Each
         | instance must use its own db file
         | 
         | Isn't this a sqlite limitation?
        
           | sebastien_b wrote:
           | There are file locking mechanisms you can opt into (compile
           | time options) to have multi-process access to the same
           | database file - it does require either some coordination
           | and/or more error handling, especially when writing to the
           | database.
        
         | samwillis wrote:
         | As LiteSync used eventual consistency AUTOINCREMENT isn't
         | possible. You would have collisions when a node come back on
         | after what they are calling "Airplane Mode".
         | 
         | I suspect the issue with random() and date('now') similarly are
         | they it will replay transactions on other nodes, and these
         | would return different values. Obviously they could design the
         | system to save the values for returning when replaying a
         | transaction if they decided it was necessary.
         | 
         | I haven't looked in detail, but I'm suspicious they are using
         | the SQLite Session extension:
         | https://www.sqlite.org/sessionintro.html
        
           | sebastien_b wrote:
           | > _I haven 't looked in detail, but I'm suspicious they are
           | using the SQLite Session extension:
           | https://www.sqlite.org/sessionintro.html_
           | 
           | Having used the Session extension extensively, from reading
           | the info this would also be my conclusion (makes no use if
           | it, which to me makes little sense).
        
         | sebastien_b wrote:
         | Also makes no mention about schema changes.
        
       | NelsonMinar wrote:
       | $750 for a one time company license plus extra for dedicated
       | support.
       | 
       | Who's behind this? The pages say they are copyright Gensis
       | Sistemas LTDA but I can't find anything else by that name.
       | 
       | What tech is this? There's no licensing information in the
       | download. sqlite doesn't require any attribution. I think
       | litestream does, so maybe they're not using it?
        
         | ricardobeat wrote:
         | They have a similar product at https://litereplica.io, and that
         | one has an About Us page: https://litereplica.io/company.html
        
       | jitl wrote:
       | There's a free CRDT based SQLite sync system. It's for a
       | different use-case -- local first software including peer to peer
       | sync use-case.
       | 
       | https://github.com/vlcn-io/cr-sqlite
       | 
       | 51 days ago: https://news.ycombinator.com/item?id=33606311
        
         | [deleted]
        
       | endisneigh wrote:
       | I'd be more interested in a managed SQLite database accessible
       | through the web. Basically Hasura but for SQLite.
        
         | adolph wrote:
         | Like running redbean on someone else's computer?
         | 
         |  _redbean embeds Lua, SQLite, and MbedTLS into a fork() driven
         | application server that benchmarks at 1.1 million qps on a
         | personal computer._
         | 
         | https://redbean.dev/
         | 
         | https://www.youtube.com/watch?v=1ZTRb-2DZGs
        
       | [deleted]
        
       | feldrim wrote:
       | Rqlite[0] does not use SQLite API but it handles replication too.
       | 
       | 0. https://github.com/rqlite/rqlite
        
       | WFHRenaissance wrote:
       | Lol isn't this just Litestream?
        
         | samwillis wrote:
         | Lightstream is single node only, effectively a remote WAL for
         | point in time recovery, this is multi-node and eventually
         | consistent. You can write to nodes while they are "off line"
         | and sync later.
         | 
         | This is geared towards, say, having an application running on a
         | device on an airplane, maybe a passenger CRM. You can have it
         | run and update the DB while in the air with no connection, the
         | DB will then sync with main node once on the ground with a
         | connection.
        
       ___________________________________________________________________
       (page generated 2023-01-05 23:00 UTC)