-
Bug
-
Resolution: Done
-
Major
-
3.2.0.Alpha1, 3.1.1.Final
-
None
-
False
-
None
-
False
-
-
When setting the connector to use snapshot.mode as initial_only, the streaming event source's init method is called, which for PostgreSQL refreshes the schema details. The issue is that the connection is not in auto-commit mode, leaving an open transaction even though streaming is skipped. We can only observe this behavior on Kafka Connect, as the task remains in a RUNNING state, which means the original main connection is left open and in progress. When using the embedded engine as the basis, we automatically shutdown after the snapshot and therefore, this use case is not observed there.
There are a few options:
1. I move the recently added Closeable call for the StreamingChangeEventSource up into streamEvents in the ChangeEventSourceCoordinator, wrapping the contents in a try-finally block, executing the close in finally.
2. We apply some hack to in the PostgreSQL change event source's init call to rollback the connection after the schema is refreshed, in case the snapshot mode is initial only.
3. We use a separate connection to refresh the schema.
I genuinely believe (1) feels far more idiomatic to me, but open to ideas.