shardingsphere icon indicating copy to clipboard operation
shardingsphere copied to clipboard

Modify the slot occupation exception caused by PostgreSQL in multiple data sources

Open ReyYang opened this issue 4 years ago • 0 comments

Bug Report

Which version of ShardingSphere did you use?

Version 5.0.0

Which project did you use? ShardingSphere-JDBC or ShardingSphere-Proxy?

ShardingSphere-Proxy

Expected behavior

PostgreSQL successfully migrated during data migration of multiple data sources

Actual behavior

PostgreSQL has an exception of slot occupancy during data migration of multiple data sources

Reason analyze (If you can)

It may be that multiple data sources have created two replication streams, but because replication_slot is bound to PID, an exception is thrown during the second creation

Steps to reproduce the behavior, such as: SQL to execute, sharding rule configuration, when exception occur etc.

1、Use shardingsphere-proxy to add resources 2、Create migration task 3、

org.apache.shardingsphere.data.pipeline.core.ingest.exception.IngestException: org.postgresql.util.PSQLException: ERROR: replication slot "sharding_scaling" is active for PID 36827
    at org.apache.shardingsphere.data.pipeline.postgresql.ingest.PostgreSQLWalDumper.dump(PostgreSQLWalDumper.java:98)
    at org.apache.shardingsphere.data.pipeline.postgresql.ingest.PostgreSQLWalDumper.start(PostgreSQLWalDumper.java:76)
    at org.apache.shardingsphere.data.pipeline.core.task.IncrementalTask.start(IncrementalTask.java:86)
    at org.apache.shardingsphere.data.pipeline.api.executor.AbstractLifecycleExecutor.run(AbstractLifecycleExecutor.java:47)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
    at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)
    at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69)
    at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
Caused by: org.postgresql.util.PSQLException: ERROR: replication slot "sharding_scaling" is active for PID 36827
    at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2440)
    at org.postgresql.core.v3.QueryExecutorImpl.processCopyResults(QueryExecutorImpl.java:1116)
    at org.postgresql.core.v3.QueryExecutorImpl.startCopy(QueryExecutorImpl.java:842)
    at org.postgresql.core.v3.replication.V3ReplicationProtocol.initializeReplication(V3ReplicationProtocol.java:58)
    at org.postgresql.core.v3.replication.V3ReplicationProtocol.startLogical(V3ReplicationProtocol.java:42)
    at org.postgresql.replication.fluent.ReplicationStreamBuilder$1.start(ReplicationStreamBuilder.java:38)
    at org.postgresql.replication.fluent.logical.LogicalStreamBuilder.start(LogicalStreamBuilder.java:37)
    at org.apache.shardingsphere.data.pipeline.postgresql.ingest.wal.LogicalReplication.createReplicationStream(LogicalReplication.java:75)
    at org.apache.shardingsphere.data.pipeline.postgresql.ingest.PostgreSQLWalDumper.dump(PostgreSQLWalDumper.java:81)
    ... 10 common frames omitted

Example codes for reproduce this issue (such as a github link).

ReyYang avatar Dec 24 '21 01:12 ReyYang