Closed alikonhz closed 1 year ago
At first glance it LGTM, but I haven't used the v2 streaming protocol, so I'd appreciate if we can get a few more reviewers.
Hi @jackc, Do you have someone on your mind in particular? I don't know anyone with experience in PG logical decoding. However, I may create integration test which will validate the protocol on an actual PG database.
@alikonhz I don't have anyone in particular in mind but there usually are a few people watching this repo. I'll give this a week or so and then merge it if no one gives any additional feedback.
My mainly experience is about V1 protocol, but I can read the spec firstly then review the code.
Thanks!
Postgres since version 14 supports streaming large in-progress transactions via replication connection. This PR adds support of new messages (Stream Start/Stop/Commit/Abort) as well as updated V2 messages. Some messages (e.g. Insert/Update/Delete) have additional field (xid) when being streamed via V2 protocol. I addressed this by creating new structs *V2 (InsertMessageV2, etc.) and adding function ParseV2(data []byte, inStream bool). I also updated sample application. I took Information about message format from here: https://www.postgresql.org/docs/current/protocol-logicalrep-message-formats.html