← Back to context

Comment by TekMol

5 days ago

What makes it hard?

Having a single DB that takes write queries via a proxy which spreads them out to multiple read-only-DBs sounds easy at first.

When do you consider the write/transaction to be completed?

What do you do about out-of-sync read replicas?

ACID gets real hard real fast when introducing replication.

  • > When do you consider the write/transaction to be completed?

    Sending a UPDATE/INSERT/DELETE statement to SQLite is not blocking? I would think it is, because in my code I can read the number of affected rows right after I sent the query.

    > What do you do about out-of-sync read replicas?

    Delete them and replace them by uploading a checkpoint and replaying a log of the queries since then.

    • If you are doing statement level replication, you better make sure every query is run in the exact same order (and finishes in the same order).

      Without that you will have drift from your master database.

      With that, you have a whole new host of synchronization issues you need to deal with.