Full or Incremental Phase Error: Initialize logical replication stream failed, the source database may have a long transaction
Scenarios
During a full or incremental synchronization, an error is reported, and the log information is as follows: service LOGMANAGER failed, cause by: Initialize logical replication stream failed, the source database may have a long transaction: ***
Possible Causes
A logical replication slot fails to be created in the source database.
Solution
- Check whether the number of replication slots in the source database reaches the upper limit. If yes, delete replication slots that are no longer used from the source database or increase the value of max_replication_slots and restart the source database.
- Run the following command to query the number of logical replication slots:
select count(1) from pg_replication_slots;
- Run the following command to query the maximum number of logical replication slots:
select setting as number from pg_settings where name = 'max_replication_slots';
- Run the following command to query the number of logical replication slots:
- Check whether the source database has long transactions that are not submitted. If yes, slot creation times out. As a result, the task fails.
- Run the following command to query a transaction status:
select pid, datname, state, backend_xid, xact_start, (now() - xact_start) as cost from pg_stat_activity where backend_xid is not null order by xact_start;
- Run the following command to stop a long transaction:
select pg_terminate_backend(pid);
- Run the following command to query a transaction status:
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