Closed robacourt closed 3 days ago
@robacourt Hey, I don't know if there was a discussion behind this that I missed, but this change doesn't address the issue stated in the PR description. For one, a single INSERT or UPDATE may be quite large, so the limit of 100 ops per SatOpLog
does not in itself prevent it from overflowing.
More importantly, a single SatOpLog is treated by the client as a transaction. This change effectively splits a single PG transaction into multiple client-side transactions. This might not be an issue in the current implementation due to the fact that transactions are processed on the client in the same order as they are sent by the server, but any addition of concurrency to client-side processing further down the road could lead to subtle bugs because of this.
A proper solution to the payload size problem requires changing the Satellite protocol to support splitting a single transaction into multiple protocol messages.
Great find! Would you mind adding a test to the client side (in clients/typescript/test/satellite/client.test.ts) that ensures the transaction is emitted correctly when begin and commit fall into separate oplog messages?
I think we have one already: https://github.com/electric-sql/electric/blob/31ffde3b0912d3b4e16ee38e5b44ae032b77cb48/clients/typescript/test/satellite/client.test.ts#L275
Is that enough?
To prevent the 100MB payload limit: