PGReplicationConnection
PGReplicationConnection is an API class provided by the JDBC driver in GaussDB. It is used to implement functions related to logical replication.
Inheritance Relationship of PGReplicationConnection
PGReplicationConnection is a logical replication API. Its implementation class is PGReplicationConnectionImpl, which is in the com.huawei.gaussdb.jdbc.replication package. The declaration of the class is as follows:
public class PGReplicationConnection implements PGReplicationConnection
Constructor
public PGReplicationConnection(BaseConnection connection)
Common Methods
Return Value |
Method |
Description |
Throws |
---|---|---|---|
ChainedCreateReplicationSlotBuilder |
createReplicationSlot() |
Creates a logical replication slot. Only cluster-level (CSN-based) logical replication slots can be created for connecting to CNs, and replication slots with the same name can be created on other CNs and primary DNs. Only local (LSN-based) logical replication slots can be created for connecting to DNs. For details about how to create an LSN-based logical replication slot on a CN or a CSN-based logical replication slot on a DN, see the SQL function pg_create_logical_replication_slot for logical replication. |
- |
void |
dropReplicationSlot(String slotName) |
Deletes a logical replication slot. When you connect to a CN to delete a logical replication slot, if the logical replication slot is an LSN-based logical replication slot, only the replication slot of the current node is deleted. Replication slots with the same name on other nodes are not affected. When a CSN-based logical replication slot with the same name exists on other nodes, no error is reported because some nodes do not have replication slots. In addition, replication slots with the same name on all nodes are successfully deleted. If no replication slot exists on any node, an error is reported. If an LSN-based logical replication slot remains on the current CN and a CSN-based logical replication slot with the same name remains on other nodes, connecting to a CN to delete a replication slot will delete only the local LSN-based logical replication slot. After the deletion is complete, perform the deletion operation again to delete the replication slots with the same name on other nodes. |
SQLException,IOException |
ChainedStreamBuilder |
replicationStream() |
Enables logical replication. |
- |
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.See the reply and handling status in My Cloud VOC.
For any further questions, feel free to contact us through the chatbot.
Chatbot