top | item 38481475

(no title)

langarus | 2 years ago

Great concept! What if the user is offline, makes updates to the local/embedded DB, but when it gets online there's an issue in syncing that prevents updating the postgress with the SQLite changes?

Is SQLite reverted to postgress and thus the changes lost?

discuss

order

ochiba|2 years ago

The client does not update its state to the authoritative state of the server as long as there's pending writes present in the client's upload queue. If there is an error with uploading a write to the server (either a network error or the server returning an HTTP error response), the write will remain in the upload queue and the upload will be retried.

If the server can automatically resolve an error or conflict, it would return a 2xx response and the client's state will be updated to match the server's authoritative state.

If the conflict/error cannot automatically be resolved, there are a few options:

- The server can return a 2xx response but record information about the conflict that allows a user to resolve it (e.g. prompt a user to manually resolve the conflict — either the end-user or administrator for example)

- The server can save details in a dead letter queue

More details are documented here:

https://docs.powersync.com/architecture/consistency

https://docs.powersync.com/usage/lifecycle-maintenance/handl...