Thread: [JDBC] [pgjdbc/pgjdbc] 170d9c: Bug: Not valid calculate lastReceiveLSN forlogica...
[JDBC] [pgjdbc/pgjdbc] 170d9c: Bug: Not valid calculate lastReceiveLSN forlogica...
From
Vladimir Gordiychuk
Date:
Branch: refs/heads/master Home: https://github.com/pgjdbc/pgjdbc Commit: 170d9c27810349456e56aff1c36a0ad6584b9e28 https://github.com/pgjdbc/pgjdbc/commit/170d9c27810349456e56aff1c36a0ad6584b9e28 Author: Vladimir Gordiychuk <folyga@gmail.com> Date: 2017-04-07 (Fri, 07 Apr 2017) Changed paths: M pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3PGReplicationStream.java M pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3ReplicationProtocol.java A pgjdbc/src/main/java/org/postgresql/replication/ReplicationType.java M pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationStatusTest.java M pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationTest.java M pgjdbc/src/test/java/org/postgresql/replication/PhysicalReplicationTest.java Log Message: ----------- Bug: Not valid calculate lastReceiveLSN for logical replication (#801) * Bug: Not valid receiveLSN that lead to lost parallel transactions Add test that reproduce issue from https://www.postgresql.org/message-id/CAHHbV7V4XvdHGw_jpR9Xyq3fz%3Df%2BO4oa%2B73sbizGTv_AvmDXhQ%40mail.gmail.com * bug: lastReceiveLSN not valid for logical replication Logical and Physical replication use different algorithms to calculate the lastReceiveLSN. For physical replication the calculation is: startLsn from XLogData plus the payloadsize; this is correct as we have the raw data. For logical replication the lastReceiveLSN uses startLSN from XLogData without the payload size as payload size is not availableas a result logical decoding message size can change and we get LSN from the future random future transaction.