PGReplicationStream
PGReplicationStream is an API class provided by the GaussDB JDBC driver. It is used to operate logical replication streams.
Inheritance Relationship of PGReplicationStream
PGReplicationStream is a logical replication API. Its implementation class is V3PGReplicationStream, which is in the com.huawei.opengauss.jdbc.core.v3.replication package. The declaration of the class is as follows:
public class V3PGReplicationStream implements PGReplicationStream
Constructor Method
public V3PGReplicationStream(CopyDual copyDual, LogSequenceNumber startLSN, long updateIntervalMs, ReplicationType replicationType)
Common Methods
| Method Name | Return Type | Description | throws |
|---|---|---|---|
| close() | void | Ends the logical replication and releases resources. | SQLException |
| forceUpdateStatus() | void | Forcibly sends the LSN status received, flushed, and applied last time to the backend. | SQLException |
| getLastAppliedLSN() | LogSequenceNumber | Obtains the LSN when the primary node replays logs last time. | - |
| getLastFlushedLSN() | LogSequenceNumber | Obtains the LSN flushed by the primary node last time, that is, the LSN pushed by the current logical decoding. | - |
| getLastReceiveLSN() | LogSequenceNumber | Obtains the last received LSN (for LSN-based replication slots) or CSN (for CSN-based replication slots). | - |
| isClosed() | boolean | Determines whether the replication stream is disabled. | - |
| read() | ByteBuffer | Reads the next WAL record from the backend. If the data cannot be read, this method blocks the I/O read. | SQLException |
| readPending() | ByteBuffer | Reads the next WAL record from the backend. If the data cannot be read, this method does not block the I/O read. | SQLException |
| setAppliedLSN(LogSequenceNumber applied) | void | Sets the applied LSN. | - |
| setFlushedLSN(LogSequenceNumber flushed) | void | Updates the LSN (for LSN-based replication slots) or CSN (for CSN-based replication slots), which is sent to the backend at the next update to update the LSN (for LSN-based replication slots) or CSN (for CSN-based replication slots) on the server. | - |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.