Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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 available as a result logical decoding message size can change and we get LSN from the future random future transaction.
- Loading branch information
Showing
with
172 additions
and 15 deletions.
- +15 −3 pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3PGReplicationStream.java
- +11 −4 pgjdbc/src/main/java/org/postgresql/core/v3/replication/V3ReplicationProtocol.java
- +11 −0 pgjdbc/src/main/java/org/postgresql/replication/ReplicationType.java
- +1 −8 pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationStatusTest.java
- +85 −0 pgjdbc/src/test/java/org/postgresql/replication/LogicalReplicationTest.java
- +49 −0 pgjdbc/src/test/java/org/postgresql/replication/PhysicalReplicationTest.java
@@ -0,0 +1,11 @@ | ||
/* | ||
* Copyright (c) 2017, PostgreSQL Global Development Group | ||
* See the LICENSE file in the project root for more information. | ||
*/ | ||
|
||
package org.postgresql.replication; | ||
|
||
public enum ReplicationType { | ||
LOGICAL, | ||
PHYSICAL | ||
} |