PGReplicationStream#read() method. It means that
process wal record should be fast as possible, because during process wal record lead to
disconnect by timeout from server.
| Modifier and Type | Method and Description |
|---|---|
| public void | close()
Redeclares java. Stop replication changes from server and free resources. |
| public void | |
| public LogSequenceNumber | Returns: not null location of the last WAL applied in the standby.Last applied lsn sent in update message to backed. |
| public LogSequenceNumber | Returns: NOT NULL location of the last WAL flushed to disk in the standby.Last flushed LSN sent in update message to backend. |
| public LogSequenceNumber | Returns: NOT NULL LSN position that was receive last time viaPGReplicationStream#read()
methodParameter updates by execute |
| public boolean | |
| public @Nullable ByteBuffer | Returns: not null byte array received by replication protocol, return ByteBuffer wrap around received byte array with use offset, so, useByteBuffer#array() carefullyRead next wal record from backend. |
| public @Nullable ByteBuffer | Returns: byte array received by replication protocol or NULL if pending message from server absent. Returns ByteBuffer wrap around received byte array with use offset, so, useByteBuffer#array() carefully.Read next WAL record from backend. |
| public void | setAppliedLSN(LogSequenceNumber
NOT NULL location of the last WAL applied in the standby. applied)Inform backend which LSN has been applied on standby. |
| public void | setFlushedLSN(LogSequenceNumber
NOT NULL location of the last WAL flushed to disk in the standby. flushed)Set flushed LSN. |
| close | back to summary |
|---|---|
| public void close() throws SQLException Redeclares java. Stop replication changes from server and free resources. After that connection can be reuse to another queries. Also after close current stream they cannot be used anymore. Note This method can spend much time for logical replication stream on postgresql version 9.6 and lower, because postgresql have bug - during decode big transaction to logical form and during wait new changes postgresql ignore messages from client. As workaround you can close replication connection instead of close replication stream. For more information about it problem see mailing list thread Stopping logical replication protocol
| |
| forceUpdateStatus | back to summary |
|---|---|
| public void forceUpdateStatus() throws SQLException Force send last received, flushed and applied LSN status to backend. You cannot send LSN status
explicitly because
| |
| getLastAppliedLSN | back to summary |
|---|---|
| public LogSequenceNumber getLastAppliedLSN() Last applied lsn sent in update message to backed. Parameter updates only via It is safe to call this method in a thread different than the main thread.
| |
| getLastFlushedLSN | back to summary |
|---|---|
| public LogSequenceNumber getLastFlushedLSN() Last flushed LSN sent in update message to backend. Parameter updates only via It is safe to call this method in a thread different than the main thread.
| |
| getLastReceiveLSN | back to summary |
|---|---|
| public LogSequenceNumber getLastReceiveLSN() Parameter updates by execute It is safe to call this method in a thread different than the main thread. However, usually this
method is called in the main thread after a successful
| |
| isClosed | back to summary |
|---|---|
public boolean isClosed()
| |
| read | back to summary |
|---|---|
| public @Nullable ByteBuffer read() throws SQLException Read next wal record from backend. It method can be block until new message will not get from server. A single WAL record is never split across two XLogData messages. When a WAL record crosses a WAL page boundary, and is therefore already split using continuation records, it can be split at the page boundary. In other words, the first main WAL record and its continuation records can be sent in different XLogData messages.
| |
| readPending | back to summary |
|---|---|
| public @Nullable ByteBuffer readPending() throws SQLException Read next WAL record from backend. This method does not block and in contrast to A single WAL record is never split across two XLogData messages. When a WAL record crosses a WAL page boundary, and is therefore already split using continuation records, it can be split at the page boundary. In other words, the first main WAL record and its continuation records can be sent in different XLogData messages.
| |
| setAppliedLSN | back to summary |
|---|---|
| public void setAppliedLSN(LogSequenceNumber applied) Inform backend which LSN has been applied on standby. Feedback will send to backend on next update status iteration. It is safe to call this method in a thread different than the main thread. The updated value will be sent to the backend in the next status update run.
| |
| setFlushedLSN | back to summary |
|---|---|
| public void setFlushedLSN(LogSequenceNumber flushed) Set flushed LSN. This parameter will be sent to backend on next update status iteration. Flushed LSN position help backend define which WAL can be recycled. It is safe to call this method in a thread different than the main thread. The updated value will be sent to the backend in the next status update run.
| |