Help Center/ Data Replication Service/ Troubleshooting/ Failure Cases/ Real-Time Synchronization from PostgreSQL to PostgreSQL/ Task Startup Error: Initialize logical replication stream failed, the source database may have a long transaction: ****.
Updated on 2024-11-30 GMT+08:00

Task Startup Error: Initialize logical replication stream failed, the source database may have a long transaction: ****.

Scenarios

An error is reported when a task fails to be started, and the log information is as follows: service LOGMANAGER failed, caused by: Initialize logical replication stream failed, the source database may have a long transaction: ****.

Possible Causes

  • If the error information contains detail:Read timed out:, after a DRS task starts, the replication slot creation times out due to long transactions blocking or missing consistency position when DRS incremental capture creates a logical replication slot in the source database.
  • If the error information contains slot [***] is active:, after a DRS task starts, the replication slot fails to be created due to long transaction blocking when DRS incremental capture creates a logical replication slot in the source database. In this case, the status is occupied (active). This error occurs when DRS automatically retries.

Solution

Run the following SQL statement to check whether there is a long transaction in the source database:
select datname, pid, xact_start, state, query from pg_stat_activity where xact_start < current_timestamp - interval '300 second
  • If yes, wait until the long transaction stops and try again.
  • If no, choose Service Tickets > Create Service Ticket in the upper right corner of the management console and contact DRS customer service to increase the value of the connection timeout parameter.